Port rest from VAR to UnsizedArrayOf<>
diff --git a/src/hb-aat-layout-common.hh b/src/hb-aat-layout-common.hh
index 85c40a7..7a5be84 100644
--- a/src/hb-aat-layout-common.hh
+++ b/src/hb-aat-layout-common.hh
@@ -67,11 +67,11 @@
inline const Type& operator [] (unsigned int i) const
{
if (unlikely (i >= header.nUnits)) return Null(Type);
- return StructAtOffset<Type> (bytesZ, i * header.unitSize);
+ return StructAtOffset<Type> (&bytesZ, i * header.unitSize);
}
inline Type& operator [] (unsigned int i)
{
- return StructAtOffset<Type> (bytesZ, i * header.unitSize);
+ return StructAtOffset<Type> (&bytesZ, i * header.unitSize);
}
inline unsigned int get_size (void) const
{ return header.static_size + header.nUnits * header.unitSize; }
@@ -88,7 +88,7 @@
* pointed to do have a simple sanitize(), ie. they do not
* reference other structs via offsets.
*/
- (void) (false && StructAtOffset<Type> (bytesZ, 0).sanitize (c));
+ (void) (false && StructAtOffset<Type> (&bytesZ, 0).sanitize (c));
return_trace (true);
}
@@ -111,7 +111,7 @@
while (min <= max)
{
int mid = (min + max) / 2;
- const Type *p = (const Type *) (((const char *) bytesZ) + (mid * size));
+ const Type *p = (const Type *) (((const char *) &bytesZ) + (mid * size));
int c = p->cmp (key);
if (c < 0)
max = mid - 1;
@@ -129,12 +129,12 @@
TRACE_SANITIZE (this);
return_trace (header.sanitize (c) &&
Type::static_size >= header.unitSize &&
- c->check_array (bytesZ, header.nUnits, header.unitSize));
+ c->check_array (bytesZ.arrayZ, header.nUnits, header.unitSize));
}
protected:
- BinSearchHeader header;
- HBUINT8 bytesZ[VAR];
+ BinSearchHeader header;
+ UnsizedArrayOf<HBUINT8> bytesZ;
public:
DEFINE_SIZE_ARRAY (10, bytesZ);
};
diff --git a/src/hb-aat-layout-morx-table.hh b/src/hb-aat-layout-morx-table.hh
index 6f7bf77..e4774c4 100644
--- a/src/hb-aat-layout-morx-table.hh
+++ b/src/hb-aat-layout-morx-table.hh
@@ -619,7 +619,7 @@
{
inline void apply (hb_aat_apply_context_t *c) const
{
- const ChainSubtable *subtable = &StructAtOffset<ChainSubtable> (featureZ, featureZ[0].static_size * featureCount);
+ const ChainSubtable *subtable = &StructAtOffset<ChainSubtable> (&featureZ, featureZ[0].static_size * featureCount);
unsigned int count = subtableCount;
for (unsigned int i = 0; i < count; i++)
{
@@ -648,10 +648,10 @@
!c->check_range (this, length))
return_trace (false);
- if (!c->check_array (featureZ, featureCount))
+ if (!c->check_array (featureZ.arrayZ, featureCount))
return_trace (false);
- const ChainSubtable *subtable = &StructAtOffset<ChainSubtable> (featureZ, featureZ[0].static_size * featureCount);
+ const ChainSubtable *subtable = &StructAtOffset<ChainSubtable> (&featureZ, featureZ[0].static_size * featureCount);
unsigned int count = subtableCount;
for (unsigned int i = 0; i < count; i++)
{
@@ -669,8 +669,8 @@
HBUINT32 featureCount; /* Number of feature subtable entries. */
HBUINT32 subtableCount; /* The number of subtables in the chain. */
- Feature featureZ[VAR]; /* Features. */
-/*ChainSubtable subtableX[VAR];*//* Subtables. */
+ UnsizedArrayOf<Feature> featureZ; /* Features. */
+/*ChainSubtable firstSubtable;*//* Subtables. */
/*subtableGlyphCoverageArray*/ /* Only if major == 3. */
public:
@@ -689,7 +689,7 @@
inline void apply (hb_aat_apply_context_t *c) const
{
c->set_lookup_index (0);
- const Chain *chain = chainsZ;
+ const Chain *chain = &firstChain;
unsigned int count = chainCount;
for (unsigned int i = 0; i < count; i++)
{
@@ -706,7 +706,7 @@
!chainCount.sanitize (c))
return_trace (false);
- const Chain *chain = chainsZ;
+ const Chain *chain = &firstChain;
unsigned int count = chainCount;
for (unsigned int i = 0; i < count; i++)
{
@@ -723,7 +723,7 @@
* 1 for mort, 2 or 3 for morx. */
HBUINT32 chainCount; /* Number of metamorphosis chains contained in this
* table. */
- Chain chainsZ[VAR]; /* Chains. */
+ Chain firstChain; /* Chains. */
public:
DEFINE_SIZE_MIN (8);
diff --git a/src/hb-open-type.hh b/src/hb-open-type.hh
index 49e52c6..27ec772 100644
--- a/src/hb-open-type.hh
+++ b/src/hb-open-type.hh
@@ -349,7 +349,7 @@
}
public:
- Type arrayZ[VAR];
+ Type arrayZ[VAR];
public:
DEFINE_SIZE_ARRAY (0, arrayZ);
};
@@ -491,8 +491,8 @@
}
public:
- LenType len;
- Type arrayZ[VAR];
+ LenType len;
+ Type arrayZ[VAR];
public:
DEFINE_SIZE_ARRAY (sizeof (LenType), arrayZ);
};
@@ -600,8 +600,8 @@
}
public:
- LenType len;
- Type arrayZ[VAR];
+ LenType len;
+ Type arrayZ[VAR];
public:
DEFINE_SIZE_ARRAY (sizeof (LenType), arrayZ);
};
diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh
index e6876d1..3f5fa01 100644
--- a/src/hb-ot-cmap-table.hh
+++ b/src/hb-ot-cmap-table.hh
@@ -231,7 +231,7 @@
inline void init (const CmapSubtableFormat4 *subtable)
{
segCount = subtable->segCountX2 / 2;
- endCount = subtable->values;
+ endCount = subtable->values.arrayZ;
startCount = endCount + segCount + 1;
idDelta = startCount + segCount;
idRangeOffset = idDelta + segCount;
@@ -369,7 +369,8 @@
HBUINT16 entrySelector; /* log2(searchRange/2) */
HBUINT16 rangeShift; /* 2 x segCount - searchRange */
- HBUINT16 values[VAR];
+ UnsizedArrayOf<HBUINT16>
+ values;
#if 0
HBUINT16 endCount[segCount]; /* End characterCode for each segment,
* last=0xFFFFu. */
@@ -377,7 +378,8 @@
HBUINT16 startCount[segCount]; /* Start character code for each segment. */
HBINT16 idDelta[segCount]; /* Delta for all character codes in segment. */
HBUINT16 idRangeOffset[segCount];/* Offsets into glyphIdArray or 0 */
- HBUINT16 glyphIdArray[VAR]; /* Glyph index array (arbitrary length) */
+ UnsizedArrayOf<HBUINT16>
+ glyphIdArray; /* Glyph index array (arbitrary length) */
#endif
public:
diff --git a/src/hb-ot-color-cbdt-table.hh b/src/hb-ot-color-cbdt-table.hh
index a563697..7c172ce 100644
--- a/src/hb-ot-color-cbdt-table.hh
+++ b/src/hb-ot-color-cbdt-table.hh
@@ -128,7 +128,7 @@
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) &&
- c->check_array (offsetArrayZ, glyph_count + 1));
+ c->check_array (offsetArrayZ.arrayZ, glyph_count + 1));
}
bool get_image_data (unsigned int idx,
@@ -144,7 +144,8 @@
}
IndexSubtableHeader header;
- Offset<OffsetType> offsetArrayZ[VAR];
+ UnsizedArrayOf<Offset<OffsetType> >
+ offsetArrayZ;
public:
DEFINE_SIZE_ARRAY(8, offsetArrayZ);
};
@@ -240,7 +241,7 @@
inline bool sanitize (hb_sanitize_context_t *c, unsigned int count) const
{
TRACE_SANITIZE (this);
- if (unlikely (!c->check_array (indexSubtablesZ, count)))
+ if (unlikely (!c->check_array (indexSubtablesZ.arrayZ, count)))
return_trace (false);
for (unsigned int i = 0; i < count; i++)
if (unlikely (!indexSubtablesZ[i].sanitize (c, this)))
@@ -255,15 +256,14 @@
{
unsigned int firstGlyphIndex = indexSubtablesZ[i].firstGlyphIndex;
unsigned int lastGlyphIndex = indexSubtablesZ[i].lastGlyphIndex;
- if (firstGlyphIndex <= glyph && glyph <= lastGlyphIndex) {
+ if (firstGlyphIndex <= glyph && glyph <= lastGlyphIndex)
return &indexSubtablesZ[i];
- }
}
return nullptr;
}
protected:
- IndexSubtableRecord indexSubtablesZ[VAR];
+ UnsizedArrayOf<IndexSubtableRecord> indexSubtablesZ;
public:
DEFINE_SIZE_ARRAY(0, indexSubtablesZ);
};
@@ -527,8 +527,8 @@
protected:
- FixedVersion<> version;
- HBUINT8 dataZ[VAR];
+ FixedVersion<> version;
+ UnsizedArrayOf<HBUINT8> dataZ;
public:
DEFINE_SIZE_ARRAY(4, dataZ);
};
diff --git a/src/hb-ot-glyf-table.hh b/src/hb-ot-glyf-table.hh
index 7c20983..2145ac0 100644
--- a/src/hb-ot-glyf-table.hh
+++ b/src/hb-ot-glyf-table.hh
@@ -54,7 +54,7 @@
}
protected:
- HBUINT8 dataZ[VAR]; /* Location data. */
+ UnsizedArrayOf<HBUINT8> dataZ; /* Location data. */
DEFINE_SIZE_ARRAY (0, dataZ);
};
@@ -375,13 +375,13 @@
if (short_offset)
{
- const HBUINT16 *offsets = (const HBUINT16 *) loca_table->dataZ;
+ const HBUINT16 *offsets = (const HBUINT16 *) loca_table->dataZ.arrayZ;
*start_offset = 2 * offsets[glyph];
*end_offset = 2 * offsets[glyph + 1];
}
else
{
- const HBUINT32 *offsets = (const HBUINT32 *) loca_table->dataZ;
+ const HBUINT32 *offsets = (const HBUINT32 *) loca_table->dataZ.arrayZ;
*start_offset = offsets[glyph];
*end_offset = offsets[glyph + 1];
@@ -418,7 +418,7 @@
} while (composite_it.move_to_next());
if ( (uint16_t) last->flags & CompositeGlyphHeader::WE_HAVE_INSTRUCTIONS)
- *instruction_start = ((char *) last - (char *) glyf_table->dataZ) + last->get_size();
+ *instruction_start = ((char *) last - (char *) glyf_table->dataZ.arrayZ) + last->get_size();
else
*instruction_start = end_offset;
*instruction_end = end_offset;
@@ -483,7 +483,7 @@
};
protected:
- HBUINT8 dataZ[VAR]; /* Glyphs data. */
+ UnsizedArrayOf<HBUINT8> dataZ; /* Glyphs data. */
DEFINE_SIZE_ARRAY (0, dataZ);
};
diff --git a/src/hb-ot-hdmx-table.hh b/src/hb-ot-hdmx-table.hh
index 87dd6d0..04511b5 100644
--- a/src/hb-ot-hdmx-table.hh
+++ b/src/hb-ot-hdmx-table.hh
@@ -66,7 +66,7 @@
if (unlikely (i >= len())) return nullptr;
hb_codepoint_t gid = this->subset_plan->glyphs [i];
- const HBUINT8* width = &(this->source_device_record->widths[gid]);
+ const HBUINT8* width = &(this->source_device_record->widthsZ[gid]);
if (width < ((const HBUINT8 *) this->source_device_record) + size_device_record)
return width;
@@ -77,11 +77,7 @@
static inline unsigned int get_size (unsigned int count)
{
- unsigned int raw_size = min_size + count * HBUINT8::static_size;
- if (raw_size % 4)
- /* Align to 32 bits */
- return raw_size + (4 - (raw_size % 4));
- return raw_size;
+ return hb_ceil_to_4 (min_size + count * HBUINT8::static_size);
}
inline bool serialize (hb_serialize_context_t *c, const SubsetView &subset_view)
@@ -107,7 +103,7 @@
DEBUG_MSG(SUBSET, nullptr, "HDMX width for new gid %d is missing.", i);
return_trace (false);
}
- widths[i].set (*width);
+ widthsZ[i].set (*width);
}
return_trace (true);
@@ -120,11 +116,11 @@
c->check_range (this, size_device_record)));
}
- HBUINT8 pixel_size; /* Pixel size for following widths (as ppem). */
- HBUINT8 max_width; /* Maximum width. */
- HBUINT8 widths[VAR]; /* Array of widths (numGlyphs is from the 'maxp' table). */
+ HBUINT8 pixel_size; /* Pixel size for following widths (as ppem). */
+ HBUINT8 max_width; /* Maximum width. */
+ UnsizedArrayOf<HBUINT8> widthsZ; /* Array of widths (numGlyphs is from the 'maxp' table). */
public:
- DEFINE_SIZE_ARRAY (2, widths);
+ DEFINE_SIZE_ARRAY (2, widthsZ);
};
@@ -140,7 +136,7 @@
inline const DeviceRecord& operator [] (unsigned int i) const
{
if (unlikely (i >= num_records)) return Null(DeviceRecord);
- return StructAtOffset<DeviceRecord> (this->data, i * size_device_record);
+ return StructAtOffset<DeviceRecord> (&this->dataZ, i * size_device_record);
}
inline bool serialize (hb_serialize_context_t *c, const hdmx *source_hdmx, hb_subset_plan_t *plan)
@@ -211,12 +207,12 @@
}
protected:
- HBUINT16 version; /* Table version number (0) */
- HBUINT16 num_records; /* Number of device records. */
- HBUINT32 size_device_record; /* Size of a device record, 32-bit aligned. */
- HBUINT8 data[VAR]; /* Array of device records. */
+ HBUINT16 version; /* Table version number (0) */
+ HBUINT16 num_records; /* Number of device records. */
+ HBUINT32 size_device_record; /* Size of a device record, 32-bit aligned. */
+ UnsizedArrayOf<HBUINT8> dataZ; /* Array of device records. */
public:
- DEFINE_SIZE_ARRAY (8, data);
+ DEFINE_SIZE_ARRAY (8, dataZ);
};
} /* namespace OT */
diff --git a/src/hb-ot-hmtx-table.hh b/src/hb-ot-hmtx-table.hh
index 3e4b3bd..363395a 100644
--- a/src/hb-ot-hmtx-table.hh
+++ b/src/hb-ot-hmtx-table.hh
@@ -262,7 +262,7 @@
return default_advance;
}
- return table->longMetric[MIN (glyph, (uint32_t) num_advances - 1)].advance;
+ return table->longMetricZ[MIN (glyph, (uint32_t) num_advances - 1)].advance;
}
inline unsigned int get_advance (hb_codepoint_t glyph,
@@ -295,7 +295,7 @@
};
protected:
- LongMetric longMetric[VAR]; /* Paired advance width and leading
+ UnsizedArrayOf<LongMetric>longMetricZ;/* Paired advance width and leading
* bearing values for each glyph. The
* value numOfHMetrics comes from
* the 'hhea' table. If the font is
@@ -303,7 +303,7 @@
* be in the array, but that entry is
* required. The last entry applies to
* all subsequent glyphs. */
-/*FWORD leadingBearingX[VAR];*/ /* Here the advance is assumed
+/*UnsizedArrayOf<FWORD> leadingBearingX;*//* Here the advance is assumed
* to be the same as the advance
* for the last entry above. The
* number of entries in this array is
@@ -317,7 +317,7 @@
* font to vary the side bearing
* values for each glyph. */
public:
- DEFINE_SIZE_ARRAY (0, longMetric);
+ DEFINE_SIZE_ARRAY (0, longMetricZ);
};
struct hmtx : hmtxvmtx<hmtx, hhea> {
diff --git a/src/hb-ot-kern-table.hh b/src/hb-ot-kern-table.hh
index e9f109c..8ed6298 100644
--- a/src/hb-ot-kern-table.hh
+++ b/src/hb-ot-kern-table.hh
@@ -222,7 +222,7 @@
inline int get_h_kerning (hb_codepoint_t left, hb_codepoint_t right, unsigned int table_length) const
{
int v = 0;
- const typename T::SubTableWrapper *st = CastP<typename T::SubTableWrapper> (thiz()->data);
+ const typename T::SubTableWrapper *st = CastP<typename T::SubTableWrapper> (&thiz()->dataZ);
unsigned int count = thiz()->nTables;
for (unsigned int i = 0; i < count; i++)
{
@@ -241,7 +241,7 @@
thiz()->version != T::VERSION))
return_trace (false);
- const typename T::SubTableWrapper *st = CastP<typename T::SubTableWrapper> (thiz()->data);
+ const typename T::SubTableWrapper *st = CastP<typename T::SubTableWrapper> (&thiz()->dataZ);
unsigned int count = thiz()->nTables;
for (unsigned int i = 0; i < count; i++)
{
@@ -287,11 +287,11 @@
};
protected:
- HBUINT16 version; /* Version--0x0000u */
- HBUINT16 nTables; /* Number of subtables in the kerning table. */
- HBUINT8 data[VAR];
+ HBUINT16 version; /* Version--0x0000u */
+ HBUINT16 nTables; /* Number of subtables in the kerning table. */
+ UnsizedArrayOf<HBUINT8> dataZ;
public:
- DEFINE_SIZE_ARRAY (4, data);
+ DEFINE_SIZE_ARRAY (4, dataZ);
};
struct KernAAT : KernTable<KernAAT>
@@ -327,11 +327,11 @@
};
protected:
- HBUINT32 version; /* Version--0x00010000u */
- HBUINT32 nTables; /* Number of subtables in the kerning table. */
- HBUINT8 data[VAR];
+ HBUINT32 version; /* Version--0x00010000u */
+ HBUINT32 nTables; /* Number of subtables in the kerning table. */
+ UnsizedArrayOf<HBUINT8> dataZ;
public:
- DEFINE_SIZE_ARRAY (8, data);
+ DEFINE_SIZE_ARRAY (8, dataZ);
};
struct kern
diff --git a/src/hb-ot-layout-common.hh b/src/hb-ot-layout-common.hh
index e469ff8..8a3a703 100644
--- a/src/hb-ot-layout-common.hh
+++ b/src/hb-ot-layout-common.hh
@@ -1549,7 +1549,7 @@
HBUINT16 itemCount;
HBUINT16 shortCount;
ArrayOf<HBUINT16> regionIndices;
- HBUINT8 bytesX[VAR];
+ UnsizedArrayOf<HBUINT8>bytesX;
public:
DEFINE_SIZE_ARRAY2 (6, regionIndices, bytesX);
};
@@ -1844,7 +1844,7 @@
unsigned int s = ppem_size - startSize;
- unsigned int byte = deltaValue[s >> (4 - f)];
+ unsigned int byte = deltaValueZ[s >> (4 - f)];
unsigned int bits = (byte >> (16 - (((s & ((1 << (4 - f)) - 1)) + 1) << f)));
unsigned int mask = (0xFFFFu >> (16 - (1 << f)));
@@ -1864,9 +1864,10 @@
* 2 Signed 4-bit value, 4 values per uint16
* 3 Signed 8-bit value, 2 values per uint16
*/
- HBUINT16 deltaValue[VAR]; /* Array of compressed data */
+ UnsizedArrayOf<HBUINT16>
+ deltaValueZ; /* Array of compressed data */
public:
- DEFINE_SIZE_ARRAY (6, deltaValue);
+ DEFINE_SIZE_ARRAY (6, deltaValueZ);
};
struct VariationDevice
diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh
index b3651f9..1a96609 100644
--- a/src/hb-ot-layout-gpos-table.hh
+++ b/src/hb-ot-layout-gpos-table.hh
@@ -376,7 +376,7 @@
if (!c->check_struct (this)) return_trace (false);
if (unlikely (hb_unsigned_mul_overflows (rows, cols))) return_trace (false);
unsigned int count = rows * cols;
- if (!c->check_array (matrixZ, count)) return_trace (false);
+ if (!c->check_array (matrixZ.arrayZ, count)) return_trace (false);
for (unsigned int i = 0; i < count; i++)
if (!matrixZ[i].sanitize (c, this)) return_trace (false);
return_trace (true);
@@ -384,8 +384,8 @@
HBUINT16 rows; /* Number of rows */
protected:
- OffsetTo<Anchor>
- matrixZ[VAR]; /* Matrix of offsets to Anchor tables--
+ UnsizedArrayOf<OffsetTo<Anchor> >
+ matrixZ; /* Matrix of offsets to Anchor tables--
* from beginning of AnchorMatrix table */
public:
DEFINE_SIZE_ARRAY (2, matrixZ);
@@ -621,7 +621,7 @@
unsigned int len2 = valueFormats[1].get_len ();
unsigned int record_size = HBUINT16::static_size * (1 + len1 + len2);
- const PairValueRecord *record = CastP<PairValueRecord> (arrayZ);
+ const PairValueRecord *record = &firstPairValueRecord;
unsigned int count = len;
for (unsigned int i = 0; i < count; i++)
{
@@ -640,7 +640,7 @@
unsigned int len2 = valueFormats[1].get_len ();
unsigned int record_size = HBUINT16::static_size * (1 + len1 + len2);
- const PairValueRecord *record = CastP<PairValueRecord> (arrayZ);
+ const PairValueRecord *record = &firstPairValueRecord;
c->input->add_array (&record->secondGlyph, len, record_size);
}
@@ -654,7 +654,6 @@
unsigned int len2 = valueFormats[1].get_len ();
unsigned int record_size = HBUINT16::static_size * (1 + len1 + len2);
- const PairValueRecord *record_array = CastP<PairValueRecord> (arrayZ);
unsigned int count = len;
/* Hand-coded bsearch. */
@@ -665,7 +664,7 @@
while (min <= max)
{
int mid = (min + max) / 2;
- const PairValueRecord *record = &StructAtOffset<PairValueRecord> (record_array, record_size * mid);
+ const PairValueRecord *record = &StructAtOffset<PairValueRecord> (&firstPairValueRecord, record_size * mid);
hb_codepoint_t mid_x = record->secondGlyph;
if (x < mid_x)
max = mid - 1;
@@ -698,20 +697,21 @@
{
TRACE_SANITIZE (this);
if (!(c->check_struct (this)
- && c->check_array (arrayZ, len, HBUINT16::static_size * closure->stride))) return_trace (false);
+ && c->check_array (&firstPairValueRecord, len, HBUINT16::static_size * closure->stride))) return_trace (false);
unsigned int count = len;
- const PairValueRecord *record = CastP<PairValueRecord> (arrayZ);
+ const PairValueRecord *record = &firstPairValueRecord;
return_trace (closure->valueFormats[0].sanitize_values_stride_unsafe (c, closure->base, &record->values[0], count, closure->stride) &&
closure->valueFormats[1].sanitize_values_stride_unsafe (c, closure->base, &record->values[closure->len1], count, closure->stride));
}
protected:
- HBUINT16 len; /* Number of PairValueRecords */
- HBUINT16 arrayZ[VAR]; /* Array of PairValueRecords--ordered
- * by GlyphID of the second glyph */
+ HBUINT16 len; /* Number of PairValueRecords */
+ PairValueRecord firstPairValueRecord;
+ /* Array of PairValueRecords--ordered
+ * by GlyphID of the second glyph */
public:
- DEFINE_SIZE_ARRAY (2, arrayZ);
+ DEFINE_SIZE_MIN (2);
};
struct PairPosFormat1
diff --git a/src/hb-ot-math-table.hh b/src/hb-ot-math-table.hh
index 1b2d550..87ebdc7 100644
--- a/src/hb-ot-math-table.hh
+++ b/src/hb-ot-math-table.hh
@@ -234,7 +234,7 @@
TRACE_SANITIZE (this);
unsigned int count = 2 * heightCount + 1;
for (unsigned int i = 0; i < count; i++)
- if (!mathValueRecords[i].sanitize (c, this)) return_trace (false);
+ if (!mathValueRecordsZ.arrayZ[i].sanitize (c, this)) return_trace (false);
return_trace (true);
}
@@ -242,14 +242,14 @@
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) &&
- c->check_array (mathValueRecords, 2 * heightCount + 1) &&
+ c->check_array (mathValueRecordsZ.arrayZ, 2 * heightCount + 1) &&
sanitize_math_value_records (c));
}
inline hb_position_t get_value (hb_position_t correction_height, hb_font_t *font) const
{
- const MathValueRecord* correctionHeight = mathValueRecords;
- const MathValueRecord* kernValue = mathValueRecords + heightCount;
+ const MathValueRecord* correctionHeight = mathValueRecordsZ.arrayZ;
+ const MathValueRecord* kernValue = mathValueRecordsZ.arrayZ + heightCount;
int sign = font->y_scale < 0 ? -1 : +1;
/* The description of the MathKern table is a ambiguous, but interpreting
@@ -277,18 +277,19 @@
}
protected:
- HBUINT16 heightCount;
- MathValueRecord mathValueRecords[VAR]; /* Array of correction heights at
- * which the kern value changes.
- * Sorted by the height value in
- * design units (heightCount entries),
- * Followed by:
- * Array of kern values corresponding
- * to heights. (heightCount+1 entries).
- */
+ HBUINT16 heightCount;
+ UnsizedArrayOf<MathValueRecord>
+ mathValueRecordsZ; /* Array of correction heights at
+ * which the kern value changes.
+ * Sorted by the height value in
+ * design units (heightCount entries),
+ * Followed by:
+ * Array of kern values corresponding
+ * to heights. (heightCount+1 entries).
+ */
public:
- DEFINE_SIZE_ARRAY (2, mathValueRecords);
+ DEFINE_SIZE_ARRAY (2, mathValueRecordsZ);
};
struct MathKernInfoRecord
@@ -586,7 +587,7 @@
TRACE_SANITIZE (this);
unsigned int count = vertGlyphCount + horizGlyphCount;
for (unsigned int i = 0; i < count; i++)
- if (!glyphConstruction[i].sanitize (c, this)) return_trace (false);
+ if (!glyphConstruction.arrayZ[i].sanitize (c, this)) return_trace (false);
return_trace (true);
}
@@ -596,7 +597,7 @@
return_trace (c->check_struct (this) &&
vertGlyphCoverage.sanitize (c, this) &&
horizGlyphCoverage.sanitize (c, this) &&
- c->check_array (glyphConstruction, vertGlyphCount + horizGlyphCount) &&
+ c->check_array (glyphConstruction.arrayZ, vertGlyphCount + horizGlyphCount) &&
sanitize_offsets (c));
}
@@ -666,7 +667,8 @@
/* Array of offsets to MathGlyphConstruction tables - from the beginning of
the MathVariants table, for shapes growing in vertical/horizontal
direction. */
- OffsetTo<MathGlyphConstruction> glyphConstruction[VAR];
+ UnsizedArrayOf<OffsetTo<MathGlyphConstruction> >
+ glyphConstruction;
public:
DEFINE_SIZE_ARRAY (10, glyphConstruction);
diff --git a/src/hb-ot-maxp-table.hh b/src/hb-ot-maxp-table.hh
index efcf593..2572ad2 100644
--- a/src/hb-ot-maxp-table.hh
+++ b/src/hb-ot-maxp-table.hh
@@ -136,7 +136,7 @@
FixedVersion<>version; /* Version of the maxp table (0.5 or 1.0),
* 0x00005000u or 0x00010000u. */
HBUINT16 numGlyphs; /* The number of glyphs in the font. */
-/*maxpV1Tail v1Tail[VAR]; */
+/*maxpV1Tail v1Tail[VAR]; */
public:
DEFINE_SIZE_STATIC (6);
};
diff --git a/src/hb-ot-name-table.hh b/src/hb-ot-name-table.hh
index c1e7adb..bb49c2c 100644
--- a/src/hb-ot-name-table.hh
+++ b/src/hb-ot-name-table.hh
@@ -91,7 +91,7 @@
key.encodingID.set (encoding_id);
key.languageID.set (language_id);
key.nameID.set (name_id);
- NameRecord *match = (NameRecord *) bsearch (&key, nameRecord, count, sizeof (nameRecord[0]), NameRecord::cmp);
+ NameRecord *match = (NameRecord *) bsearch (&key, nameRecordZ.arrayZ, count, sizeof (nameRecordZ[0]), NameRecord::cmp);
if (!match)
return 0;
@@ -102,14 +102,14 @@
}
inline unsigned int get_size (void) const
- { return min_size + count * nameRecord[0].min_size; }
+ { return min_size + count * nameRecordZ[0].min_size; }
inline bool sanitize_records (hb_sanitize_context_t *c) const {
TRACE_SANITIZE (this);
char *string_pool = (char *) this + stringOffset;
unsigned int _count = count;
for (unsigned int i = 0; i < _count; i++)
- if (!nameRecord[i].sanitize (c, string_pool)) return_trace (false);
+ if (!nameRecordZ[i].sanitize (c, string_pool)) return_trace (false);
return_trace (true);
}
@@ -118,7 +118,7 @@
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) &&
likely (format == 0 || format == 1) &&
- c->check_array (nameRecord, count) &&
+ c->check_array (nameRecordZ.arrayZ, count) &&
sanitize_records (c));
}
@@ -126,9 +126,10 @@
HBUINT16 format; /* Format selector (=0/1). */
HBUINT16 count; /* Number of name records. */
Offset16 stringOffset; /* Offset to start of string storage (from start of table). */
- NameRecord nameRecord[VAR]; /* The name records where count is the number of records. */
+ UnsizedArrayOf<NameRecord>
+ nameRecordZ; /* The name records where count is the number of records. */
public:
- DEFINE_SIZE_ARRAY (6, nameRecord);
+ DEFINE_SIZE_ARRAY (6, nameRecordZ);
};
diff --git a/src/hb-ot-post-table.hh b/src/hb-ot-post-table.hh
index d0265d0..29dc86f 100644
--- a/src/hb-ot-post-table.hh
+++ b/src/hb-ot-post-table.hh
@@ -55,10 +55,11 @@
return_trace (glyphNameIndex.sanitize (c));
}
- ArrayOf<HBUINT16>glyphNameIndex; /* This is not an offset, but is the
+ ArrayOf<HBUINT16> glyphNameIndex; /* This is not an offset, but is the
* ordinal number of the glyph in 'post'
* string tables. */
- HBUINT8 namesX[VAR]; /* Glyph names with length bytes [variable]
+ UnsizedArrayOf<HBUINT8>
+ namesX; /* Glyph names with length bytes [variable]
* (a Pascal string). */
DEFINE_SIZE_ARRAY2 (2, glyphNameIndex, namesX);