From 2737aa81e5aee721e868bf0c72f19c0245c721fe Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 22 Nov 2018 01:44:27 -0500 Subject: [PATCH] Fix up recent change Fixes https://github.com/harfbuzz/harfbuzz/issues/1300 --- 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(-) 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 + +/* The hard way... + * https://stackoverflow.com/questions/7776448/sfinae-tried-with-bool-gives-compiler-error-template-argument-tvalue-invol + */ +template struct _hb_bool_type {}; + +template struct _hb_null_size { enum { value = sizeof (T) }; }; template -struct _hb_null_size +struct _hb_null_size > { enum { value = T::null_size }; }; template struct hb_null_size -{ enum { value = _hb_null_size::value }; }; +{ enum { value = _hb_null_size >::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 struct assert_has_null_size { static_assert (Type::null_size > 0, ""); }; -template struct assert_has_null_size {}; - template struct OffsetTo : Offset { - static_assert (sizeof (assert_has_null_size) || 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 dataZ; /* Location data. */ public: - DEFINE_SIZE_ARRAY (0, dataZ); + DEFINE_SIZE_UNBOUNDED (0); }; @@ -465,7 +465,7 @@ struct glyf protected: UnsizedArrayOf dataZ; /* Glyphs data. */ public: - DEFINE_SIZE_ARRAY (0, dataZ); + DEFINE_SIZE_UNBOUNDED (0); }; struct glyf_accelerator_t : glyf::accelerator_t {}; -- GitLab