diff --git a/src/hb-open-type-private.hh b/src/hb-open-type-private.hh index caf685756558bced55427fde600f276ecfc63a36..bc3e90e2ed9971f46b881cc8d5fe128582141dad 100644 --- a/src/hb-open-type-private.hh +++ b/src/hb-open-type-private.hh @@ -578,6 +578,27 @@ struct LongOffsetArrayOf : ArrayOf > {}; template struct LongOffsetLongArrayOf : LongArrayOf > {}; +/* Array of offsets relative to the beginning of the array itself. */ +template +struct OffsetListOf : OffsetArrayOf +{ + inline const Type& operator [] (unsigned int i) const + { + if (HB_UNLIKELY (i >= this->len)) return Null(Type); + return this+this->array[i]; + } + + inline bool sanitize (SANITIZE_ARG_DEF) { + SANITIZE_DEBUG (); + return OffsetArrayOf::sanitize (SANITIZE_ARG, CONST_CHARP(this)); + } + inline bool sanitize (SANITIZE_ARG_DEF, unsigned int user_data) { + SANITIZE_DEBUG (); + return OffsetArrayOf::sanitize (SANITIZE_ARG, CONST_CHARP(this), user_data); + } +}; + + /* An array with a USHORT number of elements, * starting at second element. */ template diff --git a/src/hb-ot-layout-common-private.hh b/src/hb-ot-layout-common-private.hh index fabb3a2a09cbe935598a1a9792e94836d93b0405..40a435ebd77a40c5d5c73c9121e45773d5b43494 100644 --- a/src/hb-ot-layout-common-private.hh +++ b/src/hb-ot-layout-common-private.hh @@ -296,25 +296,6 @@ struct Lookup }; ASSERT_SIZE (Lookup, 6); -template -struct OffsetListOf : OffsetArrayOf -{ - inline const Type& operator [] (unsigned int i) const - { - if (HB_UNLIKELY (i >= this->len)) return Null(Type); - return this+this->array[i]; - } - - inline bool sanitize (SANITIZE_ARG_DEF) { - SANITIZE_DEBUG (); - return OffsetArrayOf::sanitize (SANITIZE_ARG, CONST_CHARP(this)); - } - inline bool sanitize (SANITIZE_ARG_DEF, unsigned int user_data) { - SANITIZE_DEBUG (); - return OffsetArrayOf::sanitize (SANITIZE_ARG, CONST_CHARP(this), user_data); - } -}; - typedef OffsetListOf LookupList; ASSERT_SIZE (LookupList, 2);