[kerx] Port to hb_sanitize_with_object_t

This commit is contained in:
Behdad Esfahbod 2018-11-24 23:49:23 -05:00
parent c405ed0509
commit c5a6b355e1
1 changed files with 7 additions and 12 deletions

View File

@ -926,13 +926,11 @@ struct KerxTable
if (reverse) if (reverse)
c->buffer->reverse (); c->buffer->reverse ();
{
/* See comment in sanitize() for conditional here. */ /* See comment in sanitize() for conditional here. */
if (i < count - 1) hb_sanitize_with_object_t with (&c->sanitizer, i < count - 1 ? st : (const SubTable *) nullptr);
c->sanitizer.set_object (st);
else
c->sanitizer.set_object ();
ret |= st->dispatch (c); ret |= st->dispatch (c);
}
if (reverse) if (reverse)
c->buffer->reverse (); c->buffer->reverse ();
@ -943,7 +941,6 @@ struct KerxTable
st = &StructAfter<SubTable> (*st); st = &StructAfter<SubTable> (*st);
c->set_lookup_index (c->lookup_index + 1); c->set_lookup_index (c->lookup_index + 1);
} }
c->sanitizer.set_object ();
return ret; return ret;
} }
@ -962,7 +959,6 @@ struct KerxTable
unsigned int count = thiz()->tableCount; unsigned int count = thiz()->tableCount;
for (unsigned int i = 0; i < count; i++) for (unsigned int i = 0; i < count; i++)
{ {
c->set_object ();
if (unlikely (!st->u.header.sanitize (c))) if (unlikely (!st->u.header.sanitize (c)))
return_trace (false); return_trace (false);
/* OpenType kern table has 2-byte subtable lengths. That's limiting. /* OpenType kern table has 2-byte subtable lengths. That's limiting.
@ -972,14 +968,13 @@ struct KerxTable
* is simply ignored. Which makes sense. It's only needed if you * is simply ignored. Which makes sense. It's only needed if you
* have multiple subtables. To handle such fonts, we just ignore * have multiple subtables. To handle such fonts, we just ignore
* the length for the last subtable. */ * the length for the last subtable. */
if (i < count - 1) hb_sanitize_with_object_t with (c, i < count - 1 ? st : (const SubTable *) nullptr);
c->set_object (st);
if (unlikely (!st->sanitize (c))) if (unlikely (!st->sanitize (c)))
return_trace (false); return_trace (false);
st = &StructAfter<SubTable> (*st); st = &StructAfter<SubTable> (*st);
} }
c->set_object ();
return_trace (true); return_trace (true);
} }