diff --git a/src/OT/Layout/GPOS/PairPosFormat1.hh b/src/OT/Layout/GPOS/PairPosFormat1.hh index a8ded1e75..24eb4971d 100644 --- a/src/OT/Layout/GPOS/PairPosFormat1.hh +++ b/src/OT/Layout/GPOS/PairPosFormat1.hh @@ -25,9 +25,9 @@ struct PairPosFormat1_3 /* [1] Defines the types of data in * ValueRecord2--for the second glyph * in the pair--may be zero (0) */ - Array16Of> - pairSet; /* Array of PairSet tables - * ordered by Coverage Index */ + typename Types::template ArrayOf> + pairSet; /* Array of PairSet tables ordered by + * Coverage Index */ public: DEFINE_SIZE_ARRAY (8 + Types::size, pairSet); @@ -54,9 +54,10 @@ struct PairPosFormat1_3 { auto &cov = this+coverage; - if (pairSet.len > glyphs->get_population () * hb_bit_storage ((unsigned) pairSet.len)) + unsigned ps_len = (unsigned) pairSet.len; + if (ps_len > glyphs->get_population () * hb_bit_storage (ps_len)) { - for (hb_codepoint_t g : glyphs->iter()) + for (hb_codepoint_t g : glyphs->iter ()) { unsigned i = cov.get_coverage (g); if ((this+pairSet[i]).intersects (glyphs, valueFormat)) diff --git a/src/OT/Layout/GPOS/PairSet.hh b/src/OT/Layout/GPOS/PairSet.hh index 46718ea7f..f3598ddfa 100644 --- a/src/OT/Layout/GPOS/PairSet.hh +++ b/src/OT/Layout/GPOS/PairSet.hh @@ -17,12 +17,13 @@ struct PairSet : ValueBase using PairValueRecord = GPOS_impl::PairValueRecord; protected: - HBUINT16 len; /* Number of PairValueRecords */ + typename Types::HBUINT + len; /* Number of PairValueRecords */ PairValueRecord firstPairValueRecord; /* Array of PairValueRecords--ordered * by GlyphID of the second glyph */ public: - DEFINE_SIZE_MIN (2); + DEFINE_SIZE_MIN (Types::HBUINT::static_size); static size_t get_size (unsigned len1, unsigned len2) { @@ -45,14 +46,14 @@ struct PairSet : ValueBase bool sanitize (hb_sanitize_context_t *c, const sanitize_closure_t *closure) const { TRACE_SANITIZE (this); + unsigned int count = (unsigned) len; if (!(c->check_struct (this) && hb_barrier () && c->check_range (&firstPairValueRecord, - len, + count, closure->stride))) return_trace (false); hb_barrier (); - unsigned int count = len; const PairValueRecord *record = &firstPairValueRecord; return_trace (c->lazy_some_gpos || (closure->valueFormats[0].sanitize_values_stride_unsafe (c, this, &record->values[0], count, closure->stride) && @@ -65,7 +66,7 @@ struct PairSet : ValueBase unsigned record_size = get_size (valueFormats); const PairValueRecord *record = &firstPairValueRecord; - unsigned int count = len; + unsigned int count = (unsigned) len; for (unsigned int i = 0; i < count; i++) { if (glyphs->has (record->secondGlyph)) @@ -81,7 +82,7 @@ struct PairSet : ValueBase unsigned record_size = get_size (valueFormats); const PairValueRecord *record = &firstPairValueRecord; - c->input->add_array (&record->secondGlyph, len, record_size); + c->input->add_array (&record->secondGlyph, (unsigned) len, record_size); } void collect_variation_indices (hb_collect_variation_indices_context_t *c, @@ -90,7 +91,7 @@ struct PairSet : ValueBase unsigned record_size = get_size (valueFormats); const PairValueRecord *record = &firstPairValueRecord; - unsigned count = len; + unsigned count = (unsigned) len; for (unsigned i = 0; i < count; i++) { if (c->glyph_set->has (record->secondGlyph)) @@ -112,7 +113,7 @@ struct PairSet : ValueBase const PairValueRecord *record = hb_bsearch (buffer->info[pos].codepoint, &firstPairValueRecord, - len, + (unsigned) len, record_size); if (record) {