Fix up recent change

Fixes https://github.com/harfbuzz/harfbuzz/issues/1300
This commit is contained in:
Behdad Esfahbod 2018-11-22 01:44:27 -05:00
parent fffea5aff7
commit 2737aa81e5
3 changed files with 11 additions and 10 deletions

View File

@ -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)];

View File

@ -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);

View File

@ -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 {};