Minor: Remove GenericOffset

This commit is contained in:
Behdad Esfahbod 2014-06-27 15:12:52 -04:00
parent 9da552dcc5
commit 99d2817123
2 changed files with 9 additions and 12 deletions

View File

@ -630,18 +630,15 @@ struct Index : USHORT {
}; };
DEFINE_NULL_DATA (Index, "\xff\xff"); DEFINE_NULL_DATA (Index, "\xff\xff");
/* GenericOffset, Null offset = 0 */ /* Offset, Null offset = 0 */
template <typename Type> template <typename Type=USHORT>
struct GenericOffset : Type struct Offset : Type
{ {
inline bool is_null (void) const { return 0 == *this; } inline bool is_null (void) const { return 0 == *this; }
public: public:
DEFINE_SIZE_STATIC (sizeof(Type)); DEFINE_SIZE_STATIC (sizeof(Type));
}; };
typedef GenericOffset<USHORT> Offset;
typedef GenericOffset<ULONG> LongOffset;
/* CheckSum */ /* CheckSum */
struct CheckSum : ULONG struct CheckSum : ULONG
@ -688,12 +685,12 @@ struct FixedVersion
/* /*
* Template subclasses of Offset and LongOffset that do the dereferencing. * Template subclasses of Offset that do the dereferencing.
* Use: (base+offset) * Use: (base+offset)
*/ */
template <typename Type, typename OffsetType=USHORT> template <typename Type, typename OffsetType=USHORT>
struct OffsetTo : GenericOffset<OffsetType> struct OffsetTo : Offset<OffsetType>
{ {
inline const Type& operator () (const void *base) const inline const Type& operator () (const void *base) const
{ {

View File

@ -204,7 +204,7 @@ struct LangSys
return TRACE_RETURN (c->check_struct (this) && featureIndex.sanitize (c)); return TRACE_RETURN (c->check_struct (this) && featureIndex.sanitize (c));
} }
Offset lookupOrder; /* = Null (reserved for an offset to a Offset<> lookupOrder; /* = Null (reserved for an offset to a
* reordering table) */ * reordering table) */
USHORT reqFeatureIndex;/* Index of a feature required for this USHORT reqFeatureIndex;/* Index of a feature required for this
* language system--if no required features * language system--if no required features
@ -502,7 +502,7 @@ struct Feature
* Adobe tools, only the 'size' feature had FeatureParams defined. * Adobe tools, only the 'size' feature had FeatureParams defined.
*/ */
Offset orig_offset = featureParams; Offset<> orig_offset = featureParams;
if (unlikely (!featureParams.sanitize (c, this, closure ? closure->tag : HB_TAG_NONE))) if (unlikely (!featureParams.sanitize (c, this, closure ? closure->tag : HB_TAG_NONE)))
return TRACE_RETURN (false); return TRACE_RETURN (false);
@ -516,7 +516,7 @@ struct Feature
unsigned int new_offset_int = (unsigned int) orig_offset - unsigned int new_offset_int = (unsigned int) orig_offset -
(((char *) this) - ((char *) closure->list_base)); (((char *) this) - ((char *) closure->list_base));
Offset new_offset; Offset<> new_offset;
/* Check that it did not overflow. */ /* Check that it did not overflow. */
new_offset.set (new_offset_int); new_offset.set (new_offset_int);
if (new_offset == new_offset_int && if (new_offset == new_offset_int &&
@ -609,7 +609,7 @@ struct Lookup
USHORT lookupType; /* Different enumerations for GSUB and GPOS */ USHORT lookupType; /* Different enumerations for GSUB and GPOS */
USHORT lookupFlag; /* Lookup qualifiers */ USHORT lookupFlag; /* Lookup qualifiers */
ArrayOf<Offset> ArrayOf<Offset<> >
subTable; /* Array of SubTables */ subTable; /* Array of SubTables */
USHORT markFilteringSetX[VAR]; /* Index (base 0) into GDEF mark glyph sets USHORT markFilteringSetX[VAR]; /* Index (base 0) into GDEF mark glyph sets
* structure. This field is only present if bit * structure. This field is only present if bit