From: Behdad Esfahbod Date: Wed, 9 Jan 2019 17:57:36 +0000 (-0800) Subject: Use hb_zip() some more X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=83ad0b6d0f3e7656f78611e89d7ebb939cd8e713;p=platform%2Fupstream%2FlibHarfBuzzSharp.git Use hb_zip() some more --- diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh index 58ec10f..3745a85 100644 --- a/src/hb-ot-layout-gsub-table.hh +++ b/src/hb-ot-layout-gsub-table.hh @@ -351,22 +351,16 @@ struct MultipleSubstFormat1 void closure (hb_closure_context_t *c) const { - unsigned int count = sequence.len; - for (/*TODO(C++11)auto*/Coverage::iter_t iter = (this+coverage).iter (); iter; iter++) - { - if (unlikely (iter.get_coverage () >= count)) - break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */ - if (c->glyphs->has (iter.get_glyph ())) - (this+sequence[iter.get_coverage ()]).closure (c); - } + for (auto it = hb_zip (this+coverage, sequence); it; ++it) + if (c->glyphs->has (it->first)) + (this+it->second).closure (c); } void collect_glyphs (hb_collect_glyphs_context_t *c) const { if (unlikely (!(this+coverage).add_coverage (c->input))) return; - unsigned int count = sequence.len; - for (unsigned int i = 0; i < count; i++) - (this+sequence[i]).collect_glyphs (c); + for (auto it = hb_zip (this+coverage, sequence); it; ++it) + (this+it->second).collect_glyphs (c); } const Coverage &get_coverage () const { return this+coverage; } @@ -531,26 +525,16 @@ struct AlternateSubstFormat1 void closure (hb_closure_context_t *c) const { - unsigned int count = alternateSet.len; - for (/*TODO(C++11)auto*/Coverage::iter_t iter = (this+coverage).iter (); iter; iter++) - { - if (unlikely (iter.get_coverage () >= count)) - break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */ - if (c->glyphs->has (iter.get_glyph ())) - (this+alternateSet[iter.get_coverage ()]).closure (c); - } + for (auto it = hb_zip (this+coverage, alternateSet); it; ++it) + if (c->glyphs->has (it->first)) + (this+it->second).closure (c); } void collect_glyphs (hb_collect_glyphs_context_t *c) const { if (unlikely (!(this+coverage).add_coverage (c->input))) return; - unsigned int count = alternateSet.len; - for (/*TODO(C++11)auto*/Coverage::iter_t iter = (this+coverage).iter (); iter; iter++) - { - if (unlikely (iter.get_coverage () >= count)) - break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */ - (this+alternateSet[iter.get_coverage ()]).collect_glyphs (c); - } + for (auto it = hb_zip (this+coverage, alternateSet); it; ++it) + (this+it->second).collect_glyphs (c); } const Coverage &get_coverage () const { return this+coverage; }