From c5a6b355e165e90d8d90454ceeca7b100282945f Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 24 Nov 2018 23:49:23 -0500 Subject: [PATCH] [kerx] Port to hb_sanitize_with_object_t --- src/hb-aat-layout-kerx-table.hh | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/hb-aat-layout-kerx-table.hh b/src/hb-aat-layout-kerx-table.hh index 33f626c6..8dc74991 100644 --- a/src/hb-aat-layout-kerx-table.hh +++ b/src/hb-aat-layout-kerx-table.hh @@ -926,13 +926,11 @@ struct KerxTable if (reverse) c->buffer->reverse (); - /* See comment in sanitize() for conditional here. */ - if (i < count - 1) - c->sanitizer.set_object (st); - else - c->sanitizer.set_object (); - - ret |= st->dispatch (c); + { + /* See comment in sanitize() for conditional here. */ + hb_sanitize_with_object_t with (&c->sanitizer, i < count - 1 ? st : (const SubTable *) nullptr); + ret |= st->dispatch (c); + } if (reverse) c->buffer->reverse (); @@ -943,7 +941,6 @@ struct KerxTable st = &StructAfter (*st); c->set_lookup_index (c->lookup_index + 1); } - c->sanitizer.set_object (); return ret; } @@ -962,7 +959,6 @@ struct KerxTable unsigned int count = thiz()->tableCount; for (unsigned int i = 0; i < count; i++) { - c->set_object (); if (unlikely (!st->u.header.sanitize (c))) return_trace (false); /* 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 * have multiple subtables. To handle such fonts, we just ignore * the length for the last subtable. */ - if (i < count - 1) - c->set_object (st); + hb_sanitize_with_object_t with (c, i < count - 1 ? st : (const SubTable *) nullptr); if (unlikely (!st->sanitize (c))) return_trace (false); + st = &StructAfter (*st); } - c->set_object (); return_trace (true); } -- GitLab