From: Behdad Esfahbod Date: Mon, 3 Sep 2018 23:41:28 +0000 (-0700) Subject: Templatize GSUBGPOS::sanitize() X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6d618522d63a94230ad708fc49c1c73927da0137;p=platform%2Fupstream%2FlibHarfBuzzSharp.git Templatize GSUBGPOS::sanitize() --- diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh index 641d16d..f088061 100644 --- a/src/hb-ot-layout-gpos-table.hh +++ b/src/hb-ot-layout-gpos-table.hh @@ -1548,8 +1548,6 @@ struct PosLookup : Lookup } }; -typedef OffsetListOf PosLookupList; - /* * GPOS -- Glyph Positioning * https://docs.microsoft.com/en-us/typography/opentype/spec/gpos @@ -1569,9 +1567,7 @@ struct GPOS : GSUBGPOS inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); - if (unlikely (!GSUBGPOS::sanitize (c))) return_trace (false); - const OffsetTo &list = CastR > (lookupList); - return_trace (list.sanitize (c, this)); + return_trace (GSUBGPOS::sanitize (c)); } typedef GSUBGPOS::accelerator_t accelerator_t; diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh index 5b913c7..31e3c2f 100644 --- a/src/hb-ot-layout-gsub-table.hh +++ b/src/hb-ot-layout-gsub-table.hh @@ -1385,8 +1385,6 @@ struct SubstLookup : Lookup } }; -typedef OffsetListOf SubstLookupList; - /* * GSUB -- Glyph Substitution * https://docs.microsoft.com/en-us/typography/opentype/spec/gsub @@ -1402,11 +1400,11 @@ struct GSUB : GSUBGPOS inline bool subset (hb_subset_context_t *c) const { TRACE_SUBSET (this); - struct GSUB *out = c->serializer->start_embed (); + //struct GSUB *out = c->serializer->start_embed (); if (unlikely (!GSUBGPOS::subset (c))) return_trace (false); - const OffsetTo &list = CastR > (lookupList); - OffsetTo &outList = CastR > (out->lookupList); - outList.set (0); + //const OffsetTo &list = CastR > (lookupList); + //OffsetTo &outList = CastR > (out->lookupList); + //outList.set (0); //outList.serialize_subset (c, this+list, out); /* TODO Use intersects() to count how many subtables survive? */ return_trace (true); @@ -1415,9 +1413,7 @@ struct GSUB : GSUBGPOS inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); - if (unlikely (!GSUBGPOS::sanitize (c))) return_trace (false); - const OffsetTo &list = CastR > (lookupList); - return_trace (list.sanitize (c, this)); + return_trace (GSUBGPOS::sanitize (c)); } typedef GSUBGPOS::accelerator_t accelerator_t; diff --git a/src/hb-ot-layout-gsubgpos.hh b/src/hb-ot-layout-gsubgpos.hh index 6b163dc..e32bbd5 100644 --- a/src/hb-ot-layout-gsubgpos.hh +++ b/src/hb-ot-layout-gsubgpos.hh @@ -2565,14 +2565,16 @@ struct GSUBGPOS (version.to_int () >= 0x00010001u ? featureVars.static_size : 0); } + template inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); + typedef OffsetListOf TLookupList; return_trace (version.sanitize (c) && likely (version.major == 1) && scriptList.sanitize (c, this) && featureList.sanitize (c, this) && - lookupList.sanitize (c, this) && + CastR > (lookupList).sanitize (c, this) && (version.to_int () < 0x00010001u || featureVars.sanitize (c, this))); }