[hdmx] Minor

This commit is contained in:
Behdad Esfahbod 2018-11-16 01:55:39 -05:00
parent 9e9f16c92d
commit af727b4e62
1 changed files with 7 additions and 7 deletions

View File

@ -136,7 +136,7 @@ struct hdmx
inline const DeviceRecord& operator [] (unsigned int i) const inline const DeviceRecord& operator [] (unsigned int i) const
{ {
if (unlikely (i >= numRecords)) return Null (DeviceRecord); if (unlikely (i >= numRecords)) return Null (DeviceRecord);
return StructAtOffset<DeviceRecord> (&this->dataZ, i * sizeDeviceRecord); return StructAtOffset<DeviceRecord> (&this->firstDeviceRecord, i * sizeDeviceRecord);
} }
inline bool serialize (hb_serialize_context_t *c, const hdmx *source_hdmx, hb_subset_plan_t *plan) inline bool serialize (hb_serialize_context_t *c, const hdmx *source_hdmx, hb_subset_plan_t *plan)
@ -200,7 +200,7 @@ struct hdmx
inline bool sanitize (hb_sanitize_context_t *c) const inline bool sanitize (hb_sanitize_context_t *c) const
{ {
TRACE_SANITIZE (this); TRACE_SANITIZE (this);
return_trace (c->check_struct (this) && version == 0 && return_trace (c->check_struct (this) &&
!hb_unsigned_mul_overflows (numRecords, sizeDeviceRecord) && !hb_unsigned_mul_overflows (numRecords, sizeDeviceRecord) &&
sizeDeviceRecord >= DeviceRecord::min_size && sizeDeviceRecord >= DeviceRecord::min_size &&
c->check_range (this, get_size ())); c->check_range (this, get_size ()));
@ -210,9 +210,9 @@ struct hdmx
HBUINT16 version; /* Table version number (0) */ HBUINT16 version; /* Table version number (0) */
HBUINT16 numRecords; /* Number of device records. */ HBUINT16 numRecords; /* Number of device records. */
HBUINT32 sizeDeviceRecord; /* Size of a device record, 32-bit aligned. */ HBUINT32 sizeDeviceRecord; /* Size of a device record, 32-bit aligned. */
UnsizedArrayOf<HBUINT8> dataZ; /* Array of device records. */ DeviceRecord firstDeviceRecord; /* Array of device records. */
public: public:
DEFINE_SIZE_ARRAY (8, dataZ); DEFINE_SIZE_MIN (8);
}; };
} /* namespace OT */ } /* namespace OT */