Cleanup ASSERT_SIZE_VAR
This commit is contained in:
parent
99bf03459f
commit
569da92bc6
|
@ -45,6 +45,7 @@ struct OpenTypeFontFile;
|
|||
struct OffsetTable;
|
||||
struct TTCHeader;
|
||||
|
||||
|
||||
typedef struct TableDirectory
|
||||
{
|
||||
inline bool sanitize (hb_sanitize_context_t *context) {
|
||||
|
@ -52,13 +53,13 @@ typedef struct TableDirectory
|
|||
return context->check_struct (this);
|
||||
}
|
||||
|
||||
DEFINE_SIZE_STATIC (16);
|
||||
|
||||
Tag tag; /* 4-byte identifier. */
|
||||
CheckSum checkSum; /* CheckSum for this table. */
|
||||
ULONG offset; /* Offset from beginning of TrueType font
|
||||
* file. */
|
||||
ULONG length; /* Length of this table. */
|
||||
public:
|
||||
DEFINE_SIZE_STATIC (16);
|
||||
} OpenTypeTable;
|
||||
|
||||
typedef struct OffsetTable
|
||||
|
@ -110,8 +111,10 @@ typedef struct OffsetTable
|
|||
USHORT entrySelector; /* Log2(maximum power of 2 <= numTables). */
|
||||
USHORT rangeShift; /* NumTables x 16-searchRange. */
|
||||
TableDirectory tableDir[VAR]; /* TableDirectory entries. numTables items */
|
||||
public:
|
||||
DEFINE_SIZE_VAR (12, TableDirectory);
|
||||
} OpenTypeFontFace;
|
||||
ASSERT_SIZE_VAR (OffsetTable, 12, TableDirectory);
|
||||
|
||||
|
||||
/*
|
||||
* TrueType Collections
|
||||
|
|
|
@ -101,7 +101,7 @@ inline Type& StructAfter(TObject &X)
|
|||
{ ASSERT_STATIC (sizeof (*this) == (size) + VAR0 * sizeof (_var_type)); } \
|
||||
static const unsigned int min_size = (size)
|
||||
|
||||
#define DEFINE_SIZE_VAR2(_type, size, _var_type1, _var_type2) \
|
||||
#define DEFINE_SIZE_VAR2(size, _var_type1, _var_type2) \
|
||||
inline void _size_assertion (void) const \
|
||||
{ ASSERT_STATIC (sizeof (*this) == (size) + VAR0 * sizeof (_var_type1) + VAR0 * sizeof (_var_type2)); } \
|
||||
static const unsigned int min_size = (size)
|
||||
|
@ -379,8 +379,10 @@ struct IntType
|
|||
TRACE_SANITIZE ();
|
||||
return context->check_struct (this);
|
||||
}
|
||||
private:
|
||||
BEInt<Type, sizeof (Type)> v;
|
||||
public:
|
||||
DEFINE_SIZE_STATIC (sizeof (Type));
|
||||
private: BEInt<Type, sizeof (Type)> v;
|
||||
};
|
||||
|
||||
typedef IntType<uint16_t> USHORT; /* 16-bit unsigned integer. */
|
||||
|
|
|
@ -57,12 +57,12 @@ struct Record
|
|||
&& offset.sanitize (context, base);
|
||||
}
|
||||
|
||||
DEFINE_SIZE_STATIC (6);
|
||||
|
||||
Tag tag; /* 4-byte Tag identifier */
|
||||
OffsetTo<Type>
|
||||
offset; /* Offset from beginning of object holding
|
||||
* the Record */
|
||||
public:
|
||||
DEFINE_SIZE_STATIC (6);
|
||||
};
|
||||
|
||||
template <typename Type>
|
||||
|
@ -170,14 +170,14 @@ struct LangSys
|
|||
&& featureIndex.sanitize (context);
|
||||
}
|
||||
|
||||
DEFINE_SIZE_STATIC (6);
|
||||
|
||||
Offset lookupOrder; /* = Null (reserved for an offset to a
|
||||
* reordering table) */
|
||||
USHORT reqFeatureIndex;/* Index of a feature required for this
|
||||
* language system--if no required features
|
||||
* = 0xFFFF */
|
||||
IndexArray featureIndex; /* Array of indices into the FeatureList */
|
||||
public:
|
||||
DEFINE_SIZE_STATIC (6);
|
||||
};
|
||||
DEFINE_NULL_DATA (LangSys, "\0\0\xFF\xFF");
|
||||
|
||||
|
@ -305,8 +305,9 @@ struct Lookup
|
|||
USHORT markFilteringSetX[VAR]; /* Index (base 0) into GDEF mark glyph sets
|
||||
* structure. This field is only present if bit
|
||||
* UseMarkFilteringSet of lookup flags is set. */
|
||||
public:
|
||||
DEFINE_SIZE_VAR (6, USHORT);
|
||||
};
|
||||
ASSERT_SIZE_VAR (Lookup, 6, USHORT);
|
||||
|
||||
typedef OffsetListOf<Lookup> LookupList;
|
||||
ASSERT_SIZE (LookupList, 2);
|
||||
|
@ -365,13 +366,13 @@ struct CoverageRangeRecord
|
|||
return context->check_struct (this);
|
||||
}
|
||||
|
||||
DEFINE_SIZE_STATIC (6);
|
||||
|
||||
private:
|
||||
GlyphID start; /* First GlyphID in the range */
|
||||
GlyphID end; /* Last GlyphID in the range */
|
||||
USHORT startCoverageIndex; /* Coverage Index of first GlyphID in
|
||||
* range */
|
||||
public:
|
||||
DEFINE_SIZE_STATIC (6);
|
||||
};
|
||||
DEFINE_NULL_DATA (CoverageRangeRecord, "\000\001");
|
||||
|
||||
|
@ -486,12 +487,12 @@ struct ClassRangeRecord
|
|||
return context->check_struct (this);
|
||||
}
|
||||
|
||||
DEFINE_SIZE_STATIC (6);
|
||||
|
||||
private:
|
||||
GlyphID start; /* First GlyphID in the range */
|
||||
GlyphID end; /* Last GlyphID in the range */
|
||||
USHORT classValue; /* Applied to all glyphs in the range */
|
||||
public:
|
||||
DEFINE_SIZE_STATIC (6);
|
||||
};
|
||||
DEFINE_NULL_DATA (ClassRangeRecord, "\000\001");
|
||||
|
||||
|
@ -610,8 +611,9 @@ struct Device
|
|||
* 3 Signed 8-bit value, 2 values per uint16
|
||||
*/
|
||||
USHORT deltaValue[VAR]; /* Array of compressed data */
|
||||
public:
|
||||
DEFINE_SIZE_VAR (6, USHORT);
|
||||
};
|
||||
ASSERT_SIZE_VAR (Device, 6, USHORT);
|
||||
|
||||
|
||||
#endif /* HB_OT_LAYOUT_COMMON_PRIVATE_HH */
|
||||
|
|
|
@ -383,8 +383,9 @@ struct GDEF
|
|||
* definitions--from beginning of GDEF
|
||||
* header (may be NULL). Introduced
|
||||
* in version 00010002. */
|
||||
public:
|
||||
DEFINE_SIZE_VAR (12, OffsetTo<MarkGlyphSets>);
|
||||
};
|
||||
ASSERT_SIZE_VAR (GDEF, 12, OffsetTo<MarkGlyphSets>);
|
||||
|
||||
|
||||
#endif /* HB_OT_LAYOUT_GDEF_PRIVATE_HH */
|
||||
|
|
|
@ -41,7 +41,6 @@
|
|||
typedef USHORT Value;
|
||||
|
||||
typedef Value ValueRecord[VAR0];
|
||||
ASSERT_SIZE_VAR (ValueRecord, 0, Value);
|
||||
|
||||
struct ValueFormat : USHORT
|
||||
{
|
||||
|
@ -360,8 +359,9 @@ struct AnchorMatrix
|
|||
OffsetTo<Anchor>
|
||||
matrix[VAR]; /* Matrix of offsets to Anchor tables--
|
||||
* from beginning of AnchorMatrix table */
|
||||
public:
|
||||
DEFINE_SIZE_VAR (2, OffsetTo<Anchor>);
|
||||
};
|
||||
ASSERT_SIZE_VAR (AnchorMatrix, 2, OffsetTo<Anchor>);
|
||||
|
||||
|
||||
struct MarkRecord
|
||||
|
@ -374,13 +374,13 @@ struct MarkRecord
|
|||
&& markAnchor.sanitize (context, base);
|
||||
}
|
||||
|
||||
DEFINE_SIZE_STATIC (4);
|
||||
|
||||
private:
|
||||
USHORT klass; /* Class defined for this mark */
|
||||
OffsetTo<Anchor>
|
||||
markAnchor; /* Offset to Anchor table--from
|
||||
* beginning of MarkArray table */
|
||||
public:
|
||||
DEFINE_SIZE_STATIC (4);
|
||||
};
|
||||
|
||||
struct MarkArray
|
||||
|
@ -462,8 +462,9 @@ struct SinglePosFormat1
|
|||
ValueRecord values; /* Defines positioning
|
||||
* value(s)--applied to all glyphs in
|
||||
* the Coverage table */
|
||||
public:
|
||||
DEFINE_SIZE_VAR (6, ValueRecord);
|
||||
};
|
||||
ASSERT_SIZE_VAR (SinglePosFormat1, 6, ValueRecord);
|
||||
|
||||
struct SinglePosFormat2
|
||||
{
|
||||
|
@ -505,8 +506,9 @@ struct SinglePosFormat2
|
|||
USHORT valueCount; /* Number of ValueRecords */
|
||||
ValueRecord values; /* Array of ValueRecords--positioning
|
||||
* values applied to glyphs */
|
||||
public:
|
||||
DEFINE_SIZE_VAR (8, ValueRecord);
|
||||
};
|
||||
ASSERT_SIZE_VAR (SinglePosFormat2, 8, ValueRecord);
|
||||
|
||||
struct SinglePos
|
||||
{
|
||||
|
@ -552,8 +554,9 @@ struct PairValueRecord
|
|||
* Coverage table */
|
||||
ValueRecord values; /* Positioning data for the first glyph
|
||||
* followed by for second glyph */
|
||||
public:
|
||||
DEFINE_SIZE_VAR (2, ValueRecord);
|
||||
};
|
||||
ASSERT_SIZE_VAR (PairValueRecord, 2, ValueRecord);
|
||||
|
||||
struct PairSet
|
||||
{
|
||||
|
@ -572,8 +575,9 @@ struct PairSet
|
|||
PairValueRecord
|
||||
array[VAR]; /* Array of PairValueRecords--ordered
|
||||
* by GlyphID of the second glyph */
|
||||
public:
|
||||
DEFINE_SIZE_VAR (2, PairValueRecord);
|
||||
};
|
||||
ASSERT_SIZE_VAR (PairSet, 2, PairValueRecord);
|
||||
|
||||
struct PairPosFormat1
|
||||
{
|
||||
|
@ -755,8 +759,9 @@ struct PairPosFormat2
|
|||
ValueRecord values; /* Matrix of value pairs:
|
||||
* class1-major, class2-minor,
|
||||
* Each entry has value1 and value2 */
|
||||
public:
|
||||
DEFINE_SIZE_VAR (16, ValueRecord);
|
||||
};
|
||||
ASSERT_SIZE_VAR (PairPosFormat2, 16, ValueRecord);
|
||||
|
||||
struct PairPos
|
||||
{
|
||||
|
@ -794,14 +799,15 @@ struct PairPos
|
|||
|
||||
struct EntryExitRecord
|
||||
{
|
||||
friend struct CursivePosFormat1;
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *context, void *base) {
|
||||
TRACE_SANITIZE ();
|
||||
return entryAnchor.sanitize (context, base)
|
||||
&& exitAnchor.sanitize (context, base);
|
||||
}
|
||||
|
||||
DEFINE_SIZE_STATIC (4);
|
||||
|
||||
private:
|
||||
OffsetTo<Anchor>
|
||||
entryAnchor; /* Offset to EntryAnchor table--from
|
||||
* beginning of CursivePos
|
||||
|
@ -810,6 +816,8 @@ struct EntryExitRecord
|
|||
exitAnchor; /* Offset to ExitAnchor table--from
|
||||
* beginning of CursivePos
|
||||
* subtable--may be NULL */
|
||||
public:
|
||||
DEFINE_SIZE_STATIC (4);
|
||||
};
|
||||
|
||||
struct CursivePosFormat1
|
||||
|
|
|
@ -177,12 +177,12 @@ struct LookupRecord
|
|||
return context->check_struct (this);
|
||||
}
|
||||
|
||||
DEFINE_SIZE_STATIC (4);
|
||||
|
||||
USHORT sequenceIndex; /* Index into current glyph
|
||||
* sequence--first glyph = 0 */
|
||||
USHORT lookupListIndex; /* Lookup to apply to that
|
||||
* position--zero--based */
|
||||
public:
|
||||
DEFINE_SIZE_STATIC (4);
|
||||
};
|
||||
|
||||
static inline bool apply_lookup (hb_apply_context_t *context,
|
||||
|
@ -302,8 +302,9 @@ struct Rule
|
|||
* second glyph */
|
||||
LookupRecord lookupRecordX[VAR]; /* Array of LookupRecords--in
|
||||
* design order */
|
||||
public:
|
||||
DEFINE_SIZE_VAR2 (4, USHORT, LookupRecord);
|
||||
};
|
||||
ASSERT_SIZE_VAR2 (Rule, 4, USHORT, LookupRecord);
|
||||
|
||||
struct RuleSet
|
||||
{
|
||||
|
@ -461,8 +462,9 @@ struct ContextFormat3
|
|||
* table in glyph sequence order */
|
||||
LookupRecord lookupRecordX[VAR]; /* Array of LookupRecords--in
|
||||
* design order */
|
||||
public:
|
||||
DEFINE_SIZE_VAR2 (6, OffsetTo<Coverage>, LookupRecord);
|
||||
};
|
||||
ASSERT_SIZE_VAR2 (ContextFormat3, 6, OffsetTo<Coverage>, LookupRecord);
|
||||
|
||||
struct Context
|
||||
{
|
||||
|
|
|
@ -85,14 +85,6 @@
|
|||
|
||||
#define ASSERT_SIZE(_type, _size) ASSERT_STATIC (sizeof (_type) == (_size))
|
||||
|
||||
/* Size signifying variable-sized array */
|
||||
#define VAR 1
|
||||
|
||||
#define VAR0 (VAR+0)
|
||||
#define ASSERT_SIZE_VAR(_type, _size, _var_type) \
|
||||
ASSERT_STATIC (sizeof (_type) == (_size) + VAR0 * sizeof (_var_type))
|
||||
#define ASSERT_SIZE_VAR2(_type, _size, _var_type1, _var_type2) \
|
||||
ASSERT_STATIC (sizeof (_type) == (_size) + VAR0 * sizeof (_var_type1) + VAR0 * sizeof (_var_type2))
|
||||
|
||||
#if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__)
|
||||
#define _HB_BOOLEAN_EXPR(expr) \
|
||||
|
|
Loading…
Reference in New Issue