From ed07422c33bbb52ff4d79e65986171e3f07697d8 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 10 May 2010 18:08:46 -0400 Subject: [PATCH] Further cleanup of sizeof --- src/hb-open-type-private.hh | 7 +++++-- src/hb-ot-layout-common-private.hh | 4 ++++ src/hb-ot-layout-gdef-private.hh | 4 ++++ src/hb-ot-layout-gpos-private.hh | 10 +++++++--- src/hb-ot-layout-gsub-private.hh | 4 +++- src/hb-ot-layout-gsubgpos-private.hh | 2 ++ 6 files changed, 25 insertions(+), 6 deletions(-) diff --git a/src/hb-open-type-private.hh b/src/hb-open-type-private.hh index 45ed801a..c6c9811a 100644 --- a/src/hb-open-type-private.hh +++ b/src/hb-open-type-private.hh @@ -120,7 +120,7 @@ static const void *_NullPool[32 / sizeof (void *)]; /* Generic template for nul-content sizeof-sized Null objects. */ template static inline const Type& Null () { - ASSERT_STATIC (sizeof (Type) <= sizeof (_NullPool)); + ASSERT_STATIC (Type::min_size <= sizeof (_NullPool)); return *CastP (_NullPool); } @@ -673,7 +673,10 @@ struct HeadlessArrayOf } USHORT len; -/*Type array[VAR];*/ + private: + Type arrayX[VAR]; + public: + DEFINE_SIZE_VAR (sizeof (USHORT), Type); }; diff --git a/src/hb-ot-layout-common-private.hh b/src/hb-ot-layout-common-private.hh index 094f3a8c..324b7bde 100644 --- a/src/hb-ot-layout-common-private.hh +++ b/src/hb-ot-layout-common-private.hh @@ -439,6 +439,8 @@ struct Coverage CoverageFormat1 format1[VAR]; CoverageFormat2 format2[VAR]; } u; + public: + DEFINE_SIZE_MIN (2); }; @@ -559,6 +561,8 @@ struct ClassDef ClassDefFormat1 format1[VAR]; ClassDefFormat2 format2[VAR]; } u; + public: + DEFINE_SIZE_MIN (2); }; diff --git a/src/hb-ot-layout-gdef-private.hh b/src/hb-ot-layout-gdef-private.hh index 20d6b922..456efcaf 100644 --- a/src/hb-ot-layout-gdef-private.hh +++ b/src/hb-ot-layout-gdef-private.hh @@ -195,6 +195,8 @@ struct CaretValue CaretValueFormat2 format2[VAR]; CaretValueFormat3 format3[VAR]; } u; + public: + DEFINE_SIZE_MIN (2); }; struct LigGlyph @@ -309,6 +311,8 @@ struct MarkGlyphSets USHORT format; /* Format identifier */ MarkGlyphSetsFormat1 format1[VAR]; } u; + public: + DEFINE_SIZE_MIN (2); }; diff --git a/src/hb-ot-layout-gpos-private.hh b/src/hb-ot-layout-gpos-private.hh index c8905856..a84210ad 100644 --- a/src/hb-ot-layout-gpos-private.hh +++ b/src/hb-ot-layout-gpos-private.hh @@ -335,6 +335,8 @@ struct Anchor AnchorFormat2 format2[VAR]; AnchorFormat3 format3[VAR]; } u; + public: + DEFINE_SIZE_MIN (2); }; @@ -460,7 +462,7 @@ struct SinglePosFormat1 * value(s)--applied to all glyphs in * the Coverage table */ public: - DEFINE_SIZE_VAR (6, ValueRecord); + DEFINE_SIZE_VAR (6, Value); }; struct SinglePosFormat2 @@ -504,7 +506,7 @@ struct SinglePosFormat2 ValueRecord values; /* Array of ValueRecords--positioning * values applied to glyphs */ public: - DEFINE_SIZE_VAR (8, ValueRecord); + DEFINE_SIZE_VAR (8, Value); }; struct SinglePos @@ -552,7 +554,7 @@ struct PairValueRecord ValueRecord values; /* Positioning data for the first glyph * followed by for second glyph */ public: - DEFINE_SIZE_VAR (2, ValueRecord); + DEFINE_SIZE_VAR (2, Value); }; struct PairSet @@ -1487,6 +1489,8 @@ struct PosLookupSubTable ChainContextPos chainContext[VAR]; ExtensionPos extension[VAR]; } u; + public: + DEFINE_SIZE_MIN (2); }; diff --git a/src/hb-ot-layout-gsub-private.hh b/src/hb-ot-layout-gsub-private.hh index da32cb1b..c562deac 100644 --- a/src/hb-ot-layout-gsub-private.hh +++ b/src/hb-ot-layout-gsub-private.hh @@ -443,7 +443,7 @@ struct Ligature * with the second component--ordered * in writing direction */ public: - DEFINE_SIZE_STATIC (4); + DEFINE_SIZE_VAR (4, GlyphID); }; struct LigatureSet @@ -758,6 +758,8 @@ struct SubstLookupSubTable ExtensionSubst extension[VAR]; ReverseChainSingleSubst reverseChainContextSingle[VAR]; } u; + public: + DEFINE_SIZE_MIN (2); }; diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh index cc04de0d..92521c54 100644 --- a/src/hb-ot-layout-gsubgpos-private.hh +++ b/src/hb-ot-layout-gsubgpos-private.hh @@ -330,6 +330,8 @@ struct RuleSet OffsetArrayOf rule; /* Array of Rule tables * ordered by preference */ + public: + DEFINE_SIZE_VAR (2, OffsetTo); }; -- GitLab