diff --git a/src/OT/Layout/Common/CoverageFormat1.hh b/src/OT/Layout/Common/CoverageFormat1.hh index 5d68e3d15..3f598d40e 100644 --- a/src/OT/Layout/Common/CoverageFormat1.hh +++ b/src/OT/Layout/Common/CoverageFormat1.hh @@ -79,7 +79,7 @@ struct CoverageFormat1_3 { if (glyphArray.len > glyphs->get_population () * hb_bit_storage ((unsigned) glyphArray.len) / 2) { - for (hb_codepoint_t g = HB_SET_VALUE_INVALID; glyphs->next (&g);) + for (auto g : *glyphs) if (get_coverage (g) != NOT_COVERED) return true; return false; diff --git a/src/OT/Layout/Common/CoverageFormat2.hh b/src/OT/Layout/Common/CoverageFormat2.hh index fa501d659..9c8754235 100644 --- a/src/OT/Layout/Common/CoverageFormat2.hh +++ b/src/OT/Layout/Common/CoverageFormat2.hh @@ -122,7 +122,7 @@ struct CoverageFormat2_4 { if (rangeRecord.len > glyphs->get_population () * hb_bit_storage ((unsigned) rangeRecord.len) / 2) { - for (hb_codepoint_t g = HB_SET_VALUE_INVALID; glyphs->next (&g);) + for (auto g : *glyphs) if (get_coverage (g) != NOT_COVERED) return true; return false; diff --git a/src/graph/graph.hh b/src/graph/graph.hh index 73f897d2f..0ad4e2ced 100644 --- a/src/graph/graph.hh +++ b/src/graph/graph.hh @@ -733,8 +733,7 @@ struct graph_t remap_obj_indices (index_map, parents.iter (), true); // Update roots set with new indices as needed. - uint32_t next = HB_SET_VALUE_INVALID; - while (roots.next (&next)) + for (auto next : roots) { const uint32_t *v; if (index_map.has (next, &v)) diff --git a/src/hb-bimap.hh b/src/hb-bimap.hh index 9edefd971..2e1af30d0 100644 --- a/src/hb-bimap.hh +++ b/src/hb-bimap.hh @@ -122,8 +122,7 @@ struct hb_inc_bimap_t : hb_bimap_t void add_set (const hb_set_t *set) { - hb_codepoint_t i = HB_SET_VALUE_INVALID; - while (hb_set_next (set, &i)) add (i); + for (auto i : *set) add (i); } /* Create an identity map. */ diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh index 5fef305d8..07db3fbd5 100644 --- a/src/hb-ot-cmap-table.hh +++ b/src/hb-ot-cmap-table.hh @@ -937,8 +937,7 @@ struct DefaultUVS : SortedArray32Of hb_codepoint_t start = HB_SET_VALUE_INVALID; hb_codepoint_t end = HB_SET_VALUE_INVALID; - for (hb_codepoint_t u = HB_SET_VALUE_INVALID; - unicodes->next (&u);) + for (auto u : *unicodes) { if (!as_array ().bsearch (u)) continue; diff --git a/src/hb-ot-layout-common.hh b/src/hb-ot-layout-common.hh index 9041198e2..cf344dcf4 100644 --- a/src/hb-ot-layout-common.hh +++ b/src/hb-ot-layout-common.hh @@ -1919,7 +1919,7 @@ struct ClassDefFormat2_4 { if (rangeRecord.len > glyphs->get_population () * hb_bit_storage ((unsigned) rangeRecord.len) / 2) { - for (hb_codepoint_t g = HB_SET_VALUE_INVALID; glyphs->next (&g);) + for (auto g : *glyphs) if (get_class (g)) return true; return false; @@ -1979,8 +1979,7 @@ struct ClassDefFormat2_4 unsigned count = rangeRecord.len; if (count > glyphs->get_population () * hb_bit_storage (count) * 8) { - for (hb_codepoint_t g = HB_SET_VALUE_INVALID; - glyphs->next (&g);) + for (auto g : *glyphs) { unsigned i; if (rangeRecord.as_array ().bfind (g, &i) && diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc index cbc694ef9..c40ca08ab 100644 --- a/src/hb-ot-layout.cc +++ b/src/hb-ot-layout.cc @@ -1316,8 +1316,7 @@ hb_ot_layout_collect_lookups (hb_face_t *face, hb_set_t feature_indexes; hb_ot_layout_collect_features (face, table_tag, scripts, languages, features, &feature_indexes); - for (hb_codepoint_t feature_index = HB_SET_VALUE_INVALID; - hb_set_next (&feature_indexes, &feature_index);) + for (auto feature_index : feature_indexes) g.get_feature (feature_index).add_lookup_indexes_to (lookup_indexes); g.feature_variation_collect_lookups (&feature_indexes, nullptr, lookup_indexes); @@ -1570,7 +1569,7 @@ hb_ot_layout_lookups_substitute_closure (hb_face_t *face, glyphs_length = glyphs->get_population (); if (lookups) { - for (hb_codepoint_t lookup_index = HB_SET_VALUE_INVALID; hb_set_next (lookups, &lookup_index);) + for (auto lookup_index : *lookups) gsub.get_lookup (lookup_index).closure (&c, lookup_index); } else diff --git a/src/hb-ot-os2-table.hh b/src/hb-ot-os2-table.hh index 6c776170c..72cb66247 100644 --- a/src/hb-ot-os2-table.hh +++ b/src/hb-ot-os2-table.hh @@ -287,8 +287,7 @@ struct OS2 /* This block doesn't show up in profiles. If it ever did, * we can rewrite it to iterate over OS/2 ranges and use * set iteration to check if the range matches. */ - for (hb_codepoint_t cp = HB_SET_VALUE_INVALID; - codepoints->next (&cp);) + for (auto cp : *codepoints) { unsigned int bit = _hb_ot_os2_get_unicode_range_bit (cp); if (bit < 128) diff --git a/src/hb-subset-cff-common.hh b/src/hb-subset-cff-common.hh index 99e89f781..34b9a5e26 100644 --- a/src/hb-subset-cff-common.hh +++ b/src/hb-subset-cff-common.hh @@ -607,8 +607,7 @@ struct subr_remap_t : hb_inc_bimap_t */ resize (closure->get_population ()); - hb_codepoint_t old_num = HB_SET_VALUE_INVALID; - while (hb_set_next (closure, &old_num)) + for (auto old_num : *closure) add (old_num); if (get_population () < 1240) diff --git a/src/test-gsub-get-alternates.cc b/src/test-gsub-get-alternates.cc index c9f3b4edb..555440c59 100644 --- a/src/test-gsub-get-alternates.cc +++ b/src/test-gsub-get-alternates.cc @@ -65,7 +65,7 @@ main (int argc, char **argv) for (unsigned i = 0; i < count; i++) { unsigned alt_count = 0; - for (unsigned lookup_index = HB_SET_VALUE_INVALID; + for (hb_codepoint_t lookup_index = HB_SET_VALUE_INVALID; hb_set_next (lookup_indexes, &lookup_index);) if ((alt_count = hb_ot_layout_lookup_get_glyph_alternates (face, lookup_index,