Replace Supplier.advance with Supplier::operator+=

This commit is contained in:
Behdad Esfahbod 2018-02-10 13:15:57 -06:00
parent d0f3e7f597
commit 71130a20fa
4 changed files with 13 additions and 12 deletions

View File

@ -151,8 +151,8 @@ typedef struct OffsetTable
if (rec.length % 4)
p = c->allocate_size<void> (4 - rec.length % 4);
}
tags.advance (table_count);
blobs.advance (table_count);
tags += table_count;
blobs += table_count;
/* TODO: update head table checkSumAdjustment. */

View File

@ -511,12 +511,13 @@ struct Supplier
return * (const Type *) (const void *) ((const char *) head + stride * i);
}
inline void advance (unsigned int count)
inline Supplier<Type> & operator += (unsigned int count)
{
if (unlikely (count > len))
count = len;
len -= count;
head = (const Type *) (const void *) ((const char *) head + stride * count);
return *this;
}
private:
@ -883,7 +884,7 @@ struct ArrayOf
if (unlikely (!serialize (c, items_len))) return_trace (false);
for (unsigned int i = 0; i < items_len; i++)
array[i] = items[i];
items.advance (items_len);
items += items_len;
return_trace (true);
}
@ -1006,7 +1007,7 @@ struct HeadlessArrayOf
if (unlikely (!c->extend (*this))) return_trace (false);
for (unsigned int i = 0; i < items_len - 1; i++)
array[i] = items[i];
items.advance (items_len - 1);
items += items_len - 1;
return_trace (true);
}

View File

@ -700,7 +700,7 @@ struct CoverageFormat1
if (unlikely (!c->extend (glyphArray))) return_trace (false);
for (unsigned int i = 0; i < num_glyphs; i++)
glyphArray[i] = glyphs[i];
glyphs.advance (num_glyphs);
glyphs += num_glyphs;
return_trace (true);
}
@ -789,7 +789,7 @@ struct CoverageFormat2
} else {
rangeRecord[range].end = glyphs[i];
}
glyphs.advance (num_glyphs);
glyphs += num_glyphs;
return_trace (true);
}

View File

@ -386,7 +386,7 @@ struct MultipleSubstFormat1
if (unlikely (!sequence[i].serialize (c, this).serialize (c,
substitute_glyphs_list,
substitute_len_list[i]))) return_trace (false);
substitute_len_list.advance (num_glyphs);
substitute_len_list += num_glyphs;
if (unlikely (!coverage.serialize (c, this).serialize (c, glyphs, num_glyphs))) return_trace (false);
return_trace (true);
}
@ -536,7 +536,7 @@ struct AlternateSubstFormat1
if (unlikely (!alternateSet[i].serialize (c, this).serialize (c,
alternate_glyphs_list,
alternate_len_list[i]))) return_trace (false);
alternate_len_list.advance (num_glyphs);
alternate_len_list += num_glyphs;
if (unlikely (!coverage.serialize (c, this).serialize (c, glyphs, num_glyphs))) return_trace (false);
return_trace (true);
}
@ -757,8 +757,8 @@ struct LigatureSet
ligatures[i],
component_list,
component_count_list[i]))) return_trace (false);
ligatures.advance (num_ligatures);
component_count_list.advance (num_ligatures);
ligatures += num_ligatures;
component_count_list += num_ligatures;
return_trace (true);
}
@ -850,7 +850,7 @@ struct LigatureSubstFormat1
component_count_list,
ligature_per_first_glyph_count_list[i],
component_list))) return_trace (false);
ligature_per_first_glyph_count_list.advance (num_first_glyphs);
ligature_per_first_glyph_count_list += num_first_glyphs;
if (unlikely (!coverage.serialize (c, this).serialize (c, first_glyphs, num_first_glyphs))) return_trace (false);
return_trace (true);
}