Better fix for MSVC 2008
Follow up on b4c6113032
Fixes https://github.com/harfbuzz/harfbuzz/issues/1374
This commit is contained in:
parent
b4c6113032
commit
1d66cdcf77
@ -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)
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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));
|
||||
}
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user