diff --git a/src/OT/Color/CBDT/CBDT.hh b/src/OT/Color/CBDT/CBDT.hh index b12505234..b287ea98f 100644 --- a/src/OT/Color/CBDT/CBDT.hh +++ b/src/OT/Color/CBDT/CBDT.hh @@ -545,7 +545,8 @@ struct IndexSubtableArray const IndexSubtableRecord*>> *lookup /* OUT */) const { bool start_glyph_is_set = false; - for (hb_codepoint_t new_gid = 0; new_gid < c->plan->num_output_glyphs (); new_gid++) + unsigned num_glyphs = c->plan->num_output_glyphs (); + for (hb_codepoint_t new_gid = 0; new_gid < num_glyphs; new_gid++) { hb_codepoint_t old_gid; if (unlikely (!c->plan->old_gid_for_new_gid (new_gid, &old_gid))) continue; diff --git a/src/hb-ot-var-hvar-table.hh b/src/hb-ot-var-hvar-table.hh index e8185a825..943d376bd 100644 --- a/src/hb-ot-var-hvar-table.hh +++ b/src/hb-ot-var-hvar-table.hh @@ -201,7 +201,8 @@ struct hvarvvar_subset_plan_t if (retain_adv_map) { - for (hb_codepoint_t gid = 0; gid < plan->num_output_glyphs (); gid++) + unsigned num_glyphs = plan->num_output_glyphs (); + for (hb_codepoint_t gid = 0; gid < num_glyphs; gid++) { if (inner_sets[0]->has (gid)) inner_maps[0].add (gid); diff --git a/src/hb-subset-cff-common.hh b/src/hb-subset-cff-common.hh index 0226b11f2..23e95d454 100644 --- a/src/hb-subset-cff-common.hh +++ b/src/hb-subset-cff-common.hh @@ -709,7 +709,8 @@ struct subr_subsetter_t } /* phase 1 & 2 */ - for (unsigned int i = 0; i < plan->num_output_glyphs (); i++) + unsigned num_glyphs = plan->num_output_glyphs (); + for (unsigned int i = 0; i < num_glyphs; i++) { hb_codepoint_t glyph; if (!plan->old_gid_for_new_gid (i, &glyph)) @@ -987,7 +988,8 @@ struct subr_subsetter_t const hb_vector_t& local_subrs) { closures.reset (); - for (unsigned int i = 0; i < plan->num_output_glyphs (); i++) + unsigned num_glyphs = plan->num_output_glyphs (); + for (unsigned int i = 0; i < num_glyphs; i++) { hb_codepoint_t glyph; if (!plan->old_gid_for_new_gid (i, &glyph)) diff --git a/src/hb-subset-cff1.cc b/src/hb-subset-cff1.cc index e6e557513..63fb144ab 100644 --- a/src/hb-subset-cff1.cc +++ b/src/hb-subset-cff1.cc @@ -415,7 +415,8 @@ struct cff_subset_plan { subset_enc_num_codes = plan->num_output_glyphs () - 1; unsigned int glyph; - for (glyph = 1; glyph < plan->num_output_glyphs (); glyph++) + unsigned num_glyphs = plan->num_output_glyphs (); + for (glyph = 1; glyph < num_glyphs; glyph++) { hb_codepoint_t old_glyph; if (!plan->old_gid_for_new_gid (glyph, &old_glyph)) @@ -574,7 +575,7 @@ struct cff_subset_plan { /* check whether the subset renumbers any glyph IDs */ gid_renum = false; - for (hb_codepoint_t new_glyph = 0; new_glyph < plan->num_output_glyphs (); new_glyph++) + for (hb_codepoint_t new_glyph = 0; new_glyph < num_glyphs; new_glyph++) { if (!plan->old_gid_for_new_gid(new_glyph, &old_glyph)) continue;