Use auto in range-for-loop more

This commit is contained in:
Behdad Esfahbod 2021-02-19 17:08:10 -07:00
parent 1551f3d518
commit 6d94194497
3 changed files with 9 additions and 7 deletions

View File

@ -183,7 +183,7 @@ struct CFFIndex
else else
{ {
serialize_header(c, + it | hb_map ([] (const byte_str_t &_) { return _.length; })); serialize_header(c, + it | hb_map ([] (const byte_str_t &_) { return _.length; }));
for (const byte_str_t &_ : +it) for (const auto &_ : +it)
_.copy (c); _.copy (c);
} }
return_trace (true); return_trace (true);

View File

@ -95,7 +95,7 @@ struct CmapSubtableFormat4
HBUINT16 *endCode = c->start_embed<HBUINT16> (); HBUINT16 *endCode = c->start_embed<HBUINT16> ();
hb_codepoint_t prev_endcp = 0xFFFF; hb_codepoint_t prev_endcp = 0xFFFF;
for (const hb_item_type<Iterator> _ : +it) for (const auto& _ : +it)
{ {
if (prev_endcp != 0xFFFF && prev_endcp + 1u != _.first) if (prev_endcp != 0xFFFF && prev_endcp + 1u != _.first)
{ {
@ -131,7 +131,7 @@ struct CmapSubtableFormat4
HBUINT16 *startCode = c->start_embed<HBUINT16> (); HBUINT16 *startCode = c->start_embed<HBUINT16> ();
hb_codepoint_t prev_cp = 0xFFFF; hb_codepoint_t prev_cp = 0xFFFF;
for (const hb_item_type<Iterator> _ : +it) for (const auto& _ : +it)
{ {
if (prev_cp == 0xFFFF || prev_cp + 1u != _.first) if (prev_cp == 0xFFFF || prev_cp + 1u != _.first)
{ {
@ -170,7 +170,7 @@ struct CmapSubtableFormat4
if ((char *)idDelta - (char *)startCode != (int) segcount * (int) HBINT16::static_size) if ((char *)idDelta - (char *)startCode != (int) segcount * (int) HBINT16::static_size)
return nullptr; return nullptr;
for (const hb_item_type<Iterator> _ : +it) for (const auto& _ : +it)
{ {
if (_.first == startCode[i]) if (_.first == startCode[i])
{ {
@ -696,7 +696,7 @@ struct CmapSubtableFormat12 : CmapSubtableLongSegmented<CmapSubtableFormat12>
hb_codepoint_t startCharCode = 0xFFFF, endCharCode = 0xFFFF; hb_codepoint_t startCharCode = 0xFFFF, endCharCode = 0xFFFF;
hb_codepoint_t glyphID = 0; hb_codepoint_t glyphID = 0;
for (const hb_item_type<Iterator> _ : +it) for (const auto& _ : +it)
{ {
if (startCharCode == 0xFFFF) if (startCharCode == 0xFFFF)
{ {

View File

@ -1882,7 +1882,7 @@ struct ContextFormat2
const hb_map_t *lookup_map = c->table_tag == HB_OT_TAG_GSUB ? c->plan->gsub_lookups : c->plan->gpos_lookups; const hb_map_t *lookup_map = c->table_tag == HB_OT_TAG_GSUB ? c->plan->gsub_lookups : c->plan->gpos_lookups;
bool ret = true; bool ret = true;
int non_zero_index = 0, index = 0; int non_zero_index = 0, index = 0;
for (const hb_pair_t<unsigned, const OffsetTo<RuleSet>&> _ : + hb_enumerate (ruleSet) for (const auto& _ : + hb_enumerate (ruleSet)
| hb_filter (klass_map, hb_first)) | hb_filter (klass_map, hb_first))
{ {
auto *o = out->ruleSet.serialize_append (c->serializer); auto *o = out->ruleSet.serialize_append (c->serializer);
@ -2034,6 +2034,7 @@ struct ContextFormat3
for (const OffsetTo<Coverage>& offset : coverages) for (const OffsetTo<Coverage>& offset : coverages)
{ {
/* TODO(subset) This looks like should not be necessary to write this way. */
auto *o = c->serializer->allocate_size<OffsetTo<Coverage>> (OffsetTo<Coverage>::static_size); auto *o = c->serializer->allocate_size<OffsetTo<Coverage>> (OffsetTo<Coverage>::static_size);
if (unlikely (!o)) return_trace (false); if (unlikely (!o)) return_trace (false);
if (!o->serialize_subset (c, offset, this)) return_trace (false); if (!o->serialize_subset (c, offset, this)) return_trace (false);
@ -2323,6 +2324,7 @@ struct ChainRule
c->copy (len); c->copy (len);
for (const auto g : it) for (const auto g : it)
{ {
/* TODO(constexpr) Simplify. */
HBUINT16 gid; HBUINT16 gid;
gid = g; gid = g;
c->copy (gid); c->copy (gid);