From 63f57f4dab3d3179838d5d1cd03d116837a7e5c2 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 8 May 2018 16:56:11 -0700 Subject: [PATCH] Mark more unsized array's as arrayZ --- src/hb-aat-layout-common-private.hh | 14 +++--- src/hb-aat-layout-kerx-table.hh | 2 +- src/hb-aat-layout-morx-table.hh | 6 +-- src/hb-open-file-private.hh | 6 +-- src/hb-open-type-private.hh | 40 ++++++++--------- src/hb-ot-cmap-table.hh | 2 +- src/hb-ot-color-cbdt-table.hh | 10 ++--- src/hb-ot-layout-common-private.hh | 12 +++--- src/hb-ot-layout-gsub-table.hh | 16 +++---- src/hb-ot-layout-gsubgpos-private.hh | 64 ++++++++++++++-------------- src/hb-ot-post-table.hh | 4 +- src/hb-ot-var-avar-table.hh | 26 +++++------ src/hb-private.hh | 54 +++++++++++------------ src/hb-set-private.hh | 4 +- src/hb-subset.cc | 2 +- 15 files changed, 131 insertions(+), 131 deletions(-) diff --git a/src/hb-aat-layout-common-private.hh b/src/hb-aat-layout-common-private.hh index cf3082275..2825b1813 100644 --- a/src/hb-aat-layout-common-private.hh +++ b/src/hb-aat-layout-common-private.hh @@ -67,11 +67,11 @@ struct BinSearchArrayOf inline const Type& operator [] (unsigned int i) const { if (unlikely (i >= header.nUnits)) return Null(Type); - return StructAtOffset (bytes, i * header.unitSize); + return StructAtOffset (bytesZ, i * header.unitSize); } inline Type& operator [] (unsigned int i) { - return StructAtOffset (bytes, i * header.unitSize); + return StructAtOffset (bytesZ, i * header.unitSize); } inline unsigned int get_size (void) const { return header.static_size + header.nUnits * header.unitSize; } @@ -88,7 +88,7 @@ struct BinSearchArrayOf * pointed to do have a simple sanitize(), ie. they do not * reference other structs via offsets. */ - (void) (false && StructAtOffset (bytes, 0).sanitize (c)); + (void) (false && StructAtOffset (bytesZ, 0).sanitize (c)); return_trace (true); } @@ -111,7 +111,7 @@ struct BinSearchArrayOf while (min <= max) { int mid = (min + max) / 2; - const Type *p = (const Type *) (((const char *) bytes) + (mid * size)); + const Type *p = (const Type *) (((const char *) bytesZ) + (mid * size)); int c = p->cmp (key); if (c < 0) max = mid - 1; @@ -129,14 +129,14 @@ struct BinSearchArrayOf TRACE_SANITIZE (this); return_trace (header.sanitize (c) && Type::static_size >= header.unitSize && - c->check_array (bytes, header.unitSize, header.nUnits)); + c->check_array (bytesZ, header.unitSize, header.nUnits)); } protected: BinSearchHeader header; - HBUINT8 bytes[VAR]; + HBUINT8 bytesZ[VAR]; public: - DEFINE_SIZE_ARRAY (10, bytes); + DEFINE_SIZE_ARRAY (10, bytesZ); }; diff --git a/src/hb-aat-layout-kerx-table.hh b/src/hb-aat-layout-kerx-table.hh index 52637e6ec..cc03d6278 100644 --- a/src/hb-aat-layout-kerx-table.hh +++ b/src/hb-aat-layout-kerx-table.hh @@ -334,7 +334,7 @@ struct kerx HBUINT16 version; HBUINT16 padding; HBUINT32 nTables; -/*KerxTable tables[VAR];*/ +/*KerxTable tablesZ[VAR]; XXX ArrayOf??? */ /*SubtableGlyphCoverageArray coverage_array;*/ public: DEFINE_SIZE_STATIC (8); diff --git a/src/hb-aat-layout-morx-table.hh b/src/hb-aat-layout-morx-table.hh index fce1878d8..f25842457 100644 --- a/src/hb-aat-layout-morx-table.hh +++ b/src/hb-aat-layout-morx-table.hh @@ -689,7 +689,7 @@ struct morx inline void apply (hb_aat_apply_context_t *c) const { c->set_lookup_index (0); - const Chain *chain = chains; + const Chain *chain = chainsZ; unsigned int count = chainCount; for (unsigned int i = 0; i < count; i++) { @@ -706,7 +706,7 @@ struct morx !chainCount.sanitize (c)) return_trace (false); - const Chain *chain = chains; + const Chain *chain = chainsZ; unsigned int count = chainCount; for (unsigned int i = 0; i < count; i++) { @@ -723,7 +723,7 @@ struct morx * 1 for mort, 2 or 3 for morx. */ HBUINT32 chainCount; /* Number of metamorphosis chains contained in this * table. */ - Chain chains[VAR]; /* Chains. */ + Chain chainsZ[VAR]; /* Chains. */ public: DEFINE_SIZE_MIN (8); diff --git a/src/hb-open-file-private.hh b/src/hb-open-file-private.hh index 28f967dd0..2965b4626 100644 --- a/src/hb-open-file-private.hh +++ b/src/hb-open-file-private.hh @@ -100,7 +100,7 @@ typedef struct OffsetTable else *table_count = MIN (*table_count, tables.len - start_offset); - const TableRecord *sub_tables = tables.array + start_offset; + const TableRecord *sub_tables = tables.arrayZ + start_offset; unsigned int count = *table_count; for (unsigned int i = 0; i < count; i++) table_tags[i] = sub_tables[i].tag; @@ -148,7 +148,7 @@ typedef struct OffsetTable /* Write OffsetTables, alloc for and write actual table blobs. */ for (unsigned int i = 0; i < table_count; i++) { - TableRecord &rec = tables.array[i]; + TableRecord &rec = tables.arrayZ[i]; hb_blob_t *blob = blobs[i]; rec.tag.set (tags[i]); rec.length.set (hb_blob_get_length (blob)); @@ -188,7 +188,7 @@ typedef struct OffsetTable checksum.set_for_data (this, dir_end - (const char *) this); for (unsigned int i = 0; i < table_count; i++) { - TableRecord &rec = tables.array[i]; + TableRecord &rec = tables.arrayZ[i]; checksum.set (checksum + rec.checkSum); } diff --git a/src/hb-open-type-private.hh b/src/hb-open-type-private.hh index 775cb390a..0dfe0117b 100644 --- a/src/hb-open-type-private.hh +++ b/src/hb-open-type-private.hh @@ -920,17 +920,17 @@ struct ArrayOf count -= start_offset; count = MIN (count, *pcount); *pcount = count; - return array + start_offset; + return arrayZ + start_offset; } inline const Type& operator [] (unsigned int i) const { if (unlikely (i >= len)) return Null(Type); - return array[i]; + return arrayZ[i]; } inline Type& operator [] (unsigned int i) { - return array[i]; + return arrayZ[i]; } inline unsigned int get_size (void) const { return len.static_size + len * Type::static_size; } @@ -952,7 +952,7 @@ struct ArrayOf TRACE_SERIALIZE (this); if (unlikely (!serialize (c, items_len))) return_trace (false); for (unsigned int i = 0; i < items_len; i++) - array[i] = items[i]; + arrayZ[i] = items[i]; items += items_len; return_trace (true); } @@ -969,7 +969,7 @@ struct ArrayOf * pointed to do have a simple sanitize(), ie. they do not * reference other structs via offsets. */ - (void) (false && array[0].sanitize (c)); + (void) (false && arrayZ[0].sanitize (c)); return_trace (true); } @@ -979,7 +979,7 @@ struct ArrayOf if (unlikely (!sanitize_shallow (c))) return_trace (false); unsigned int count = len; for (unsigned int i = 0; i < count; i++) - if (unlikely (!array[i].sanitize (c, base))) + if (unlikely (!arrayZ[i].sanitize (c, base))) return_trace (false); return_trace (true); } @@ -990,7 +990,7 @@ struct ArrayOf if (unlikely (!sanitize_shallow (c))) return_trace (false); unsigned int count = len; for (unsigned int i = 0; i < count; i++) - if (unlikely (!array[i].sanitize (c, base, user_data))) + if (unlikely (!arrayZ[i].sanitize (c, base, user_data))) return_trace (false); return_trace (true); } @@ -1000,28 +1000,28 @@ struct ArrayOf { unsigned int count = len; for (unsigned int i = 0; i < count; i++) - if (!this->array[i].cmp (x)) + if (!this->arrayZ[i].cmp (x)) return i; return -1; } inline void qsort (void) { - ::qsort (array, len, sizeof (Type), Type::cmp); + ::qsort (arrayZ, len, sizeof (Type), Type::cmp); } private: inline bool sanitize_shallow (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); - return_trace (len.sanitize (c) && c->check_array (array, Type::static_size, len)); + return_trace (len.sanitize (c) && c->check_array (arrayZ, Type::static_size, len)); } public: LenType len; - Type array[VAR]; + Type arrayZ[VAR]; public: - DEFINE_SIZE_ARRAY (sizeof (LenType), array); + DEFINE_SIZE_ARRAY (sizeof (LenType), arrayZ); }; template struct LArrayOf : ArrayOf {}; @@ -1036,7 +1036,7 @@ struct OffsetListOf : OffsetArrayOf inline const Type& operator [] (unsigned int i) const { if (unlikely (i >= this->len)) return Null(Type); - return this+this->array[i]; + return this+this->arrayZ[i]; } inline bool sanitize (hb_sanitize_context_t *c) const @@ -1060,7 +1060,7 @@ struct HeadlessArrayOf inline const Type& operator [] (unsigned int i) const { if (unlikely (i >= len || !i)) return Null(Type); - return array[i-1]; + return arrayZ[i-1]; } inline unsigned int get_size (void) const { return len.static_size + (len ? len - 1 : 0) * Type::static_size; } @@ -1075,7 +1075,7 @@ struct HeadlessArrayOf if (unlikely (!items_len)) return_trace (true); if (unlikely (!c->extend (*this))) return_trace (false); for (unsigned int i = 0; i < items_len - 1; i++) - array[i] = items[i]; + arrayZ[i] = items[i]; items += items_len - 1; return_trace (true); } @@ -1092,7 +1092,7 @@ struct HeadlessArrayOf * pointed to do have a simple sanitize(), ie. they do not * reference other structs via offsets. */ - (void) (false && array[0].sanitize (c)); + (void) (false && arrayZ[0].sanitize (c)); return_trace (true); } @@ -1102,14 +1102,14 @@ struct HeadlessArrayOf { TRACE_SANITIZE (this); return_trace (len.sanitize (c) && - (!len || c->check_array (array, Type::static_size, len - 1))); + (!len || c->check_array (arrayZ, Type::static_size, len - 1))); } public: LenType len; - Type array[VAR]; + Type arrayZ[VAR]; public: - DEFINE_SIZE_ARRAY (sizeof (LenType), array); + DEFINE_SIZE_ARRAY (sizeof (LenType), arrayZ); }; @@ -1123,7 +1123,7 @@ struct SortedArrayOf : ArrayOf inline int bsearch (const SearchType &x) const { /* Hand-coded bsearch here since this is in the hot inner loop. */ - const Type *arr = this->array; + const Type *arr = this->arrayZ; int min = 0, max = (int) this->len - 1; while (min <= max) { diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh index 5e215a4ad..196b2cb75 100644 --- a/src/hb-ot-cmap-table.hh +++ b/src/hb-ot-cmap-table.hh @@ -450,7 +450,7 @@ struct CmapSubtableLongSegmented { TRACE_SERIALIZE (this); if (unlikely (!c->extend_min (*this))) return_trace (false); - Supplier supplier (group_data.array, group_data.len); + Supplier supplier (group_data.arrayZ, group_data.len); if (unlikely (!groups.serialize (c, supplier, group_data.len))) return_trace (false); return true; } diff --git a/src/hb-ot-color-cbdt-table.hh b/src/hb-ot-color-cbdt-table.hh index f4207f2db..d1dd9de47 100644 --- a/src/hb-ot-color-cbdt-table.hh +++ b/src/hb-ot-color-cbdt-table.hh @@ -357,8 +357,8 @@ struct CBLC unsigned int count = sizeTables.len; for (uint32_t i = 0; i < count; ++i) { - unsigned int startGlyphIndex = sizeTables.array[i].startGlyphIndex; - unsigned int endGlyphIndex = sizeTables.array[i].endGlyphIndex; + unsigned int startGlyphIndex = sizeTables.arrayZ[i].startGlyphIndex; + unsigned int endGlyphIndex = sizeTables.arrayZ[i].endGlyphIndex; if (startGlyphIndex <= glyph && glyph <= endGlyphIndex) { *x_ppem = sizeTables[i].ppemX; @@ -489,21 +489,21 @@ struct CBDT case 17: { const GlyphBitmapDataFormat17& glyphFormat17 = StructAtOffset (this->cbdt, image_offset); - callback ((const uint8_t *) &glyphFormat17.data.array, + callback ((const uint8_t *) &glyphFormat17.data.arrayZ, glyphFormat17.data.len, i, gid); } break; case 18: { const GlyphBitmapDataFormat18& glyphFormat18 = StructAtOffset (this->cbdt, image_offset); - callback ((const uint8_t *) &glyphFormat18.data.array, + callback ((const uint8_t *) &glyphFormat18.data.arrayZ, glyphFormat18.data.len, i, gid); } break; case 19: { const GlyphBitmapDataFormat19& glyphFormat19 = StructAtOffset (this->cbdt, image_offset); - callback ((const uint8_t *) &glyphFormat19.data.array, + callback ((const uint8_t *) &glyphFormat19.data.arrayZ, glyphFormat19.data.len, i, gid); } break; diff --git a/src/hb-ot-layout-common-private.hh b/src/hb-ot-layout-common-private.hh index ec9176957..66e351106 100644 --- a/src/hb-ot-layout-common-private.hh +++ b/src/hb-ot-layout-common-private.hh @@ -723,7 +723,7 @@ struct CoverageFormat1 template inline bool add_coverage (set_t *glyphs) const { - return glyphs->add_sorted_array (glyphArray.array, glyphArray.len); + return glyphs->add_sorted_array (glyphArray.arrayZ, glyphArray.len); } public: @@ -1337,13 +1337,13 @@ struct VarData const HBINT16 *scursor = reinterpret_cast (row); for (; i < scount; i++) { - float scalar = regions.evaluate (regionIndices.array[i], coords, coord_count); + float scalar = regions.evaluate (regionIndices.arrayZ[i], coords, coord_count); delta += scalar * *scursor++; } const HBINT8 *bcursor = reinterpret_cast (scursor); for (; i < count; i++) { - float scalar = regions.evaluate (regionIndices.array[i], coords, coord_count); + float scalar = regions.evaluate (regionIndices.arrayZ[i], coords, coord_count); delta += scalar * *bcursor++; } @@ -1472,7 +1472,7 @@ struct ConditionSet { unsigned int count = conditions.len; for (unsigned int i = 0; i < count; i++) - if (!(this+conditions.array[i]).evaluate (coords, coord_len)) + if (!(this+conditions.arrayZ[i]).evaluate (coords, coord_len)) return false; return true; } @@ -1513,7 +1513,7 @@ struct FeatureTableSubstitution unsigned int count = substitutions.len; for (unsigned int i = 0; i < count; i++) { - const FeatureTableSubstitutionRecord &record = substitutions.array[i]; + const FeatureTableSubstitutionRecord &record = substitutions.arrayZ[i]; if (record.featureIndex == feature_index) return &(this+record.feature); } @@ -1566,7 +1566,7 @@ struct FeatureVariations unsigned int count = varRecords.len; for (unsigned int i = 0; i < count; i++) { - const FeatureVariationRecord &record = varRecords.array[i]; + const FeatureVariationRecord &record = varRecords.arrayZ[i]; if ((this+record.conditions).evaluate (coords, coord_len)) { *index = i; diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh index 059f663d6..6e57195b3 100644 --- a/src/hb-ot-layout-gsub-table.hh +++ b/src/hb-ot-layout-gsub-table.hh @@ -269,7 +269,7 @@ struct Sequence inline void collect_glyphs (hb_collect_glyphs_context_t *c) const { TRACE_COLLECT_GLYPHS (this); - c->output->add_array (substitute.array, substitute.len); + c->output->add_array (substitute.arrayZ, substitute.len); } inline bool apply (hb_ot_apply_context_t *c) const @@ -281,7 +281,7 @@ struct Sequence * as a "multiplied" substitution. */ if (unlikely (count == 1)) { - c->replace_glyph (substitute.array[0]); + c->replace_glyph (substitute.arrayZ[0]); return_trace (true); } /* Spec disallows this, but Uniscribe allows it. @@ -297,7 +297,7 @@ struct Sequence for (unsigned int i = 0; i < count; i++) { _hb_glyph_info_set_lig_props_for_component (&c->buffer->cur(), i); - c->output_glyph_for_component (substitute.array[i], klass); + c->output_glyph_for_component (substitute.arrayZ[i], klass); } c->buffer->skip_glyph (); @@ -480,7 +480,7 @@ struct AlternateSubstFormat1 if (unlikely (iter.get_coverage () >= count)) break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */ const AlternateSet &alt_set = this+alternateSet[iter.get_coverage ()]; - c->output->add_array (alt_set.array, alt_set.len); + c->output->add_array (alt_set.arrayZ, alt_set.len); } } @@ -611,7 +611,7 @@ struct Ligature inline void collect_glyphs (hb_collect_glyphs_context_t *c) const { TRACE_COLLECT_GLYPHS (this); - c->input->add_array (component.array, component.len ? component.len - 1 : 0); + c->input->add_array (component.arrayZ, component.len ? component.len - 1 : 0); c->output->add (ligGlyph); } @@ -979,7 +979,7 @@ struct ReverseChainSingleSubstFormat1 const ArrayOf &substitute = StructAfter > (lookahead); count = substitute.len; - c->output->add_array (substitute.array, substitute.len); + c->output->add_array (substitute.arrayZ, substitute.len); } inline const Coverage &get_coverage (void) const @@ -1007,11 +1007,11 @@ struct ReverseChainSingleSubstFormat1 unsigned int start_index = 0, end_index = 0; if (match_backtrack (c, - backtrack.len, (HBUINT16 *) backtrack.array, + backtrack.len, (HBUINT16 *) backtrack.arrayZ, match_coverage, this, &start_index) && match_lookahead (c, - lookahead.len, (HBUINT16 *) lookahead.array, + lookahead.len, (HBUINT16 *) lookahead.arrayZ, match_coverage, this, 1, &end_index)) { diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh index 90546344d..7f3ffb614 100644 --- a/src/hb-ot-layout-gsubgpos-private.hh +++ b/src/hb-ot-layout-gsubgpos-private.hh @@ -1713,10 +1713,10 @@ struct ChainRule const ArrayOf &lookahead = StructAfter > (input); const ArrayOf &lookup = StructAfter > (lookahead); chain_context_closure_lookup (c, - backtrack.len, backtrack.array, - input.len, input.array, - lookahead.len, lookahead.array, - lookup.len, lookup.array, + backtrack.len, backtrack.arrayZ, + input.len, input.arrayZ, + lookahead.len, lookahead.arrayZ, + lookup.len, lookup.arrayZ, lookup_context); } @@ -1727,10 +1727,10 @@ struct ChainRule const ArrayOf &lookahead = StructAfter > (input); const ArrayOf &lookup = StructAfter > (lookahead); chain_context_collect_glyphs_lookup (c, - backtrack.len, backtrack.array, - input.len, input.array, - lookahead.len, lookahead.array, - lookup.len, lookup.array, + backtrack.len, backtrack.arrayZ, + input.len, input.arrayZ, + lookahead.len, lookahead.arrayZ, + lookup.len, lookup.arrayZ, lookup_context); } @@ -1741,10 +1741,10 @@ struct ChainRule const ArrayOf &lookahead = StructAfter > (input); const ArrayOf &lookup = StructAfter > (lookahead); return_trace (chain_context_would_apply_lookup (c, - backtrack.len, backtrack.array, - input.len, input.array, - lookahead.len, lookahead.array, lookup.len, - lookup.array, lookup_context)); + backtrack.len, backtrack.arrayZ, + input.len, input.arrayZ, + lookahead.len, lookahead.arrayZ, lookup.len, + lookup.arrayZ, lookup_context)); } inline bool apply (hb_ot_apply_context_t *c, ChainContextApplyLookupContext &lookup_context) const @@ -1754,10 +1754,10 @@ struct ChainRule const ArrayOf &lookahead = StructAfter > (input); const ArrayOf &lookup = StructAfter > (lookahead); return_trace (chain_context_apply_lookup (c, - backtrack.len, backtrack.array, - input.len, input.array, - lookahead.len, lookahead.array, lookup.len, - lookup.array, lookup_context)); + backtrack.len, backtrack.arrayZ, + input.len, input.arrayZ, + lookahead.len, lookahead.arrayZ, lookup.len, + lookup.arrayZ, lookup_context)); } inline bool sanitize (hb_sanitize_context_t *c) const @@ -2072,10 +2072,10 @@ struct ChainContextFormat3 {this, this, this} }; chain_context_closure_lookup (c, - backtrack.len, (const HBUINT16 *) backtrack.array, - input.len, (const HBUINT16 *) input.array + 1, - lookahead.len, (const HBUINT16 *) lookahead.array, - lookup.len, lookup.array, + backtrack.len, (const HBUINT16 *) backtrack.arrayZ, + input.len, (const HBUINT16 *) input.arrayZ + 1, + lookahead.len, (const HBUINT16 *) lookahead.arrayZ, + lookup.len, lookup.arrayZ, lookup_context); } @@ -2093,10 +2093,10 @@ struct ChainContextFormat3 {this, this, this} }; chain_context_collect_glyphs_lookup (c, - backtrack.len, (const HBUINT16 *) backtrack.array, - input.len, (const HBUINT16 *) input.array + 1, - lookahead.len, (const HBUINT16 *) lookahead.array, - lookup.len, lookup.array, + backtrack.len, (const HBUINT16 *) backtrack.arrayZ, + input.len, (const HBUINT16 *) input.arrayZ + 1, + lookahead.len, (const HBUINT16 *) lookahead.arrayZ, + lookup.len, lookup.arrayZ, lookup_context); } @@ -2112,10 +2112,10 @@ struct ChainContextFormat3 {this, this, this} }; return_trace (chain_context_would_apply_lookup (c, - backtrack.len, (const HBUINT16 *) backtrack.array, - input.len, (const HBUINT16 *) input.array + 1, - lookahead.len, (const HBUINT16 *) lookahead.array, - lookup.len, lookup.array, lookup_context)); + backtrack.len, (const HBUINT16 *) backtrack.arrayZ, + input.len, (const HBUINT16 *) input.arrayZ + 1, + lookahead.len, (const HBUINT16 *) lookahead.arrayZ, + lookup.len, lookup.arrayZ, lookup_context)); } inline const Coverage &get_coverage (void) const @@ -2139,10 +2139,10 @@ struct ChainContextFormat3 {this, this, this} }; return_trace (chain_context_apply_lookup (c, - backtrack.len, (const HBUINT16 *) backtrack.array, - input.len, (const HBUINT16 *) input.array + 1, - lookahead.len, (const HBUINT16 *) lookahead.array, - lookup.len, lookup.array, lookup_context)); + backtrack.len, (const HBUINT16 *) backtrack.arrayZ, + input.len, (const HBUINT16 *) input.arrayZ + 1, + lookahead.len, (const HBUINT16 *) lookahead.arrayZ, + lookup.len, lookup.arrayZ, lookup_context)); } inline bool sanitize (hb_sanitize_context_t *c) const diff --git a/src/hb-ot-post-table.hh b/src/hb-ot-post-table.hh index 8ba5ee103..bec508c06 100644 --- a/src/hb-ot-post-table.hh +++ b/src/hb-ot-post-table.hh @@ -238,14 +238,14 @@ struct post if (version != 0x00020000 || glyph >= glyphNameIndex->len) return hb_bytes_t (); - unsigned int index = glyphNameIndex->array[glyph]; + unsigned int index = glyphNameIndex->arrayZ[glyph]; if (index < NUM_FORMAT1_NAMES) return format1_names (index); index -= NUM_FORMAT1_NAMES; if (index >= index_to_offset.len) return hb_bytes_t (); - unsigned int offset = index_to_offset.array[index]; + unsigned int offset = index_to_offset.arrayZ[index]; const uint8_t *data = pool + offset; unsigned int name_length = *data; diff --git a/src/hb-ot-var-avar-table.hh b/src/hb-ot-var-avar-table.hh index fc73527e4..ad063d32d 100644 --- a/src/hb-ot-var-avar-table.hh +++ b/src/hb-ot-var-avar-table.hh @@ -70,30 +70,30 @@ struct SegmentMaps : ArrayOf if (!len) return value; else /* len == 1*/ - return value - array[0].fromCoord + array[0].toCoord; + return value - arrayZ[0].fromCoord + arrayZ[0].toCoord; } - if (value <= array[0].fromCoord) - return value - array[0].fromCoord + array[0].toCoord; + if (value <= arrayZ[0].fromCoord) + return value - arrayZ[0].fromCoord + arrayZ[0].toCoord; unsigned int i; unsigned int count = len; - for (i = 1; i < count && value > array[i].fromCoord; i++) + for (i = 1; i < count && value > arrayZ[i].fromCoord; i++) ; - if (value >= array[i].fromCoord) - return value - array[i].fromCoord + array[i].toCoord; + if (value >= arrayZ[i].fromCoord) + return value - arrayZ[i].fromCoord + arrayZ[i].toCoord; - if (unlikely (array[i-1].fromCoord == array[i].fromCoord)) - return array[i-1].toCoord; + if (unlikely (arrayZ[i-1].fromCoord == arrayZ[i].fromCoord)) + return arrayZ[i-1].toCoord; - int denom = array[i].fromCoord - array[i-1].fromCoord; - return array[i-1].toCoord + - ((array[i].toCoord - array[i-1].toCoord) * - (value - array[i-1].fromCoord) + denom/2) / denom; + int denom = arrayZ[i].fromCoord - arrayZ[i-1].fromCoord; + return arrayZ[i-1].toCoord + + ((arrayZ[i].toCoord - arrayZ[i-1].toCoord) * + (value - arrayZ[i-1].fromCoord) + denom/2) / denom; } - DEFINE_SIZE_ARRAY (2, array); + DEFINE_SIZE_ARRAY (2, arrayZ); }; struct avar diff --git a/src/hb-private.hh b/src/hb-private.hh index 9e075a312..a31e4799f 100644 --- a/src/hb-private.hh +++ b/src/hb-private.hh @@ -531,25 +531,25 @@ struct hb_vector_t { unsigned int len; unsigned int allocated; - Type *array; + Type *arrayZ; Type static_array[StaticSize]; void init (void) { len = 0; allocated = ARRAY_LENGTH (static_array); - array = static_array; + arrayZ = static_array; } - inline Type& operator [] (unsigned int i) { return array[i]; } - inline const Type& operator [] (unsigned int i) const { return array[i]; } + inline Type& operator [] (unsigned int i) { return arrayZ[i]; } + inline const Type& operator [] (unsigned int i) const { return arrayZ[i]; } inline Type *push (void) { if (unlikely (!resize (len + 1))) return nullptr; - return &array[len - 1]; + return &arrayZ[len - 1]; } /* Allocate for size but don't adjust len. */ @@ -566,21 +566,21 @@ struct hb_vector_t Type *new_array = nullptr; - if (array == static_array) { + if (arrayZ == static_array) { new_array = (Type *) calloc (new_allocated, sizeof (Type)); if (new_array) - memcpy (new_array, array, len * sizeof (Type)); + memcpy (new_array, arrayZ, len * sizeof (Type)); } else { bool overflows = (new_allocated < allocated) || _hb_unsigned_int_mul_overflows (new_allocated, sizeof (Type)); if (likely (!overflows)) { - new_array = (Type *) realloc (array, new_allocated * sizeof (Type)); + new_array = (Type *) realloc (arrayZ, new_allocated * sizeof (Type)); } } if (unlikely (!new_array)) return false; - array = new_array; + arrayZ = new_array; allocated = new_allocated; return true; @@ -604,8 +604,8 @@ struct hb_vector_t { if (unlikely (i >= len)) return; - memmove (static_cast (&array[i]), - static_cast (&array[i + 1]), + memmove (static_cast (&arrayZ[i]), + static_cast (&arrayZ[i + 1]), (len - i - 1) * sizeof (Type)); len--; } @@ -619,39 +619,39 @@ struct hb_vector_t template inline Type *find (T v) { for (unsigned int i = 0; i < len; i++) - if (array[i] == v) - return &array[i]; + if (arrayZ[i] == v) + return &arrayZ[i]; return nullptr; } template inline const Type *find (T v) const { for (unsigned int i = 0; i < len; i++) - if (array[i] == v) - return &array[i]; + if (arrayZ[i] == v) + return &arrayZ[i]; return nullptr; } inline void qsort (int (*cmp)(const void*, const void*)) { - ::qsort (array, len, sizeof (Type), cmp); + ::qsort (arrayZ, len, sizeof (Type), cmp); } inline void qsort (void) { - ::qsort (array, len, sizeof (Type), Type::cmp); + ::qsort (arrayZ, len, sizeof (Type), Type::cmp); } inline void qsort (unsigned int start, unsigned int end) { - ::qsort (array + start, end - start, sizeof (Type), Type::cmp); + ::qsort (arrayZ + start, end - start, sizeof (Type), Type::cmp); } template inline Type *lsearch (const T &x) { for (unsigned int i = 0; i < len; i++) - if (0 == this->array[i].cmp (&x)) - return &array[i]; + if (0 == this->arrayZ[i].cmp (&x)) + return &arrayZ[i]; return nullptr; } @@ -659,13 +659,13 @@ struct hb_vector_t inline Type *bsearch (const T &x) { unsigned int i; - return bfind (x, &i) ? &array[i] : nullptr; + return bfind (x, &i) ? &arrayZ[i] : nullptr; } template inline const Type *bsearch (const T &x) const { unsigned int i; - return bfind (x, &i) ? &array[i] : nullptr; + return bfind (x, &i) ? &arrayZ[i] : nullptr; } template inline bool bfind (const T &x, unsigned int *i) const @@ -674,7 +674,7 @@ struct hb_vector_t while (min <= max) { int mid = (min + max) / 2; - int c = this->array[mid].cmp (&x); + int c = this->arrayZ[mid].cmp (&x); if (c < 0) max = mid - 1; else if (c > 0) @@ -685,7 +685,7 @@ struct hb_vector_t return true; } } - if (max < 0 || (max < (int) this->len && this->array[max].cmp (&x) > 0)) + if (max < 0 || (max < (int) this->len && this->arrayZ[max].cmp (&x) > 0)) max++; *i = max; return false; @@ -693,9 +693,9 @@ struct hb_vector_t inline void fini (void) { - if (array != static_array) - free (array); - array = nullptr; + if (arrayZ != static_array) + free (arrayZ); + arrayZ = nullptr; allocated = len = 0; } }; diff --git a/src/hb-set-private.hh b/src/hb-set-private.hh index 149b89e2a..a4962bc76 100644 --- a/src/hb-set-private.hh +++ b/src/hb-set-private.hh @@ -374,8 +374,8 @@ struct hb_set_t if (!resize (count)) return; population = other->population; - memcpy (pages.array, other->pages.array, count * sizeof (pages.array[0])); - memcpy (page_map.array, other->page_map.array, count * sizeof (page_map.array[0])); + memcpy (pages.arrayZ, other->pages.arrayZ, count * sizeof (pages.arrayZ[0])); + memcpy (page_map.arrayZ, other->page_map.arrayZ, count * sizeof (page_map.arrayZ[0])); } inline bool is_equal (const hb_set_t *other) const diff --git a/src/hb-subset.cc b/src/hb-subset.cc index d6295a48f..98f95e021 100644 --- a/src/hb-subset.cc +++ b/src/hb-subset.cc @@ -157,7 +157,7 @@ _hb_subset_face_data_reference_blob (hb_subset_face_data_t *data) unsigned int face_length = table_count * 16 + 12; for (unsigned int i = 0; i < table_count; i++) - face_length += _hb_ceil_to_4 (hb_blob_get_length (data->tables.array[i].blob)); + face_length += _hb_ceil_to_4 (hb_blob_get_length (data->tables.arrayZ[i].blob)); char *buf = (char *) malloc (face_length); if (unlikely (!buf))