Rename hb_array_t::in_range to hb_array_t::check_range
This commit is contained in:
parent
72d83a0280
commit
d67ba649a3
|
@ -199,7 +199,7 @@ struct hb_array_t : hb_iter_with_fallback_t<hb_array_t<Type>, Type&>
|
|||
template <typename T,
|
||||
unsigned P = sizeof (Type),
|
||||
hb_enable_if (P == 1)>
|
||||
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
|
||||
|
|
|
@ -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<CompositeGlyphChain,
|
||||
CompositeGlyphChain> (*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<HBUINT16> (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;
|
||||
|
|
|
@ -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++;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue