提交 ed07422c 编写于 作者: B Behdad Esfahbod

Further cleanup of sizeof

上级 a82ef7a8
...@@ -120,7 +120,7 @@ static const void *_NullPool[32 / sizeof (void *)]; ...@@ -120,7 +120,7 @@ static const void *_NullPool[32 / sizeof (void *)];
/* Generic template for nul-content sizeof-sized Null objects. */ /* Generic template for nul-content sizeof-sized Null objects. */
template <typename Type> template <typename Type>
static inline const Type& Null () { static inline const Type& Null () {
ASSERT_STATIC (sizeof (Type) <= sizeof (_NullPool)); ASSERT_STATIC (Type::min_size <= sizeof (_NullPool));
return *CastP<Type> (_NullPool); return *CastP<Type> (_NullPool);
} }
...@@ -673,7 +673,10 @@ struct HeadlessArrayOf ...@@ -673,7 +673,10 @@ struct HeadlessArrayOf
} }
USHORT len; USHORT len;
/*Type array[VAR];*/ private:
Type arrayX[VAR];
public:
DEFINE_SIZE_VAR (sizeof (USHORT), Type);
}; };
......
...@@ -439,6 +439,8 @@ struct Coverage ...@@ -439,6 +439,8 @@ struct Coverage
CoverageFormat1 format1[VAR]; CoverageFormat1 format1[VAR];
CoverageFormat2 format2[VAR]; CoverageFormat2 format2[VAR];
} u; } u;
public:
DEFINE_SIZE_MIN (2);
}; };
...@@ -559,6 +561,8 @@ struct ClassDef ...@@ -559,6 +561,8 @@ struct ClassDef
ClassDefFormat1 format1[VAR]; ClassDefFormat1 format1[VAR];
ClassDefFormat2 format2[VAR]; ClassDefFormat2 format2[VAR];
} u; } u;
public:
DEFINE_SIZE_MIN (2);
}; };
......
...@@ -195,6 +195,8 @@ struct CaretValue ...@@ -195,6 +195,8 @@ struct CaretValue
CaretValueFormat2 format2[VAR]; CaretValueFormat2 format2[VAR];
CaretValueFormat3 format3[VAR]; CaretValueFormat3 format3[VAR];
} u; } u;
public:
DEFINE_SIZE_MIN (2);
}; };
struct LigGlyph struct LigGlyph
...@@ -309,6 +311,8 @@ struct MarkGlyphSets ...@@ -309,6 +311,8 @@ struct MarkGlyphSets
USHORT format; /* Format identifier */ USHORT format; /* Format identifier */
MarkGlyphSetsFormat1 format1[VAR]; MarkGlyphSetsFormat1 format1[VAR];
} u; } u;
public:
DEFINE_SIZE_MIN (2);
}; };
......
...@@ -335,6 +335,8 @@ struct Anchor ...@@ -335,6 +335,8 @@ struct Anchor
AnchorFormat2 format2[VAR]; AnchorFormat2 format2[VAR];
AnchorFormat3 format3[VAR]; AnchorFormat3 format3[VAR];
} u; } u;
public:
DEFINE_SIZE_MIN (2);
}; };
...@@ -460,7 +462,7 @@ struct SinglePosFormat1 ...@@ -460,7 +462,7 @@ struct SinglePosFormat1
* value(s)--applied to all glyphs in * value(s)--applied to all glyphs in
* the Coverage table */ * the Coverage table */
public: public:
DEFINE_SIZE_VAR (6, ValueRecord); DEFINE_SIZE_VAR (6, Value);
}; };
struct SinglePosFormat2 struct SinglePosFormat2
...@@ -504,7 +506,7 @@ struct SinglePosFormat2 ...@@ -504,7 +506,7 @@ struct SinglePosFormat2
ValueRecord values; /* Array of ValueRecords--positioning ValueRecord values; /* Array of ValueRecords--positioning
* values applied to glyphs */ * values applied to glyphs */
public: public:
DEFINE_SIZE_VAR (8, ValueRecord); DEFINE_SIZE_VAR (8, Value);
}; };
struct SinglePos struct SinglePos
...@@ -552,7 +554,7 @@ struct PairValueRecord ...@@ -552,7 +554,7 @@ struct PairValueRecord
ValueRecord values; /* Positioning data for the first glyph ValueRecord values; /* Positioning data for the first glyph
* followed by for second glyph */ * followed by for second glyph */
public: public:
DEFINE_SIZE_VAR (2, ValueRecord); DEFINE_SIZE_VAR (2, Value);
}; };
struct PairSet struct PairSet
...@@ -1487,6 +1489,8 @@ struct PosLookupSubTable ...@@ -1487,6 +1489,8 @@ struct PosLookupSubTable
ChainContextPos chainContext[VAR]; ChainContextPos chainContext[VAR];
ExtensionPos extension[VAR]; ExtensionPos extension[VAR];
} u; } u;
public:
DEFINE_SIZE_MIN (2);
}; };
......
...@@ -443,7 +443,7 @@ struct Ligature ...@@ -443,7 +443,7 @@ struct Ligature
* with the second component--ordered * with the second component--ordered
* in writing direction */ * in writing direction */
public: public:
DEFINE_SIZE_STATIC (4); DEFINE_SIZE_VAR (4, GlyphID);
}; };
struct LigatureSet struct LigatureSet
...@@ -758,6 +758,8 @@ struct SubstLookupSubTable ...@@ -758,6 +758,8 @@ struct SubstLookupSubTable
ExtensionSubst extension[VAR]; ExtensionSubst extension[VAR];
ReverseChainSingleSubst reverseChainContextSingle[VAR]; ReverseChainSingleSubst reverseChainContextSingle[VAR];
} u; } u;
public:
DEFINE_SIZE_MIN (2);
}; };
......
...@@ -330,6 +330,8 @@ struct RuleSet ...@@ -330,6 +330,8 @@ struct RuleSet
OffsetArrayOf<Rule> OffsetArrayOf<Rule>
rule; /* Array of Rule tables rule; /* Array of Rule tables
* ordered by preference */ * ordered by preference */
public:
DEFINE_SIZE_VAR (2, OffsetTo<Rule>);
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册