[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

Behdad Esfahbod behdad at kemper.freedesktop.org
Sun Aug 12 19:22:23 UTC 2018


 src/hb-iter-private.hh      |    2 +-
 src/hb-machinery-private.hh |   19 ++++++++++++-------
 src/hb-private.hh           |   15 ++++++++++++++-
 3 files changed, 27 insertions(+), 9 deletions(-)

New commits:
commit f9a3eab81008c01a458d16f274b1a0eaaae00e7c
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sun Aug 12 12:21:56 2018 -0700

    Add explicit_operator
    
    Fixes https://github.com/harfbuzz/harfbuzz/issues/1127

diff --git a/src/hb-iter-private.hh b/src/hb-iter-private.hh
index 410a50f9..314133ad 100644
--- a/src/hb-iter-private.hh
+++ b/src/hb-iter-private.hh
@@ -72,7 +72,7 @@ struct Iter<T *>
     array (array_), length (length_) {}
 
   /* Emptiness. */
-  inline operator bool (void) const { return bool (length); }
+  explicit_operator inline operator bool (void) const { return bool (length); }
 
   /* Current item. */
   inline T &operator * (void)
diff --git a/src/hb-private.hh b/src/hb-private.hh
index 1bc996ed..efe7bda9 100644
--- a/src/hb-private.hh
+++ b/src/hb-private.hh
@@ -125,7 +125,20 @@ struct _hb_alignof
 #define alignof(x) (_hb_alignof<x>::value)
 #endif
 
-#endif // __cplusplus < 201103L
+/* https://github.com/harfbuzz/harfbuzz/issues/1127 */
+#ifndef explicit_operator
+#define explicit_operator
+#endif
+
+#else /* __cplusplus >= 201103L */
+
+/* https://github.com/harfbuzz/harfbuzz/issues/1127 */
+#ifndef explicit_operator
+#define explicit_operator explicit
+#endif
+
+#endif /* __cplusplus < 201103L */
+
 
 #if (defined(__GNUC__) || defined(__clang__)) && defined(__OPTIMIZE__)
 #define likely(expr) (__builtin_expect (!!(expr), 1))
commit 470acb6c322fc64556d59847d829d95caa2d51e6
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sun Aug 12 12:09:20 2018 -0700

    Rename

diff --git a/src/hb-machinery-private.hh b/src/hb-machinery-private.hh
index 9b582361..beb61fa9 100644
--- a/src/hb-machinery-private.hh
+++ b/src/hb-machinery-private.hh
@@ -590,13 +590,14 @@ struct BEInt<Type, 4>
  * Lazy loaders.
  */
 
-template <unsigned int WheresFace,
-	  typename Subclass,
+template <typename Subclass,
+	  typename Data,
+	  unsigned int WheresData,
 	  typename Returned,
 	  typename Stored = Returned>
 struct hb_lazy_loader_t
 {
-  static_assert (WheresFace > 0, "");
+  static_assert (WheresData > 0, "");
 
   /* https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern */
   inline const Subclass* thiz (void) const { return static_cast<const Subclass *> (this); }
@@ -623,9 +624,9 @@ struct hb_lazy_loader_t
     Stored *p = this->instance.get ();
     if (unlikely (!p))
     {
-      hb_face_t *face = *(((hb_face_t **) this) - WheresFace);
+      Data *data= *(((Data **) this) - WheresData);
       if (likely (!p))
-	p = thiz ()->create (face);
+	p = thiz ()->create (data);
       if (unlikely (!p))
 	p = thiz ()->create (nullptr); /* Produce nil object. */
       assert (p);
@@ -670,7 +671,9 @@ struct hb_lazy_loader_t
 /* Specializations. */
 
 template <unsigned int WheresFace, typename T>
-struct hb_object_lazy_loader_t : hb_lazy_loader_t<WheresFace, hb_object_lazy_loader_t<WheresFace, T>, T>
+struct hb_object_lazy_loader_t : hb_lazy_loader_t<hb_object_lazy_loader_t<WheresFace, T>,
+						  hb_face_t, WheresFace,
+						  T>
 {
   static inline T *create (hb_face_t *face)
   {
@@ -694,7 +697,9 @@ struct hb_object_lazy_loader_t : hb_lazy_loader_t<WheresFace, hb_object_lazy_loa
 };
 
 template <unsigned int WheresFace, typename T>
-struct hb_table_lazy_loader_t : hb_lazy_loader_t<WheresFace, hb_table_lazy_loader_t<WheresFace, T>, T, hb_blob_t>
+struct hb_table_lazy_loader_t : hb_lazy_loader_t<hb_table_lazy_loader_t<WheresFace, T>,
+						 hb_face_t, WheresFace,
+						 T, hb_blob_t>
 {
   static inline hb_blob_t *create (hb_face_t *face)
   {


More information about the HarfBuzz mailing list