Further cleanup of sizeof

This commit is contained in:
Behdad Esfahbod 2010-05-10 18:08:46 -04:00
parent a82ef7a893
commit ed07422c33
6 changed files with 25 additions and 6 deletions

View File

@ -120,7 +120,7 @@ static const void *_NullPool[32 / sizeof (void *)];
/* Generic template for nul-content sizeof-sized Null objects. */
template <typename Type>
static inline const Type& Null () {
ASSERT_STATIC (sizeof (Type) <= sizeof (_NullPool));
ASSERT_STATIC (Type::min_size <= sizeof (_NullPool));
return *CastP<Type> (_NullPool);
}
@ -673,7 +673,10 @@ struct HeadlessArrayOf
}
USHORT len;
/*Type array[VAR];*/
private:
Type arrayX[VAR];
public:
DEFINE_SIZE_VAR (sizeof (USHORT), Type);
};

View File

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

View File

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

View File

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

View File

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

View File

@ -330,6 +330,8 @@ struct RuleSet
OffsetArrayOf<Rule>
rule; /* Array of Rule tables
* ordered by preference */
public:
DEFINE_SIZE_VAR (2, OffsetTo<Rule>);
};