From 9da552dcc5b89b3bbbe5a55fb7c543222382e12a Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 27 Jun 2014 15:09:42 -0400 Subject: [PATCH] Minor: Remove some GenericXXX templates --- src/hb-open-type-private.hh | 32 ++++++++++-------------------- src/hb-ot-cmap-table.hh | 4 ++-- src/hb-ot-layout-common-private.hh | 2 +- 3 files changed, 14 insertions(+), 24 deletions(-) diff --git a/src/hb-open-type-private.hh b/src/hb-open-type-private.hh index f6081f07..0b17effa 100644 --- a/src/hb-open-type-private.hh +++ b/src/hb-open-type-private.hh @@ -692,8 +692,8 @@ struct FixedVersion * Use: (base+offset) */ -template -struct OffsetTo : OffsetType +template +struct OffsetTo : GenericOffset { inline const Type& operator () (const void *base) const { @@ -737,16 +737,14 @@ static inline const Type& operator + (const Base &base, const OffsetTo static inline Type& operator + (Base &base, OffsetTo &offset) { return offset (base); } -template -struct LongOffsetTo : OffsetTo {}; - /* * Array Types */ -template -struct GenericArrayOf +/* An array with a number of elements. */ +template +struct ArrayOf { const Type *sub_array (unsigned int start_offset, unsigned int *pcount /* IN/OUT */) const { @@ -852,13 +850,9 @@ struct GenericArrayOf DEFINE_SIZE_ARRAY (sizeof (LenType), array); }; -/* An array with a USHORT number of elements. */ -template -struct ArrayOf : GenericArrayOf {}; - /* An array with a ULONG number of elements. */ template -struct LongArrayOf : GenericArrayOf {}; +struct LongArrayOf : ArrayOf {}; /* Array of Offset's */ template @@ -866,11 +860,11 @@ struct OffsetArrayOf : ArrayOf > {}; /* Array of LongOffset's */ template -struct LongOffsetArrayOf : ArrayOf > {}; +struct LongOffsetArrayOf : ArrayOf > {}; /* LongArray of LongOffset's */ template -struct LongOffsetLongArrayOf : LongArrayOf > {}; +struct LongOffsetLongArrayOf : LongArrayOf > {}; /* Array of offsets relative to the beginning of the array itself. */ template @@ -951,8 +945,8 @@ struct HeadlessArrayOf /* An array with sorted elements. Supports binary searching. */ -template -struct GenericSortedArrayOf : GenericArrayOf +template +struct SortedArrayOf : ArrayOf { template inline int bsearch (const SearchType &x) const @@ -974,13 +968,9 @@ struct GenericSortedArrayOf : GenericArrayOf } }; -/* A sorted array with a USHORT number of elements. */ -template -struct SortedArrayOf : GenericSortedArrayOf {}; - /* A sorted array with a ULONG number of elements. */ template -struct LongSortedArrayOf : GenericSortedArrayOf {}; +struct LongSortedArrayOf : SortedArrayOf {}; } /* namespace OT */ diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh index a50dca68..abdd8db4 100644 --- a/src/hb-ot-cmap-table.hh +++ b/src/hb-ot-cmap-table.hh @@ -229,7 +229,7 @@ struct CmapSubtableTrimmed UINT length; /* Byte length of this subtable. */ UINT language; /* Ignore. */ UINT startCharCode; /* First character code covered. */ - GenericArrayOf + ArrayOf glyphIdArray; /* Array of glyph index values for character * codes in the range. */ public: @@ -350,7 +350,7 @@ struct EncodingRecord USHORT platformID; /* Platform ID. */ USHORT encodingID; /* Platform-specific encoding ID. */ - LongOffsetTo + OffsetTo subtable; /* Byte offset from beginning of table to the subtable for this encoding. */ public: DEFINE_SIZE_STATIC (8); diff --git a/src/hb-ot-layout-common-private.hh b/src/hb-ot-layout-common-private.hh index 3904c2dd..479fb265 100644 --- a/src/hb-ot-layout-common-private.hh +++ b/src/hb-ot-layout-common-private.hh @@ -506,7 +506,7 @@ struct Feature if (unlikely (!featureParams.sanitize (c, this, closure ? closure->tag : HB_TAG_NONE))) return TRACE_RETURN (false); - if (likely (!orig_offset)) + if (likely (orig_offset.is_null ())) return TRACE_RETURN (true); if (featureParams == 0 && closure && -- GitLab