From d67ba649a38aec1646525a30f992d5f50c4cf06d Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Thu, 5 Dec 2019 13:15:21 +0330 Subject: [PATCH] Rename hb_array_t::in_range to hb_array_t::check_range --- src/hb-array.hh | 2 +- src/hb-ot-glyf-table.hh | 20 ++++++++++---------- src/hb-ot-var-gvar-table.hh | 16 ++++++++-------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/hb-array.hh b/src/hb-array.hh index 7d3629df2..0bce8d436 100644 --- a/src/hb-array.hh +++ b/src/hb-array.hh @@ -199,7 +199,7 @@ struct hb_array_t : hb_iter_with_fallback_t, Type&> template - bool in_range (const T *p, unsigned int size = T::static_size) const + bool check_range (const T *p, unsigned int size = T::static_size) const { return arrayZ <= ((const char *) p) && ((const char *) p) <= arrayZ + length diff --git a/src/hb-ot-glyf-table.hh b/src/hb-ot-glyf-table.hh index 571e50ea0..a0f556ea0 100644 --- a/src/hb-ot-glyf-table.hh +++ b/src/hb-ot-glyf-table.hh @@ -361,7 +361,7 @@ struct glyf typedef const CompositeGlyphChain *__item_t__; composite_iter_t (hb_bytes_t glyph_, __item_t__ current_) : glyph (glyph_), current (current_) - { if (!in_range (current)) current = nullptr; } + { if (!check_range (current)) current = nullptr; } composite_iter_t () : glyph (hb_bytes_t ()), current (nullptr) {} const CompositeGlyphChain &__item__ () const { return *current; } @@ -372,16 +372,16 @@ struct glyf const CompositeGlyphChain *possible = &StructAfter (*current); - if (!in_range (possible)) { current = nullptr; return; } + if (!check_range (possible)) { current = nullptr; return; } current = possible; } bool operator != (const composite_iter_t& o) const { return glyph != o.glyph || current != o.current; } - bool in_range (const CompositeGlyphChain *composite) const + bool check_range (const CompositeGlyphChain *composite) const { - return glyph.in_range (composite, CompositeGlyphChain::min_size) - && glyph.in_range (composite, composite->get_size ()); + return glyph.check_range (composite, CompositeGlyphChain::min_size) + && glyph.check_range (composite, composite->get_size ()); } private: @@ -545,7 +545,7 @@ struct glyf uint8_t flag = points_[i].flag; if (coord_setter.is_short (flag)) { - if (unlikely (!bytes.in_range (p))) return false; + if (unlikely (!bytes.check_range (p))) return false; if (coord_setter.is_same (flag)) v += *p++; else @@ -555,7 +555,7 @@ struct glyf { if (!coord_setter.is_same (flag)) { - if (unlikely (!bytes.in_range ((const HBUINT16 *) p))) return false; + if (unlikely (!bytes.check_range ((const HBUINT16 *) p))) return false; v += *(const HBINT16 *) p; p += HBINT16::static_size; } @@ -571,7 +571,7 @@ struct glyf { const HBUINT16 *endPtsOfContours = &StructAfter (header); int num_contours = header.numberOfContours; - if (unlikely (!bytes.in_range (&endPtsOfContours[num_contours + 1]))) return false; + if (unlikely (!bytes.check_range (&endPtsOfContours[num_contours + 1]))) return false; unsigned int num_points = endPtsOfContours[num_contours - 1] + 1; points_.resize (num_points + PHANTOM_COUNT); @@ -591,12 +591,12 @@ struct glyf /* Read flags */ for (unsigned int i = 0; i < num_points; i++) { - if (unlikely (!bytes.in_range (p))) return false; + if (unlikely (!bytes.check_range (p))) return false; uint8_t flag = *p++; points_[i].flag = flag; if (flag & FLAG_REPEAT) { - if (unlikely (!bytes.in_range (p))) return false; + if (unlikely (!bytes.check_range (p))) return false; unsigned int repeat_count = *p++; while ((repeat_count-- > 0) && (++i < num_points)) points_[i].flag = flag; diff --git a/src/hb-ot-var-gvar-table.hh b/src/hb-ot-var-gvar-table.hh index a76121d86..96afc1db3 100644 --- a/src/hb-ot-var-gvar-table.hh +++ b/src/hb-ot-var-gvar-table.hh @@ -283,12 +283,12 @@ struct GlyphVarData POINT_RUN_COUNT_MASK = 0x7F }; - if (unlikely (!bytes.in_range (p))) return false; + if (unlikely (!bytes.check_range (p))) return false; uint16_t count = *p++; if (count & POINTS_ARE_WORDS) { - if (unlikely (!bytes.in_range (p))) return false; + if (unlikely (!bytes.check_range (p))) return false; count = ((count & POINT_RUN_COUNT_MASK) << 8) | *p++; } points.resize (count); @@ -297,7 +297,7 @@ struct GlyphVarData uint16_t i = 0; while (i < count) { - if (unlikely (!bytes.in_range (p))) return false; + if (unlikely (!bytes.check_range (p))) return false; uint16_t j; uint8_t control = *p++; uint16_t run_count = (control & POINT_RUN_COUNT_MASK) + 1; @@ -305,7 +305,7 @@ struct GlyphVarData { for (j = 0; j < run_count && i < count; j++, i++) { - if (unlikely (!bytes.in_range ((const HBUINT16 *) p))) + if (unlikely (!bytes.check_range ((const HBUINT16 *) p))) return false; n += *(const HBUINT16 *)p; points[i] = n; @@ -316,7 +316,7 @@ struct GlyphVarData { for (j = 0; j < run_count && i < count; j++, i++) { - if (unlikely (!bytes.in_range (p))) return false; + if (unlikely (!bytes.check_range (p))) return false; n += *p++; points[i] = n; } @@ -341,7 +341,7 @@ struct GlyphVarData unsigned int count = deltas.length; while (i < count) { - if (unlikely (!bytes.in_range (p))) return false; + if (unlikely (!bytes.check_range (p))) return false; uint8_t control = *p++; unsigned int run_count = (control & DELTA_RUN_COUNT_MASK) + 1; unsigned int j; @@ -351,7 +351,7 @@ struct GlyphVarData else if (control & DELTAS_ARE_WORDS) for (j = 0; j < run_count && i < count; j++, i++) { - if (unlikely (!bytes.in_range ((const HBUINT16 *) p))) + if (unlikely (!bytes.check_range ((const HBUINT16 *) p))) return false; deltas[i] = *(const HBINT16 *) p; p += HBUINT16::static_size; @@ -359,7 +359,7 @@ struct GlyphVarData else for (j = 0; j < run_count && i < count; j++, i++) { - if (unlikely (!bytes.in_range (p))) + if (unlikely (!bytes.check_range (p))) return false; deltas[i] = *(const HBINT8 *) p++; }