diff --git a/src/hb-open-file-private.hh b/src/hb-open-file-private.hh index d8d70e5e1..ffe8ba785 100644 --- a/src/hb-open-file-private.hh +++ b/src/hb-open-file-private.hh @@ -140,7 +140,7 @@ struct TTCHeaderVersion1 table; /* Array of offsets to the OffsetTable for each font * from the beginning of the file */ public: - DEFINE_SIZE_STATIC (12); + DEFINE_SIZE_VAR (12, LongOffset); }; struct TTCHeader diff --git a/src/hb-open-type-private.hh b/src/hb-open-type-private.hh index f45351e57..00ad434b5 100644 --- a/src/hb-open-type-private.hh +++ b/src/hb-open-type-private.hh @@ -105,8 +105,7 @@ inline Type& StructAfter(TObject &X) #define VAR 1 #define VAR0 (VAR+0) -#define DEFINE_SIZE_VAR0(size) \ - _DEFINE_SIZE_ASSERTION (size); \ +#define DEFINE_SIZE_MIN(size) \ static const unsigned int min_size = (size) #define DEFINE_SIZE_VAR(size, _var_type) \ @@ -140,7 +139,7 @@ template <> \ inline const Type& Null () { \ return *CastP (_Null##Type); \ } /* The following line really exists such that we end in a place needing semicolon */ \ -ASSERT_STATIC (sizeof (Type) + 1 <= sizeof (_Null##Type)) +ASSERT_STATIC (Type::min_size + 1 <= sizeof (_Null##Type)) /* Accessor macro. */ #define Null(Type) Null() @@ -590,9 +589,10 @@ struct GenericArrayOf public: LenType len; -/*Type array[VAR];*/ + private: + Type arrayX[VAR]; public: - DEFINE_SIZE_VAR0 (sizeof (LenType)); + DEFINE_SIZE_VAR (sizeof (LenType), Type); }; /* An array with a USHORT number of elements. */ diff --git a/src/hb-ot-layout-common-private.hh b/src/hb-ot-layout-common-private.hh index dc1229f27..8cfbdc474 100644 --- a/src/hb-ot-layout-common-private.hh +++ b/src/hb-ot-layout-common-private.hh @@ -177,7 +177,7 @@ struct LangSys * = 0xFFFF */ IndexArray featureIndex; /* Array of indices into the FeatureList */ public: - DEFINE_SIZE_STATIC (6); + DEFINE_SIZE_VAR (6, USHORT); }; DEFINE_NULL_DATA (LangSys, "\0\0\xFF\xFF"); @@ -217,7 +217,7 @@ struct Script langSys; /* Array of LangSysRecords--listed * alphabetically by LangSysTag */ public: - DEFINE_SIZE_STATIC (4); + DEFINE_SIZE_VAR (4, Record); }; typedef RecordListOf