diff options
author | Behdad Esfahbod <behdad@behdad.org> | 2018-11-19 13:04:43 -0500 |
---|---|---|
committer | Behdad Esfahbod <behdad@behdad.org> | 2018-11-19 13:06:44 -0500 |
commit | 4a6a692e3ea4fab632a0162c6d513dc151054d8f (patch) | |
tree | f05ad940e39b0c76795df3cc22621355f844858b | |
parent | e0097396010c40cf62641cd12ceb12dd5d79c9c7 (diff) |
[fvar] Use hb_array_t for axes
-rw-r--r-- | src/hb-dsalgs.hh | 6 | ||||
-rw-r--r-- | src/hb-ot-var-fvar-table.hh | 14 |
2 files changed, 10 insertions, 10 deletions
diff --git a/src/hb-dsalgs.hh b/src/hb-dsalgs.hh index 7a207f5d..8e59fdee 100644 --- a/src/hb-dsalgs.hh +++ b/src/hb-dsalgs.hh @@ -573,6 +573,10 @@ struct hb_array_t inline unsigned int get_size (void) const { return len * sizeof (Type); } + template <typename hb_sanitize_context_t> + inline bool sanitize (hb_sanitize_context_t *c) const + { return c->check_array (arrayZ, len); } + template <typename T> inline operator T * (void) const { return arrayZ; } inline Type * operator & (void) const { return arrayZ; } @@ -598,6 +602,8 @@ struct hb_array_t Type *arrayZ; unsigned int len; }; +template <typename T> +hb_array_t<T> hb_array (T *array, unsigned int len) { return hb_array_t<T> (array, len); } struct HbOpOr diff --git a/src/hb-ot-var-fvar-table.hh b/src/hb-ot-var-fvar-table.hh index 66618a5a..b4fdd5fa 100644 --- a/src/hb-ot-var-fvar-table.hh +++ b/src/hb-ot-var-fvar-table.hh @@ -114,9 +114,6 @@ struct fvar inline bool get_axis (unsigned int index, hb_ot_var_axis_t *info) const { - if (unlikely (index >= axisCount)) - return false; - if (info) { const AxisRecord &axis = get_axes ()[index]; @@ -133,9 +130,6 @@ struct fvar inline hb_ot_var_axis_flags_t get_axis_flags (unsigned int index) const { - if (unlikely (index >= axisCount)) - return (hb_ot_var_axis_flags_t) 0; - const AxisRecord &axis = get_axes ()[index]; return (hb_ot_var_axis_flags_t) (unsigned int) axis.flags; } @@ -195,11 +189,11 @@ struct fvar } protected: - inline const AxisRecord * get_axes (void) const - { return &(this+firstAxis); } + inline hb_array_t<const AxisRecord> get_axes (void) const + { return hb_array (&(this+firstAxis), axisCount); } - inline const InstanceRecord * get_instances (void) const - { return &StructAtOffset<InstanceRecord> (get_axes () + axisCount, 0); } + inline const InstanceRecord * get_first_instance (void) const + { return &StructAfter<InstanceRecord> (get_axes ()); } protected: FixedVersion<>version; /* Version of the fvar table |