[arrays] Use hb_array_t<> in all places with sub_array()

pull/1412/head
Behdad Esfahbod 6 years ago
parent 3246a8ebbd
commit f47c5da0aa
  1. 6
      src/hb-aat-layout-lcar-table.hh
  2. 14
      src/hb-ot-layout-gdef-table.hh
  3. 10
      src/hb-ot-math-table.hh

@ -52,10 +52,10 @@ struct lcar
const OffsetTo<LigCaretClassEntry>* entry_offset = lookup.get_value (glyph,
font->face->get_num_glyphs ());
const LigCaretClassEntry& array = entry_offset ? this+*entry_offset : Null (LigCaretClassEntry);
if (caret_count && *caret_count)
if (caret_count)
{
const HBINT16 *arr = array.sub_array (start_offset, caret_count);
unsigned int count = *caret_count;
hb_array_t<const HBINT16> arr = array.sub_array (start_offset, caret_count);
unsigned int count = arr.len;
for (unsigned int i = 0; i < count; ++i)
switch (format)
{

@ -61,9 +61,10 @@ struct AttachList
const AttachPoint &points = this+attachPoint[index];
if (point_count) {
const HBUINT16 *array = points.sub_array (start_offset, point_count);
unsigned int count = *point_count;
if (point_count)
{
hb_array_t<const HBUINT16> array = points.sub_array (start_offset, point_count);
unsigned int count = array.len;
for (unsigned int i = 0; i < count; i++)
point_array[i] = array[i];
}
@ -216,9 +217,10 @@ struct LigGlyph
unsigned int *caret_count /* IN/OUT */,
hb_position_t *caret_array /* OUT */) const
{
if (caret_count) {
const OffsetTo<CaretValue> *array = carets.sub_array (start_offset, caret_count);
unsigned int count = *caret_count;
if (caret_count)
{
hb_array_t <const OffsetTo<CaretValue> > array = carets.sub_array (start_offset, caret_count);
unsigned int count = array.len;
for (unsigned int i = 0; i < count; i++)
caret_array[i] = (this+array[i]).get_caret_value (font, direction, glyph_id, var_store);
}

@ -509,9 +509,8 @@ struct MathGlyphAssembly
if (parts_count)
{
int scale = font->dir_scale (direction);
const MathGlyphPartRecord *arr =
partRecords.sub_array (start_offset, parts_count);
unsigned int count = *parts_count;
hb_array_t<const MathGlyphPartRecord> arr = partRecords.sub_array (start_offset, parts_count);
unsigned int count = arr.len;
for (unsigned int i = 0; i < count; i++)
arr[i].extract (parts[i], scale, font);
}
@ -556,9 +555,8 @@ struct MathGlyphConstruction
if (variants_count)
{
int scale = font->dir_scale (direction);
const MathGlyphVariantRecord *arr =
mathGlyphVariantRecord.sub_array (start_offset, variants_count);
unsigned int count = *variants_count;
hb_array_t<const MathGlyphVariantRecord> arr = mathGlyphVariantRecord.sub_array (start_offset, variants_count);
unsigned int count = arr.len;
for (unsigned int i = 0; i < count; i++)
{
variants[i].glyph = arr[i].variantGlyph;

Loading…
Cancel
Save