diff --git a/src/hb-aat-layout-trak-table.hh b/src/hb-aat-layout-trak-table.hh index de2071ad6..c579c1193 100644 --- a/src/hb-aat-layout-trak-table.hh +++ b/src/hb-aat-layout-trak-table.hh @@ -55,7 +55,7 @@ struct TrackTableEntry unsigned int index, unsigned int nSizes) const { - return hb_array (base+valuesZ, nSizes)[index]; + return (base+valuesZ).as_array (nSizes)[index]; } public: diff --git a/src/hb-dsalgs.hh b/src/hb-dsalgs.hh index 59df860df..0940dc53c 100644 --- a/src/hb-dsalgs.hh +++ b/src/hb-dsalgs.hh @@ -572,8 +572,6 @@ struct hb_array_t T *arrayZ; unsigned int len; }; -template static inline -hb_array_t hb_array (T *array, unsigned int len) { return hb_array_t (array, len); } struct HbOpOr diff --git a/src/hb-open-file.hh b/src/hb-open-file.hh index 80dc5e614..2ef6d775f 100644 --- a/src/hb-open-file.hh +++ b/src/hb-open-file.hh @@ -330,7 +330,7 @@ struct ResourceTypeRecord inline const ResourceRecord& get_resource_record (unsigned int i, const void *type_base) const { - return hb_array (type_base+resourcesZ, get_resource_count ())[i]; + return (type_base+resourcesZ).as_array (get_resource_count ())[i]; } inline bool sanitize (hb_sanitize_context_t *c, diff --git a/src/hb-open-type.hh b/src/hb-open-type.hh index 062576039..7bce7eade 100644 --- a/src/hb-open-type.hh +++ b/src/hb-open-type.hh @@ -346,6 +346,9 @@ struct UnsizedArrayOf inline unsigned int get_size (unsigned int len) const { return len * Type::static_size; } + inline hb_array_t as_array (unsigned int len) { return hb_array_t (arrayZ, len); } + inline hb_array_t as_array (unsigned int len) const { return hb_array_t (arrayZ, len); } + inline bool sanitize (hb_sanitize_context_t *c, unsigned int count) const { TRACE_SANITIZE (this); @@ -393,14 +396,6 @@ struct UnsizedArrayOf public: DEFINE_SIZE_ARRAY (0, arrayZ); }; -} /* namespace OT */ -template static inline -hb_array_t hb_array (OT::UnsizedArrayOf &array, unsigned int len) -{ return hb_array (array.arrayZ, len); } -template static inline -hb_array_t hb_array (const OT::UnsizedArrayOf &array, unsigned int len) -{ return hb_array (array.arrayZ, len); } -namespace OT { /* Unsized array of offset's */ template diff --git a/src/hb-ot-color-cpal-table.hh b/src/hb-ot-color-cpal-table.hh index df4d9b4e7..332f0dd74 100644 --- a/src/hb-ot-color-cpal-table.hh +++ b/src/hb-ot-color-cpal-table.hh @@ -55,7 +55,7 @@ struct CPALV1Tail { if (!paletteFlagsZ) return HB_OT_COLOR_PALETTE_FLAG_DEFAULT; return (hb_ot_color_palette_flags_t) (uint32_t) - hb_array (base+paletteFlagsZ, palette_count)[palette_index]; + (base+paletteFlagsZ).as_array (palette_count)[palette_index]; } inline hb_ot_name_id_t @@ -64,7 +64,7 @@ struct CPALV1Tail unsigned int palette_count) const { if (!paletteLabelsZ) return HB_OT_NAME_ID_INVALID; - return hb_array (base+paletteLabelsZ, palette_count)[palette_index]; + return (base+paletteLabelsZ).as_array (palette_count)[palette_index]; } inline hb_ot_name_id_t @@ -73,7 +73,7 @@ struct CPALV1Tail unsigned int color_count) const { if (!colorLabelsZ) return HB_OT_NAME_ID_INVALID; - return hb_array (base+colorLabelsZ, color_count)[color_index]; + return (base+colorLabelsZ).as_array (color_count)[color_index]; } public: