[HarfBuzz] harfbuzz: Branch 'master'
Behdad Esfahbod
behdad at kemper.freedesktop.org
Sun Nov 11 00:58:19 UTC 2018
src/hb-machinery.hh | 8 ++++----
src/hb-open-type.hh | 8 ++++++++
src/hb-ot-cmap-table.hh | 4 ++--
src/hb-ot-layout-gpos-table.hh | 4 ++--
src/hb-ot-var-avar-table.hh | 9 ++++-----
5 files changed, 20 insertions(+), 13 deletions(-)
New commits:
commit 1d66cdcf770e45d995a318592352e4349faecb71
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Sat Nov 10 19:54:08 2018 -0500
Better fix for MSVC 2008
Follow up on b4c61130324455bfd42095b01fa14ac901e441f1
Fixes https://github.com/harfbuzz/harfbuzz/issues/1374
diff --git a/src/hb-machinery.hh b/src/hb-machinery.hh
index f58050da..f8f1a5b5 100644
--- a/src/hb-machinery.hh
+++ b/src/hb-machinery.hh
@@ -110,17 +110,17 @@ static inline Type& StructAfter(TObject &X)
static const unsigned int min_size = (size)
#define DEFINE_SIZE_ARRAY(size, array) \
- DEFINE_INSTANCE_ASSERTION (sizeof (*this) == (size) + VAR * sizeof (array[0])); \
- DEFINE_COMPILES_ASSERTION ((void) array[0].static_size) \
+ DEFINE_INSTANCE_ASSERTION (sizeof (*this) == (size) + VAR * (array).item_size); \
+ DEFINE_COMPILES_ASSERTION ((void) (array)[0].static_size) \
enum { min_size = (size) }
#define DEFINE_SIZE_ARRAY_SIZED(size, array) \
- inline unsigned int get_size (void) const { return (size - array.min_size + array.get_size ()); } \
+ inline unsigned int get_size (void) const { return (size - (array).min_size + (array).get_size ()); } \
DEFINE_SIZE_ARRAY(size, array)
#define DEFINE_SIZE_ARRAY2(size, array1, array2) \
DEFINE_INSTANCE_ASSERTION (sizeof (*this) == (size) + sizeof (this->array1[0]) + sizeof (this->array2[0])); \
- DEFINE_COMPILES_ASSERTION ((void) array1[0].static_size; (void) array2[0].static_size) \
+ DEFINE_COMPILES_ASSERTION ((void) (array1)[0].static_size; (void) (array2)[0].static_size) \
static const unsigned int min_size = (size)
diff --git a/src/hb-open-type.hh b/src/hb-open-type.hh
index 56fa4334..14506180 100644
--- a/src/hb-open-type.hh
+++ b/src/hb-open-type.hh
@@ -335,6 +335,8 @@ static inline Type& operator + (Base &base, OffsetTo<Type, OffsetType, has_null>
template <typename Type>
struct UnsizedArrayOf
{
+ enum { item_size = Type::static_size };
+
HB_NO_CREATE_COPY_ASSIGN_TEMPLATE (UnsizedArrayOf, Type);
/* Unlikely other places, use "int i" instead of "unsigned int i" for our
@@ -435,6 +437,8 @@ struct UnsizedOffsetListOf : UnsizedOffsetArrayOf<Type, OffsetType, has_null>
template <typename Type, typename LenType=HBUINT16>
struct ArrayOf
{
+ enum { item_size = Type::static_size };
+
HB_NO_CREATE_COPY_ASSIGN_TEMPLATE2 (ArrayOf, Type, LenType);
inline const Type *sub_array (unsigned int start_offset, unsigned int *pcount /* IN/OUT */) const
@@ -603,6 +607,8 @@ struct OffsetListOf : OffsetArrayOf<Type>
template <typename Type, typename LenType=HBUINT16>
struct HeadlessArrayOf
{
+ enum { item_size = Type::static_size };
+
HB_NO_CREATE_COPY_ASSIGN_TEMPLATE2 (HeadlessArrayOf, Type, LenType);
inline const Type& operator [] (unsigned int i) const
@@ -801,6 +807,8 @@ struct VarSizedBinSearchHeader
template <typename Type>
struct VarSizedBinSearchArrayOf
{
+ enum { item_size = Type::static_size };
+
HB_NO_CREATE_COPY_ASSIGN_TEMPLATE (VarSizedBinSearchArrayOf, Type);
inline const Type& operator [] (unsigned int i) const
diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh
index 399c46bf..c0e08666 100644
--- a/src/hb-ot-cmap-table.hh
+++ b/src/hb-ot-cmap-table.hh
@@ -636,7 +636,7 @@ struct DefaultUVS : SortedArrayOf<UnicodeValueRange, HBUINT32>
}
public:
- DEFINE_SIZE_ARRAY (4, arrayZ);
+ DEFINE_SIZE_ARRAY (4, *this);
};
struct UVSMapping
@@ -668,7 +668,7 @@ struct NonDefaultUVS : SortedArrayOf<UVSMapping, HBUINT32>
}
public:
- DEFINE_SIZE_ARRAY (4, arrayZ);
+ DEFINE_SIZE_ARRAY (4, *this);
};
struct VariationSelectorRecord
diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh
index fc74af47..cf735c30 100644
--- a/src/hb-ot-layout-gpos-table.hh
+++ b/src/hb-ot-layout-gpos-table.hh
@@ -53,7 +53,7 @@ enum attach_type_t {
typedef HBUINT16 Value;
-typedef Value ValueRecord[VAR];
+typedef UnsizedArrayOf<Value> ValueRecord;
struct ValueFormat : HBUINT16
{
@@ -879,7 +879,7 @@ struct PairPosFormat2
unsigned int stride = len1 + len2;
unsigned int record_size = valueFormat1.get_size () + valueFormat2.get_size ();
unsigned int count = (unsigned int) class1Count * (unsigned int) class2Count;
- return_trace (c->check_array (values, count, record_size) &&
+ return_trace (c->check_array ((const void *) values, count, record_size) &&
valueFormat1.sanitize_values_stride_unsafe (c, this, &values[0], count, stride) &&
valueFormat2.sanitize_values_stride_unsafe (c, this, &values[len1], count, stride));
}
diff --git a/src/hb-ot-var-avar-table.hh b/src/hb-ot-var-avar-table.hh
index d100ca21..c2b110a2 100644
--- a/src/hb-ot-var-avar-table.hh
+++ b/src/hb-ot-var-avar-table.hh
@@ -94,7 +94,7 @@ struct SegmentMaps : ArrayOf<AxisValueMap>
}
public:
- DEFINE_SIZE_ARRAY (2, arrayZ);
+ DEFINE_SIZE_ARRAY (2, *this);
};
struct avar
@@ -109,7 +109,7 @@ struct avar
c->check_struct (this))))
return_trace (false);
- const SegmentMaps *map = axisSegmentMapsZ.arrayZ;
+ const SegmentMaps *map = &firstAxisSegmentMaps;
unsigned int count = axisCount;
for (unsigned int i = 0; i < count; i++)
{
@@ -125,7 +125,7 @@ struct avar
{
unsigned int count = MIN<unsigned int> (coords_length, axisCount);
- const SegmentMaps *map = axisSegmentMapsZ.arrayZ;
+ const SegmentMaps *map = &firstAxisSegmentMaps;
for (unsigned int i = 0; i < count; i++)
{
coords[i] = map->map (coords[i]);
@@ -140,8 +140,7 @@ struct avar
HBUINT16 axisCount; /* The number of variation axes in the font. This
* must be the same number as axisCount in the
* 'fvar' table. */
- UnsizedArrayOf<SegmentMaps>
- axisSegmentMapsZ;
+ SegmentMaps firstAxisSegmentMaps;
public:
DEFINE_SIZE_MIN (8);
More information about the HarfBuzz
mailing list