[HarfBuzz] harfbuzz: Branch 'master'

Behdad Esfahbod behdad at kemper.freedesktop.org
Thu Nov 22 06:44:54 UTC 2018


 src/hb-null.hh          |   12 +++++++++---
 src/hb-open-type.hh     |    5 -----
 src/hb-ot-glyf-table.hh |    4 ++--
 3 files changed, 11 insertions(+), 10 deletions(-)

New commits:
commit 2737aa81e5aee721e868bf0c72f19c0245c721fe
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Nov 22 01:44:27 2018 -0500

    Fix up recent change
    
    Fixes https://github.com/harfbuzz/harfbuzz/issues/1300

diff --git a/src/hb-null.hh b/src/hb-null.hh
index 92c7a351..166d2089 100644
--- a/src/hb-null.hh
+++ b/src/hb-null.hh
@@ -40,16 +40,22 @@
 
 /* Use SFINAE to sniff whether T has min_size; in which case return T::null_size,
  * otherwise return sizeof(T). */
-template <typename T, bool b>
+
+/* The hard way...
+ * https://stackoverflow.com/questions/7776448/sfinae-tried-with-bool-gives-compiler-error-template-argument-tvalue-invol
+ */
+template<bool> struct _hb_bool_type {};
+
+template <typename T, typename B>
 struct _hb_null_size
 { enum { value = sizeof (T) }; };
 template <typename T>
-struct _hb_null_size<T, T::min_size ? false : false>
+struct _hb_null_size<T, _hb_bool_type<(bool) T::min_size> >
 { enum { value = T::null_size }; };
 
 template <typename T>
 struct hb_null_size
-{ enum { value = _hb_null_size<T, false>::value }; };
+{ enum { value = _hb_null_size<T, _hb_bool_type<true> >::value }; };
 
 extern HB_INTERNAL
 hb_vector_size_impl_t const _hb_NullPool[(HB_NULL_POOL_SIZE + sizeof (hb_vector_size_impl_t) - 1) / sizeof (hb_vector_size_impl_t)];
diff --git a/src/hb-open-type.hh b/src/hb-open-type.hh
index c5d1aa84..41169664 100644
--- a/src/hb-open-type.hh
+++ b/src/hb-open-type.hh
@@ -231,14 +231,9 @@ struct FixedVersion
  * Use: (base+offset)
  */
 
-template <typename Type, bool has_null_> struct assert_has_null_size { static_assert (Type::null_size > 0, ""); };
-template <typename Type> struct assert_has_null_size<Type, false> {};
-
 template <typename Type, typename OffsetType=HBUINT16, bool has_null=true>
 struct OffsetTo : Offset<OffsetType, has_null>
 {
-  static_assert (sizeof (assert_has_null_size<Type, has_null>) || true, "");
-
   inline const Type& operator () (const void *base) const
   {
     if (unlikely (this->is_null ())) return Null (Type);
diff --git a/src/hb-ot-glyf-table.hh b/src/hb-ot-glyf-table.hh
index 5d9e7a20..a3ef1ad0 100644
--- a/src/hb-ot-glyf-table.hh
+++ b/src/hb-ot-glyf-table.hh
@@ -56,7 +56,7 @@ struct loca
   protected:
   UnsizedArrayOf<HBUINT8>	dataZ;		/* Location data. */
   public:
-  DEFINE_SIZE_ARRAY (0, dataZ);
+  DEFINE_SIZE_UNBOUNDED (0);
 };
 
 
@@ -465,7 +465,7 @@ struct glyf
   protected:
   UnsizedArrayOf<HBUINT8>	dataZ;		/* Glyphs data. */
   public:
-  DEFINE_SIZE_ARRAY (0, dataZ);
+  DEFINE_SIZE_UNBOUNDED (0);
 };
 
 struct glyf_accelerator_t : glyf::accelerator_t {};


More information about the HarfBuzz mailing list