diff --git a/src/OT/Layout/GSUB/ReverseChainSingleSubstFormat1.hh b/src/OT/Layout/GSUB/ReverseChainSingleSubstFormat1.hh index dfc407f7f..1d27df95d 100644 --- a/src/OT/Layout/GSUB/ReverseChainSingleSubstFormat1.hh +++ b/src/OT/Layout/GSUB/ReverseChainSingleSubstFormat1.hh @@ -33,10 +33,10 @@ struct ReverseChainSingleSubstFormat1 TRACE_SANITIZE (this); if (!(coverage.sanitize (c, this) && backtrack.sanitize (c, this))) return_trace (false); - const Array16OfOffset16To &lookahead = StructAfter> (backtrack); + const auto &lookahead = StructAfter (backtrack); if (!lookahead.sanitize (c, this)) return_trace (false); - const Array16Of &substitute = StructAfter> (lookahead); + const auto &substitute = StructAfter (lookahead); return_trace (substitute.sanitize (c)); } @@ -45,7 +45,7 @@ struct ReverseChainSingleSubstFormat1 if (!(this+coverage).intersects (glyphs)) return false; - const Array16OfOffset16To &lookahead = StructAfter> (backtrack); + const auto &lookahead = StructAfter (backtrack); unsigned int count; @@ -69,8 +69,8 @@ struct ReverseChainSingleSubstFormat1 { if (!intersects (c->glyphs)) return; - const Array16OfOffset16To &lookahead = StructAfter> (backtrack); - const Array16Of &substitute = StructAfter> (lookahead); + const auto &lookahead = StructAfter (backtrack); + const auto &substitute = StructAfter (lookahead); + hb_zip (this+coverage, substitute) | hb_filter (c->parent_active_glyphs (), hb_first) @@ -91,12 +91,12 @@ struct ReverseChainSingleSubstFormat1 for (unsigned int i = 0; i < count; i++) if (unlikely (!(this+backtrack[i]).collect_coverage (c->before))) return; - const Array16OfOffset16To &lookahead = StructAfter> (backtrack); + const auto &lookahead = StructAfter (backtrack); count = lookahead.len; for (unsigned int i = 0; i < count; i++) if (unlikely (!(this+lookahead[i]).collect_coverage (c->after))) return; - const Array16Of &substitute = StructAfter> (lookahead); + const auto &substitute = StructAfter (lookahead); count = substitute.len; c->output->add_array (substitute.arrayZ, substitute.len); } @@ -115,8 +115,8 @@ struct ReverseChainSingleSubstFormat1 unsigned int index = (this+coverage).get_coverage (c->buffer->cur ().codepoint); if (likely (index == NOT_COVERED)) return_trace (false); - const Array16OfOffset16To &lookahead = StructAfter> (backtrack); - const Array16Of &substitute = StructAfter> (lookahead); + const auto &lookahead = StructAfter (backtrack); + const auto &substitute = StructAfter (lookahead); if (unlikely (index >= substitute.len)) return_trace (false); @@ -206,8 +206,8 @@ struct ReverseChainSingleSubstFormat1 const hb_set_t &glyphset = *c->plan->glyphset_gsub (); const hb_map_t &glyph_map = *c->plan->glyph_map; - const Array16OfOffset16To &lookahead = StructAfter> (backtrack); - const Array16Of &substitute = StructAfter> (lookahead); + const auto &lookahead = StructAfter (backtrack); + const auto &substitute = StructAfter (lookahead); auto it = + hb_zip (this+coverage, substitute) diff --git a/src/hb-ot-layout-gsubgpos.hh b/src/hb-ot-layout-gsubgpos.hh index e031ab2f2..e53a0206a 100644 --- a/src/hb-ot-layout-gsubgpos.hh +++ b/src/hb-ot-layout-gsubgpos.hh @@ -1749,8 +1749,8 @@ struct Rule { if (unlikely (c->lookup_limit_exceeded ())) return; - const UnsizedArrayOf &lookupRecord = StructAfter> - (inputZ.as_array ((inputCount ? inputCount - 1 : 0))); + const auto &lookupRecord = StructAfter> + (inputZ.as_array ((inputCount ? inputCount - 1 : 0))); context_closure_lookup (c, inputCount, inputZ.arrayZ, lookupCount, lookupRecord.arrayZ, @@ -1763,16 +1763,16 @@ struct Rule if (unlikely (c->lookup_limit_exceeded ())) return; if (!intersects (c->glyphs, lookup_context)) return; - const UnsizedArrayOf &lookupRecord = StructAfter> - (inputZ.as_array (inputCount ? inputCount - 1 : 0)); + const auto &lookupRecord = StructAfter> + (inputZ.as_array (inputCount ? inputCount - 1 : 0)); recurse_lookups (c, lookupCount, lookupRecord.arrayZ); } void collect_glyphs (hb_collect_glyphs_context_t *c, ContextCollectGlyphsLookupContext &lookup_context) const { - const UnsizedArrayOf &lookupRecord = StructAfter> - (inputZ.as_array (inputCount ? inputCount - 1 : 0)); + const auto &lookupRecord = StructAfter> + (inputZ.as_array (inputCount ? inputCount - 1 : 0)); context_collect_glyphs_lookup (c, inputCount, inputZ.arrayZ, lookupCount, lookupRecord.arrayZ, @@ -1782,8 +1782,8 @@ struct Rule bool would_apply (hb_would_apply_context_t *c, ContextApplyLookupContext &lookup_context) const { - const UnsizedArrayOf &lookupRecord = StructAfter> - (inputZ.as_array (inputCount ? inputCount - 1 : 0)); + const auto &lookupRecord = StructAfter> + (inputZ.as_array (inputCount ? inputCount - 1 : 0)); return context_would_apply_lookup (c, inputCount, inputZ.arrayZ, lookupCount, lookupRecord.arrayZ, @@ -1794,8 +1794,8 @@ struct Rule ContextApplyLookupContext &lookup_context) const { TRACE_APPLY (this); - const UnsizedArrayOf &lookupRecord = StructAfter> - (inputZ.as_array (inputCount ? inputCount - 1 : 0)); + const auto &lookupRecord = StructAfter> + (inputZ.as_array (inputCount ? inputCount - 1 : 0)); return_trace (context_apply_lookup (c, inputCount, inputZ.arrayZ, lookupCount, lookupRecord.arrayZ, lookup_context)); } @@ -1816,8 +1816,8 @@ struct Rule c->copy (d); } - const UnsizedArrayOf &lookupRecord = StructAfter> - (inputZ.as_array ((inputCount ? inputCount - 1 : 0))); + const auto &lookupRecord = StructAfter> + (inputZ.as_array ((inputCount ? inputCount - 1 : 0))); unsigned count = serialize_lookuprecord_array (c, lookupRecord.as_array (lookupCount), lookup_map); return_trace (c->check_assign (out->lookupCount, count, HB_SERIALIZE_ERROR_INT_OVERFLOW)); @@ -2491,7 +2491,7 @@ struct ContextFormat3 if (!o->serialize_subset (c, offset, this)) return_trace (false); } - const UnsizedArrayOf& lookupRecord = StructAfter> (coverageZ.as_array (glyphCount)); + const auto& lookupRecord = StructAfter> (coverageZ.as_array (glyphCount)); const hb_map_t *lookup_map = c->table_tag == HB_OT_TAG_GSUB ? c->plan->gsub_lookups : c->plan->gpos_lookups; @@ -2709,8 +2709,8 @@ struct ChainRule { bool intersects (const hb_set_t *glyphs, ChainContextClosureLookupContext &lookup_context) const { - const HeadlessArrayOf &input = StructAfter> (backtrack); - const Array16Of &lookahead = StructAfter> (input); + const auto &input = StructAfter> (backtrack); + const auto &lookahead = StructAfter> (input); return chain_context_intersects (glyphs, backtrack.len, backtrack.arrayZ, input.lenP1, input.arrayZ, @@ -2723,9 +2723,9 @@ struct ChainRule { if (unlikely (c->lookup_limit_exceeded ())) return; - const HeadlessArrayOf &input = StructAfter> (backtrack); - const Array16Of &lookahead = StructAfter> (input); - const Array16Of &lookup = StructAfter> (lookahead); + const auto &input = StructAfter> (backtrack); + const auto &lookahead = StructAfter> (input); + const auto &lookup = StructAfter> (lookahead); chain_context_closure_lookup (c, backtrack.len, backtrack.arrayZ, input.lenP1, input.arrayZ, @@ -2741,18 +2741,18 @@ struct ChainRule if (unlikely (c->lookup_limit_exceeded ())) return; if (!intersects (c->glyphs, lookup_context)) return; - const HeadlessArrayOf &input = StructAfter> (backtrack); - const Array16Of &lookahead = StructAfter> (input); - const Array16Of &lookup = StructAfter> (lookahead); + const auto &input = StructAfter> (backtrack); + const auto &lookahead = StructAfter> (input); + const auto &lookup = StructAfter> (lookahead); recurse_lookups (c, lookup.len, lookup.arrayZ); } void collect_glyphs (hb_collect_glyphs_context_t *c, ChainContextCollectGlyphsLookupContext &lookup_context) const { - const HeadlessArrayOf &input = StructAfter> (backtrack); - const Array16Of &lookahead = StructAfter> (input); - const Array16Of &lookup = StructAfter> (lookahead); + const auto &input = StructAfter> (backtrack); + const auto &lookahead = StructAfter> (input); + const auto &lookup = StructAfter> (lookahead); chain_context_collect_glyphs_lookup (c, backtrack.len, backtrack.arrayZ, input.lenP1, input.arrayZ, @@ -2764,9 +2764,9 @@ struct ChainRule bool would_apply (hb_would_apply_context_t *c, ChainContextApplyLookupContext &lookup_context) const { - const HeadlessArrayOf &input = StructAfter> (backtrack); - const Array16Of &lookahead = StructAfter> (input); - const Array16Of &lookup = StructAfter> (lookahead); + const auto &input = StructAfter> (backtrack); + const auto &lookahead = StructAfter> (input); + const auto &lookup = StructAfter> (lookahead); return chain_context_would_apply_lookup (c, backtrack.len, backtrack.arrayZ, input.lenP1, input.arrayZ, @@ -2777,9 +2777,9 @@ struct ChainRule bool apply (hb_ot_apply_context_t *c, ChainContextApplyLookupContext &lookup_context) const { TRACE_APPLY (this); - const HeadlessArrayOf &input = StructAfter> (backtrack); - const Array16Of &lookahead = StructAfter> (input); - const Array16Of &lookup = StructAfter> (lookahead); + const auto &input = StructAfter> (backtrack); + const auto &lookahead = StructAfter> (input); + const auto &lookup = StructAfter> (lookahead); return_trace (chain_context_apply_lookup (c, backtrack.len, backtrack.arrayZ, input.lenP1, input.arrayZ, @@ -2812,17 +2812,17 @@ struct ChainRule serialize_array (c, backtrack.len, + backtrack.iter () | hb_map (mapping)); - const HeadlessArrayOf &input = StructAfter> (backtrack); + const auto &input = StructAfter> (backtrack); if (input_map) mapping = input_map; serialize_array (c, input.lenP1, + input.iter () | hb_map (mapping)); - const Array16Of &lookahead = StructAfter> (input); + const auto &lookahead = StructAfter> (input); if (lookahead_map) mapping = lookahead_map; serialize_array (c, lookahead.len, + lookahead.iter () | hb_map (mapping)); - const Array16Of &lookupRecord = StructAfter> (lookahead); + const auto &lookupRecord = StructAfter> (lookahead); HBUINT16* lookupCount = c->embed (&(lookupRecord.len)); if (!lookupCount) return_trace (false); @@ -2839,8 +2839,8 @@ struct ChainRule { TRACE_SUBSET (this); - const HeadlessArrayOf &input = StructAfter> (backtrack); - const Array16Of &lookahead = StructAfter> (input); + const auto &input = StructAfter> (backtrack); + const auto &lookahead = StructAfter> (input); if (!backtrack_map) { @@ -2869,11 +2869,11 @@ struct ChainRule { TRACE_SANITIZE (this); if (!backtrack.sanitize (c)) return_trace (false); - const HeadlessArrayOf &input = StructAfter> (backtrack); + const auto &input = StructAfter> (backtrack); if (!input.sanitize (c)) return_trace (false); - const Array16Of &lookahead = StructAfter> (input); + const auto &lookahead = StructAfter> (input); if (!lookahead.sanitize (c)) return_trace (false); - const Array16Of &lookup = StructAfter> (lookahead); + const auto &lookup = StructAfter> (lookahead); return_trace (lookup.sanitize (c)); } @@ -3467,12 +3467,12 @@ struct ChainContextFormat3 { bool intersects (const hb_set_t *glyphs) const { - const Array16OfOffset16To &input = StructAfter> (backtrack); + const auto &input = StructAfter> (backtrack); if (!(this+input[0]).intersects (glyphs)) return false; - const Array16OfOffset16To &lookahead = StructAfter> (input); + const auto &lookahead = StructAfter> (input); struct ChainContextClosureLookupContext lookup_context = { {intersects_coverage, intersected_coverage_glyphs}, ContextFormat::CoverageBasedContext, @@ -3490,7 +3490,7 @@ struct ChainContextFormat3 void closure (hb_closure_context_t *c) const { - const Array16OfOffset16To &input = StructAfter> (backtrack); + const auto &input = StructAfter> (backtrack); if (!(this+input[0]).intersects (c->glyphs)) return; @@ -3500,8 +3500,8 @@ struct ChainContextFormat3 cur_active_glyphs); - const Array16OfOffset16To &lookahead = StructAfter> (input); - const Array16Of &lookup = StructAfter> (lookahead); + const auto &lookahead = StructAfter> (input); + const auto &lookup = StructAfter> (lookahead); struct ChainContextClosureLookupContext lookup_context = { {intersects_coverage, intersected_coverage_glyphs}, ContextFormat::CoverageBasedContext, @@ -3522,9 +3522,9 @@ struct ChainContextFormat3 if (!intersects (c->glyphs)) return; - const Array16OfOffset16To &input = StructAfter> (backtrack); - const Array16OfOffset16To &lookahead = StructAfter> (input); - const Array16Of &lookup = StructAfter> (lookahead); + const auto &input = StructAfter> (backtrack); + const auto &lookahead = StructAfter> (input); + const auto &lookup = StructAfter> (lookahead); recurse_lookups (c, lookup.len, lookup.arrayZ); } @@ -3532,12 +3532,12 @@ struct ChainContextFormat3 void collect_glyphs (hb_collect_glyphs_context_t *c) const { - const Array16OfOffset16To &input = StructAfter> (backtrack); + const auto &input = StructAfter> (backtrack); (this+input[0]).collect_coverage (c->input); - const Array16OfOffset16To &lookahead = StructAfter> (input); - const Array16Of &lookup = StructAfter> (lookahead); + const auto &lookahead = StructAfter> (input); + const auto &lookup = StructAfter> (lookahead); struct ChainContextCollectGlyphsLookupContext lookup_context = { {collect_coverage}, {this, this, this} @@ -3552,9 +3552,9 @@ struct ChainContextFormat3 bool would_apply (hb_would_apply_context_t *c) const { - const Array16OfOffset16To &input = StructAfter> (backtrack); - const Array16OfOffset16To &lookahead = StructAfter> (input); - const Array16Of &lookup = StructAfter> (lookahead); + const auto &input = StructAfter> (backtrack); + const auto &lookahead = StructAfter> (input); + const auto &lookup = StructAfter> (lookahead); struct ChainContextApplyLookupContext lookup_context = { {{match_coverage, match_coverage, match_coverage}}, {this, this, this} @@ -3568,20 +3568,20 @@ struct ChainContextFormat3 const Coverage &get_coverage () const { - const Array16OfOffset16To &input = StructAfter> (backtrack); + const auto &input = StructAfter> (backtrack); return this+input[0]; } bool apply (hb_ot_apply_context_t *c) const { TRACE_APPLY (this); - const Array16OfOffset16To &input = StructAfter> (backtrack); + const auto &input = StructAfter> (backtrack); unsigned int index = (this+input[0]).get_coverage (c->buffer->cur().codepoint); if (likely (index == NOT_COVERED)) return_trace (false); - const Array16OfOffset16To &lookahead = StructAfter> (input); - const Array16Of &lookup = StructAfter> (lookahead); + const auto &lookahead = StructAfter> (input); + const auto &lookup = StructAfter> (lookahead); struct ChainContextApplyLookupContext lookup_context = { {{match_coverage, match_coverage, match_coverage}}, {this, this, this} @@ -3623,15 +3623,15 @@ struct ChainContextFormat3 if (!serialize_coverage_offsets (c, backtrack.iter (), this)) return_trace (false); - const Array16OfOffset16To &input = StructAfter> (backtrack); + const auto &input = StructAfter> (backtrack); if (!serialize_coverage_offsets (c, input.iter (), this)) return_trace (false); - const Array16OfOffset16To &lookahead = StructAfter> (input); + const auto &lookahead = StructAfter> (input); if (!serialize_coverage_offsets (c, lookahead.iter (), this)) return_trace (false); - const Array16Of &lookupRecord = StructAfter> (lookahead); + const auto &lookupRecord = StructAfter> (lookahead); const hb_map_t *lookup_map = c->table_tag == HB_OT_TAG_GSUB ? c->plan->gsub_lookups : c->plan->gpos_lookups; HBUINT16 *lookupCount = c->serializer->copy (lookupRecord.len); @@ -3645,12 +3645,12 @@ struct ChainContextFormat3 { TRACE_SANITIZE (this); if (!backtrack.sanitize (c, this)) return_trace (false); - const Array16OfOffset16To &input = StructAfter> (backtrack); + const auto &input = StructAfter> (backtrack); if (!input.sanitize (c, this)) return_trace (false); if (!input.len) return_trace (false); /* To be consistent with Context. */ - const Array16OfOffset16To &lookahead = StructAfter> (input); + const auto &lookahead = StructAfter> (input); if (!lookahead.sanitize (c, this)) return_trace (false); - const Array16Of &lookup = StructAfter> (lookahead); + const auto &lookup = StructAfter> (lookahead); return_trace (lookup.sanitize (c)); }