提交 b4715901 编写于 作者: B Behdad Esfahbod

Define return_trace()

Not functional change (expected!).
上级 c917965b
...@@ -56,7 +56,7 @@ typedef struct TableRecord ...@@ -56,7 +56,7 @@ typedef struct TableRecord
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_RETURN (c->check_struct (this)); return_trace (c->check_struct (this));
} }
Tag tag; /* 4-byte identifier. */ Tag tag; /* 4-byte identifier. */
...@@ -106,7 +106,7 @@ typedef struct OffsetTable ...@@ -106,7 +106,7 @@ typedef struct OffsetTable
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_RETURN (c->check_struct (this) && c->check_array (tables, TableRecord::static_size, numTables)); return_trace (c->check_struct (this) && c->check_array (tables, TableRecord::static_size, numTables));
} }
protected: protected:
...@@ -135,7 +135,7 @@ struct TTCHeaderVersion1 ...@@ -135,7 +135,7 @@ struct TTCHeaderVersion1
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_RETURN (table.sanitize (c, this)); return_trace (table.sanitize (c, this));
} }
protected: protected:
...@@ -175,11 +175,11 @@ struct TTCHeader ...@@ -175,11 +175,11 @@ struct TTCHeader
inline bool sanitize (hb_sanitize_context_t *c) const inline bool sanitize (hb_sanitize_context_t *c) const
{ {
TRACE_SANITIZE (this); TRACE_SANITIZE (this);
if (unlikely (!u.header.version.sanitize (c))) return TRACE_RETURN (false); if (unlikely (!u.header.version.sanitize (c))) return_trace (false);
switch (u.header.version.major) { switch (u.header.version.major) {
case 2: /* version 2 is compatible with version 1 */ case 2: /* version 2 is compatible with version 1 */
case 1: return TRACE_RETURN (u.version1.sanitize (c)); case 1: return_trace (u.version1.sanitize (c));
default:return TRACE_RETURN (true); default:return_trace (true);
} }
} }
...@@ -240,14 +240,14 @@ struct OpenTypeFontFile ...@@ -240,14 +240,14 @@ struct OpenTypeFontFile
inline bool sanitize (hb_sanitize_context_t *c) const inline bool sanitize (hb_sanitize_context_t *c) const
{ {
TRACE_SANITIZE (this); TRACE_SANITIZE (this);
if (unlikely (!u.tag.sanitize (c))) return TRACE_RETURN (false); if (unlikely (!u.tag.sanitize (c))) return_trace (false);
switch (u.tag) { switch (u.tag) {
case CFFTag: /* All the non-collection tags */ case CFFTag: /* All the non-collection tags */
case TrueTag: case TrueTag:
case Typ1Tag: case Typ1Tag:
case TrueTypeTag: return TRACE_RETURN (u.fontFace.sanitize (c)); case TrueTypeTag: return_trace (u.fontFace.sanitize (c));
case TTCTag: return TRACE_RETURN (u.ttcHeader.sanitize (c)); case TTCTag: return_trace (u.ttcHeader.sanitize (c));
default: return TRACE_RETURN (true); default: return_trace (true);
} }
} }
......
...@@ -624,7 +624,7 @@ struct IntType ...@@ -624,7 +624,7 @@ struct IntType
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_RETURN (likely (c->check_struct (this))); return_trace (likely (c->check_struct (this)));
} }
protected: protected:
BEInt<Type, Size> v; BEInt<Type, Size> v;
...@@ -652,7 +652,7 @@ struct LONGDATETIME ...@@ -652,7 +652,7 @@ struct LONGDATETIME
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_RETURN (likely (c->check_struct (this))); return_trace (likely (c->check_struct (this)));
} }
protected: protected:
LONG major; LONG major;
...@@ -729,7 +729,7 @@ struct FixedVersion ...@@ -729,7 +729,7 @@ struct FixedVersion
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_RETURN (c->check_struct (this)); return_trace (c->check_struct (this));
} }
USHORT major; USHORT major;
...@@ -765,21 +765,21 @@ struct OffsetTo : Offset<OffsetType> ...@@ -765,21 +765,21 @@ struct OffsetTo : Offset<OffsetType>
inline bool sanitize (hb_sanitize_context_t *c, const void *base) const inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
{ {
TRACE_SANITIZE (this); TRACE_SANITIZE (this);
if (unlikely (!c->check_struct (this))) return TRACE_RETURN (false); if (unlikely (!c->check_struct (this))) return_trace (false);
unsigned int offset = *this; unsigned int offset = *this;
if (unlikely (!offset)) return TRACE_RETURN (true); if (unlikely (!offset)) return_trace (true);
const Type &obj = StructAtOffset<Type> (base, offset); const Type &obj = StructAtOffset<Type> (base, offset);
return TRACE_RETURN (likely (obj.sanitize (c)) || neuter (c)); return_trace (likely (obj.sanitize (c)) || neuter (c));
} }
template <typename T> template <typename T>
inline bool sanitize (hb_sanitize_context_t *c, const void *base, T user_data) const inline bool sanitize (hb_sanitize_context_t *c, const void *base, T user_data) const
{ {
TRACE_SANITIZE (this); TRACE_SANITIZE (this);
if (unlikely (!c->check_struct (this))) return TRACE_RETURN (false); if (unlikely (!c->check_struct (this))) return_trace (false);
unsigned int offset = *this; unsigned int offset = *this;
if (unlikely (!offset)) return TRACE_RETURN (true); if (unlikely (!offset)) return_trace (true);
const Type &obj = StructAtOffset<Type> (base, offset); const Type &obj = StructAtOffset<Type> (base, offset);
return TRACE_RETURN (likely (obj.sanitize (c, user_data)) || neuter (c)); return_trace (likely (obj.sanitize (c, user_data)) || neuter (c));
} }
/* Set the offset to Null */ /* Set the offset to Null */
...@@ -830,10 +830,10 @@ struct ArrayOf ...@@ -830,10 +830,10 @@ struct ArrayOf
unsigned int items_len) unsigned int items_len)
{ {
TRACE_SERIALIZE (this); TRACE_SERIALIZE (this);
if (unlikely (!c->extend_min (*this))) return TRACE_RETURN (false); if (unlikely (!c->extend_min (*this))) return_trace (false);
len.set (items_len); /* TODO(serialize) Overflow? */ len.set (items_len); /* TODO(serialize) Overflow? */
if (unlikely (!c->extend (*this))) return TRACE_RETURN (false); if (unlikely (!c->extend (*this))) return_trace (false);
return TRACE_RETURN (true); return_trace (true);
} }
inline bool serialize (hb_serialize_context_t *c, inline bool serialize (hb_serialize_context_t *c,
...@@ -841,17 +841,17 @@ struct ArrayOf ...@@ -841,17 +841,17 @@ struct ArrayOf
unsigned int items_len) unsigned int items_len)
{ {
TRACE_SERIALIZE (this); TRACE_SERIALIZE (this);
if (unlikely (!serialize (c, items_len))) return TRACE_RETURN (false); if (unlikely (!serialize (c, items_len))) return_trace (false);
for (unsigned int i = 0; i < items_len; i++) for (unsigned int i = 0; i < items_len; i++)
array[i] = items[i]; array[i] = items[i];
items.advance (items_len); items.advance (items_len);
return TRACE_RETURN (true); return_trace (true);
} }
inline bool sanitize (hb_sanitize_context_t *c) const inline bool sanitize (hb_sanitize_context_t *c) const
{ {
TRACE_SANITIZE (this); TRACE_SANITIZE (this);
if (unlikely (!sanitize_shallow (c))) return TRACE_RETURN (false); if (unlikely (!sanitize_shallow (c))) return_trace (false);
/* Note: for structs that do not reference other structs, /* Note: for structs that do not reference other structs,
* we do not need to call their sanitize() as we already did * we do not need to call their sanitize() as we already did
...@@ -862,28 +862,28 @@ struct ArrayOf ...@@ -862,28 +862,28 @@ struct ArrayOf
*/ */
(void) (false && array[0].sanitize (c)); (void) (false && array[0].sanitize (c));
return TRACE_RETURN (true); return_trace (true);
} }
inline bool sanitize (hb_sanitize_context_t *c, const void *base) const inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
{ {
TRACE_SANITIZE (this); TRACE_SANITIZE (this);
if (unlikely (!sanitize_shallow (c))) return TRACE_RETURN (false); if (unlikely (!sanitize_shallow (c))) return_trace (false);
unsigned int count = len; unsigned int count = len;
for (unsigned int i = 0; i < count; i++) for (unsigned int i = 0; i < count; i++)
if (unlikely (!array[i].sanitize (c, base))) if (unlikely (!array[i].sanitize (c, base)))
return TRACE_RETURN (false); return_trace (false);
return TRACE_RETURN (true); return_trace (true);
} }
template <typename T> template <typename T>
inline bool sanitize (hb_sanitize_context_t *c, const void *base, T user_data) const inline bool sanitize (hb_sanitize_context_t *c, const void *base, T user_data) const
{ {
TRACE_SANITIZE (this); TRACE_SANITIZE (this);
if (unlikely (!sanitize_shallow (c))) return TRACE_RETURN (false); if (unlikely (!sanitize_shallow (c))) return_trace (false);
unsigned int count = len; unsigned int count = len;
for (unsigned int i = 0; i < count; i++) for (unsigned int i = 0; i < count; i++)
if (unlikely (!array[i].sanitize (c, base, user_data))) if (unlikely (!array[i].sanitize (c, base, user_data)))
return TRACE_RETURN (false); return_trace (false);
return TRACE_RETURN (true); return_trace (true);
} }
template <typename SearchType> template <typename SearchType>
...@@ -900,7 +900,7 @@ struct ArrayOf ...@@ -900,7 +900,7 @@ struct ArrayOf
inline bool sanitize_shallow (hb_sanitize_context_t *c) const inline bool sanitize_shallow (hb_sanitize_context_t *c) const
{ {
TRACE_SANITIZE (this); TRACE_SANITIZE (this);
return TRACE_RETURN (c->check_struct (this) && c->check_array (this, Type::static_size, len)); return_trace (c->check_struct (this) && c->check_array (this, Type::static_size, len));
} }
public: public:
...@@ -927,13 +927,13 @@ struct OffsetListOf : OffsetArrayOf<Type> ...@@ -927,13 +927,13 @@ struct OffsetListOf : OffsetArrayOf<Type>
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_RETURN (OffsetArrayOf<Type>::sanitize (c, this)); return_trace (OffsetArrayOf<Type>::sanitize (c, this));
} }
template <typename T> template <typename T>
inline bool sanitize (hb_sanitize_context_t *c, T user_data) const inline bool sanitize (hb_sanitize_context_t *c, T user_data) const
{ {
TRACE_SANITIZE (this); TRACE_SANITIZE (this);
return TRACE_RETURN (OffsetArrayOf<Type>::sanitize (c, this, user_data)); return_trace (OffsetArrayOf<Type>::sanitize (c, this, user_data));
} }
}; };
...@@ -955,14 +955,14 @@ struct HeadlessArrayOf ...@@ -955,14 +955,14 @@ struct HeadlessArrayOf
unsigned int items_len) unsigned int items_len)
{ {
TRACE_SERIALIZE (this); TRACE_SERIALIZE (this);
if (unlikely (!c->extend_min (*this))) return TRACE_RETURN (false); if (unlikely (!c->extend_min (*this))) return_trace (false);
len.set (items_len); /* TODO(serialize) Overflow? */ len.set (items_len); /* TODO(serialize) Overflow? */
if (unlikely (!items_len)) return TRACE_RETURN (true); if (unlikely (!items_len)) return_trace (true);
if (unlikely (!c->extend (*this))) return TRACE_RETURN (false); if (unlikely (!c->extend (*this))) return_trace (false);
for (unsigned int i = 0; i < items_len - 1; i++) for (unsigned int i = 0; i < items_len - 1; i++)
array[i] = items[i]; array[i] = items[i];
items.advance (items_len - 1); items.advance (items_len - 1);
return TRACE_RETURN (true); return_trace (true);
} }
inline bool sanitize_shallow (hb_sanitize_context_t *c) const inline bool sanitize_shallow (hb_sanitize_context_t *c) const
...@@ -974,7 +974,7 @@ struct HeadlessArrayOf ...@@ -974,7 +974,7 @@ struct HeadlessArrayOf
inline bool sanitize (hb_sanitize_context_t *c) const inline bool sanitize (hb_sanitize_context_t *c) const
{ {
TRACE_SANITIZE (this); TRACE_SANITIZE (this);
if (unlikely (!sanitize_shallow (c))) return TRACE_RETURN (false); if (unlikely (!sanitize_shallow (c))) return_trace (false);
/* Note: for structs that do not reference other structs, /* Note: for structs that do not reference other structs,
* we do not need to call their sanitize() as we already did * we do not need to call their sanitize() as we already did
...@@ -985,7 +985,7 @@ struct HeadlessArrayOf ...@@ -985,7 +985,7 @@ struct HeadlessArrayOf
*/ */
(void) (false && array[0].sanitize (c)); (void) (false && array[0].sanitize (c));
return TRACE_RETURN (true); return_trace (true);
} }
LenType len; LenType len;
......
...@@ -54,7 +54,7 @@ struct CmapSubtableFormat0 ...@@ -54,7 +54,7 @@ struct CmapSubtableFormat0
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_RETURN (c->check_struct (this)); return_trace (c->check_struct (this));
} }
protected: protected:
...@@ -130,7 +130,7 @@ struct CmapSubtableFormat4 ...@@ -130,7 +130,7 @@ struct CmapSubtableFormat4
{ {
TRACE_SANITIZE (this); TRACE_SANITIZE (this);
if (unlikely (!c->check_struct (this))) if (unlikely (!c->check_struct (this)))
return TRACE_RETURN (false); return_trace (false);
if (unlikely (!c->check_range (this, length))) if (unlikely (!c->check_range (this, length)))
{ {
...@@ -141,10 +141,10 @@ struct CmapSubtableFormat4 ...@@ -141,10 +141,10 @@ struct CmapSubtableFormat4
(uintptr_t) (c->end - (uintptr_t) (c->end -
(char *) this)); (char *) this));
if (!c->try_set (&length, new_length)) if (!c->try_set (&length, new_length))
return TRACE_RETURN (false); return_trace (false);
} }
return TRACE_RETURN (16 + 4 * (unsigned int) segCountX2 <= length); return_trace (16 + 4 * (unsigned int) segCountX2 <= length);
} }
protected: protected:
...@@ -187,7 +187,7 @@ struct CmapSubtableLongGroup ...@@ -187,7 +187,7 @@ struct CmapSubtableLongGroup
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_RETURN (c->check_struct (this)); return_trace (c->check_struct (this));
} }
private: private:
...@@ -215,7 +215,7 @@ struct CmapSubtableTrimmed ...@@ -215,7 +215,7 @@ struct CmapSubtableTrimmed
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_RETURN (c->check_struct (this) && glyphIdArray.sanitize (c)); return_trace (c->check_struct (this) && glyphIdArray.sanitize (c));
} }
protected: protected:
...@@ -248,7 +248,7 @@ struct CmapSubtableLongSegmented ...@@ -248,7 +248,7 @@ struct CmapSubtableLongSegmented
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_RETURN (c->check_struct (this) && groups.sanitize (c)); return_trace (c->check_struct (this) && groups.sanitize (c));
} }
protected: protected:
...@@ -295,7 +295,7 @@ struct UnicodeValueRange ...@@ -295,7 +295,7 @@ struct UnicodeValueRange
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_RETURN (c->check_struct (this)); return_trace (c->check_struct (this));
} }
UINT24 startUnicodeValue; /* First value in this range. */ UINT24 startUnicodeValue; /* First value in this range. */
...@@ -317,7 +317,7 @@ struct UVSMapping ...@@ -317,7 +317,7 @@ struct UVSMapping
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_RETURN (c->check_struct (this)); return_trace (c->check_struct (this));
} }
UINT24 unicodeValue; /* Base Unicode value of the UVS */ UINT24 unicodeValue; /* Base Unicode value of the UVS */
...@@ -357,7 +357,7 @@ struct VariationSelectorRecord ...@@ -357,7 +357,7 @@ struct VariationSelectorRecord
inline bool sanitize (hb_sanitize_context_t *c, const void *base) const inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
{ {
TRACE_SANITIZE (this); TRACE_SANITIZE (this);
return TRACE_RETURN (c->check_struct (this) && return_trace (c->check_struct (this) &&
defaultUVS.sanitize (c, base) && defaultUVS.sanitize (c, base) &&
nonDefaultUVS.sanitize (c, base)); nonDefaultUVS.sanitize (c, base));
} }
...@@ -383,7 +383,7 @@ struct CmapSubtableFormat14 ...@@ -383,7 +383,7 @@ struct CmapSubtableFormat14
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_RETURN (c->check_struct (this) && return_trace (c->check_struct (this) &&
record.sanitize (c, this)); record.sanitize (c, this));
} }
...@@ -429,16 +429,16 @@ struct CmapSubtable ...@@ -429,16 +429,16 @@ struct CmapSubtable
inline bool sanitize (hb_sanitize_context_t *c) const inline bool sanitize (hb_sanitize_context_t *c) const
{ {
TRACE_SANITIZE (this); TRACE_SANITIZE (this);
if (!u.format.sanitize (c)) return TRACE_RETURN (false); if (!u.format.sanitize (c)) return_trace (false);
switch (u.format) { switch (u.format) {
case 0: return TRACE_RETURN (u.format0 .sanitize (c)); case 0: return_trace (u.format0 .sanitize (c));
case 4: return TRACE_RETURN (u.format4 .sanitize (c)); case 4: return_trace (u.format4 .sanitize (c));
case 6: return TRACE_RETURN (u.format6 .sanitize (c)); case 6: return_trace (u.format6 .sanitize (c));
case 10: return TRACE_RETURN (u.format10.sanitize (c)); case 10: return_trace (u.format10.sanitize (c));
case 12: return TRACE_RETURN (u.format12.sanitize (c)); case 12: return_trace (u.format12.sanitize (c));
case 13: return TRACE_RETURN (u.format13.sanitize (c)); case 13: return_trace (u.format13.sanitize (c));
case 14: return TRACE_RETURN (u.format14.sanitize (c)); case 14: return_trace (u.format14.sanitize (c));
default:return TRACE_RETURN (true); default:return_trace (true);
} }
} }
...@@ -473,7 +473,7 @@ struct EncodingRecord ...@@ -473,7 +473,7 @@ struct EncodingRecord
inline bool sanitize (hb_sanitize_context_t *c, const void *base) const inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
{ {
TRACE_SANITIZE (this); TRACE_SANITIZE (this);
return TRACE_RETURN (c->check_struct (this) && return_trace (c->check_struct (this) &&
subtable.sanitize (c, base)); subtable.sanitize (c, base));
} }
...@@ -509,7 +509,7 @@ struct cmap ...@@ -509,7 +509,7 @@ struct cmap
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_RETURN (c->check_struct (this) && return_trace (c->check_struct (this) &&
likely (version == 0) && likely (version == 0) &&
encodingRecord.sanitize (c, this)); encodingRecord.sanitize (c, this));
} }
......
...@@ -47,7 +47,7 @@ struct loca ...@@ -47,7 +47,7 @@ struct loca
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_RETURN (true); return_trace (true);
} }
public: public:
...@@ -75,7 +75,7 @@ struct glyf ...@@ -75,7 +75,7 @@ struct glyf
TRACE_SANITIZE (this); TRACE_SANITIZE (this);
/* We don't check for anything specific here. The users of the /* We don't check for anything specific here. The users of the
* struct do all the hard work... */ * struct do all the hard work... */
return TRACE_RETURN (true); return_trace (true);
} }
public: public:
......
...@@ -55,7 +55,7 @@ struct head ...@@ -55,7 +55,7 @@ struct head
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_RETURN (c->check_struct (this) && likely (version.major == 1)); return_trace (c->check_struct (this) && likely (version.major == 1));
} }
protected: protected:
......
...@@ -52,7 +52,7 @@ struct _hea ...@@ -52,7 +52,7 @@ struct _hea
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_RETURN (c->check_struct (this) && likely (version.major == 1)); return_trace (c->check_struct (this) && likely (version.major == 1));
} }
public: public:
......
...@@ -62,7 +62,7 @@ struct _mtx ...@@ -62,7 +62,7 @@ struct _mtx
TRACE_SANITIZE (this); TRACE_SANITIZE (this);
/* We don't check for anything specific here. The users of the /* We don't check for anything specific here. The users of the
* struct do all the hard work... */ * struct do all the hard work... */
return TRACE_RETURN (true); return_trace (true);
} }
public: public:
......
...@@ -75,7 +75,7 @@ struct Record ...@@ -75,7 +75,7 @@ struct Record
{ {
TRACE_SANITIZE (this); TRACE_SANITIZE (this);
const sanitize_closure_t closure = {tag, base}; const sanitize_closure_t closure = {tag, base};
return TRACE_RETURN (c->check_struct (this) && offset.sanitize (c, base, &closure)); return_trace (c->check_struct (this) && offset.sanitize (c, base, &closure));
} }
Tag tag; /* 4-byte Tag identifier */ Tag tag; /* 4-byte Tag identifier */
...@@ -131,7 +131,7 @@ struct RecordListOf : RecordArrayOf<Type> ...@@ -131,7 +131,7 @@ struct RecordListOf : RecordArrayOf<Type>
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_RETURN (RecordArrayOf<Type>::sanitize (c, this)); return_trace (RecordArrayOf<Type>::sanitize (c, this));
} }
}; };
...@@ -145,7 +145,7 @@ struct RangeRecord ...@@ -145,7 +145,7 @@ struct RangeRecord
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_RETURN (c->check_struct (this)); return_trace (c->check_struct (this));
} }
inline bool intersects (const hb_set_t *glyphs) const { inline bool intersects (const hb_set_t *glyphs) const {
...@@ -211,7 +211,7 @@ struct LangSys ...@@ -211,7 +211,7 @@ struct LangSys
const Record<LangSys>::sanitize_closure_t * = NULL) const const Record<LangSys>::sanitize_closure_t * = NULL) const
{ {
TRACE_SANITIZE (this); TRACE_SANITIZE (this);
return TRACE_RETURN (c->check_struct (this) && featureIndex.sanitize (c)); return_trace (c->check_struct (this) && featureIndex.sanitize (c));
} }
Offset<> lookupOrderZ; /* = Null (reserved for an offset to a Offset<> lookupOrderZ; /* = Null (reserved for an offset to a
...@@ -251,7 +251,7 @@ struct Script ...@@ -251,7 +251,7 @@ struct Script
const Record<Script>::sanitize_closure_t * = NULL) const const Record<Script>::sanitize_closure_t * = NULL) const
{ {
TRACE_SANITIZE (this); TRACE_SANITIZE (this);
return TRACE_RETURN (defaultLangSys.sanitize (c, this) && langSys.sanitize (c, this)); return_trace (defaultLangSys.sanitize (c, this) && langSys.sanitize (c, this));
} }
protected: protected:
...@@ -274,7 +274,7 @@ struct FeatureParamsSize ...@@ -274,7 +274,7 @@ struct FeatureParamsSize
inline bool sanitize (hb_sanitize_context_t *c) const inline bool sanitize (hb_sanitize_context_t *c) const
{ {
TRACE_SANITIZE (this); TRACE_SANITIZE (this);
if (unlikely (!c->check_struct (this))) return TRACE_RETURN (false); if (unlikely (!c->check_struct (this))) return_trace (false);
/* This subtable has some "history", if you will. Some earlier versions of /* This subtable has some "history", if you will. Some earlier versions of
* Adobe tools calculated the offset of the FeatureParams sutable from the * Adobe tools calculated the offset of the FeatureParams sutable from the
...@@ -326,19 +326,19 @@ struct FeatureParamsSize ...@@ -326,19 +326,19 @@ struct FeatureParamsSize
*/ */
if (!designSize) if (!designSize)
return TRACE_RETURN (false); return_trace (false);
else if (subfamilyID == 0 && else if (subfamilyID == 0 &&
subfamilyNameID == 0 && subfamilyNameID == 0 &&
rangeStart == 0 && rangeStart == 0 &&
rangeEnd == 0) rangeEnd == 0)
return TRACE_RETURN (true); return_trace (true);
else if (designSize < rangeStart || else if (designSize < rangeStart ||
designSize > rangeEnd || designSize > rangeEnd ||
subfamilyNameID < 256 || subfamilyNameID < 256 ||
subfamilyNameID > 32767) subfamilyNameID > 32767)
return TRACE_RETURN (false); return_trace (false);
else else
return TRACE_RETURN (true); return_trace (true);
} }
USHORT designSize; /* Represents the design size in 720/inch USHORT designSize; /* Represents the design size in 720/inch
...@@ -388,7 +388,7 @@ struct FeatureParamsStylisticSet ...@@ -388,7 +388,7 @@ struct FeatureParamsStylisticSet
TRACE_SANITIZE (this); TRACE_SANITIZE (this);
/* Right now minorVersion is at zero. Which means, any table supports /* Right now minorVersion is at zero. Which means, any table supports
* the uiNameID field. */ * the uiNameID field. */
return TRACE_RETURN (c->check_struct (this)); return_trace (c->check_struct (this));
} }
USHORT version; /* (set to 0): This corresponds to a “minor” USHORT version; /* (set to 0): This corresponds to a “minor”
...@@ -420,7 +420,7 @@ struct FeatureParamsCharacterVariants ...@@ -420,7 +420,7 @@ struct FeatureParamsCharacterVariants
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_RETURN (c->check_struct (this) && return_trace (c->check_struct (this) &&
characters.sanitize (c)); characters.sanitize (c));
} }
...@@ -462,12 +462,12 @@ struct FeatureParams ...@@ -462,12 +462,12 @@ struct FeatureParams
{ {
TRACE_SANITIZE (this); TRACE_SANITIZE (this);
if (tag == HB_TAG ('s','i','z','e')) if (tag == HB_TAG ('s','i','z','e'))
return TRACE_RETURN (u.size.sanitize (c)); return_trace (u.size.sanitize (c));
if ((tag & 0xFFFF0000u) == HB_TAG ('s','s','\0','\0')) /* ssXX */ if ((tag & 0xFFFF0000u) == HB_TAG ('s','s','\0','\0')) /* ssXX */
return TRACE_RETURN (u.stylisticSet.sanitize (c)); return_trace (u.stylisticSet.sanitize (c));
if ((tag & 0xFFFF0000u) == HB_TAG ('c','v','\0','\0')) /* cvXX */ if ((tag & 0xFFFF0000u) == HB_TAG ('c','v','\0','\0')) /* cvXX */
return TRACE_RETURN (u.characterVariants.sanitize (c)); return_trace (u.characterVariants.sanitize (c));
return TRACE_RETURN (true); return_trace (true);
} }
inline const FeatureParamsSize& get_size_params (hb_tag_t tag) const inline const FeatureParamsSize& get_size_params (hb_tag_t tag) const
...@@ -505,7 +505,7 @@ struct Feature ...@@ -505,7 +505,7 @@ struct Feature
{ {
TRACE_SANITIZE (this); TRACE_SANITIZE (this);
if (unlikely (!(c->check_struct (this) && lookupIndex.sanitize (c)))) if (unlikely (!(c->check_struct (this) && lookupIndex.sanitize (c))))
return TRACE_RETURN (false); return_trace (false);
/* Some earlier versions of Adobe tools calculated the offset of the /* Some earlier versions of Adobe tools calculated the offset of the
* FeatureParams subtable from the beginning of the FeatureList table! * FeatureParams subtable from the beginning of the FeatureList table!
...@@ -520,10 +520,10 @@ struct Feature ...@@ -520,10 +520,10 @@ struct Feature
OffsetTo<FeatureParams> orig_offset = featureParams; OffsetTo<FeatureParams> orig_offset = featureParams;
if (unlikely (!featureParams.sanitize (c, this, closure ? closure->tag : HB_TAG_NONE))) if (unlikely (!featureParams.sanitize (c, this, closure ? closure->tag : HB_TAG_NONE)))
return TRACE_RETURN (false); return_trace (false);
if (likely (orig_offset.is_null ())) if (likely (orig_offset.is_null ()))
return TRACE_RETURN (true); return_trace (true);
if (featureParams == 0 && closure && if (featureParams == 0 && closure &&
closure->tag == HB_TAG ('s','i','z','e') && closure->tag == HB_TAG ('s','i','z','e') &&
...@@ -538,10 +538,10 @@ struct Feature ...@@ -538,10 +538,10 @@ struct Feature
if (new_offset == new_offset_int && if (new_offset == new_offset_int &&
c->try_set (&featureParams, new_offset) && c->try_set (&featureParams, new_offset) &&
!featureParams.sanitize (c, this, closure ? closure->tag : HB_TAG_NONE)) !featureParams.sanitize (c, this, closure ? closure->tag : HB_TAG_NONE))
return TRACE_RETURN (false); return_trace (false);
} }
return TRACE_RETURN (true); return_trace (true);
} }
OffsetTo<FeatureParams> OffsetTo<FeatureParams>
...@@ -613,9 +613,9 @@ struct Lookup ...@@ -613,9 +613,9 @@ struct Lookup
for (unsigned int i = 0; i < count; i++) { for (unsigned int i = 0; i < count; i++) {
typename context_t::return_t r = get_subtable<SubTableType> (i).dispatch (c, lookup_type); typename context_t::return_t r = get_subtable<SubTableType> (i).dispatch (c, lookup_type);
if (c->stop_sublookup_iteration (r)) if (c->stop_sublookup_iteration (r))
return TRACE_RETURN (r); return_trace (r);
} }
return TRACE_RETURN (c->default_return_value ()); return_trace (c->default_return_value ());
} }
inline bool serialize (hb_serialize_context_t *c, inline bool serialize (hb_serialize_context_t *c,
...@@ -624,29 +624,29 @@ struct Lookup ...@@ -624,29 +624,29 @@ struct Lookup
unsigned int num_subtables) unsigned int num_subtables)
{ {
TRACE_SERIALIZE (this); TRACE_SERIALIZE (this);
if (unlikely (!c->extend_min (*this))) return TRACE_RETURN (false); if (unlikely (!c->extend_min (*this))) return_trace (false);
lookupType.set (lookup_type); lookupType.set (lookup_type);
lookupFlag.set (lookup_props & 0xFFFFu); lookupFlag.set (lookup_props & 0xFFFFu);
if (unlikely (!subTable.serialize (c, num_subtables))) return TRACE_RETURN (false); if (unlikely (!subTable.serialize (c, num_subtables))) return_trace (false);
if (lookupFlag & LookupFlag::UseMarkFilteringSet) if (lookupFlag & LookupFlag::UseMarkFilteringSet)
{ {
USHORT &markFilteringSet = StructAfter<USHORT> (subTable); USHORT &markFilteringSet = StructAfter<USHORT> (subTable);
markFilteringSet.set (lookup_props >> 16); markFilteringSet.set (lookup_props >> 16);
} }
return TRACE_RETURN (true); return_trace (true);
} }
inline bool sanitize (hb_sanitize_context_t *c) const inline bool sanitize (hb_sanitize_context_t *c) const
{ {
TRACE_SANITIZE (this); TRACE_SANITIZE (this);
/* Real sanitize of the subtables is done by GSUB/GPOS/... */ /* Real sanitize of the subtables is done by GSUB/GPOS/... */
if (!(c->check_struct (this) && subTable.sanitize (c))) return TRACE_RETURN (false); if (!(c->check_struct (this) && subTable.sanitize (c))) return_trace (false);
if (lookupFlag & LookupFlag::UseMarkFilteringSet) if (lookupFlag & LookupFlag::UseMarkFilteringSet)
{ {
const USHORT &markFilteringSet = StructAfter<USHORT> (subTable); const USHORT &markFilteringSet = StructAfter<USHORT> (subTable);
if (!markFilteringSet.sanitize (c)) return TRACE_RETURN (false); if (!markFilteringSet.sanitize (c)) return_trace (false);
} }
return TRACE_RETURN (true); return_trace (true);
} }
private: private:
...@@ -685,19 +685,19 @@ struct CoverageFormat1 ...@@ -685,19 +685,19 @@ struct CoverageFormat1
unsigned int num_glyphs) unsigned int num_glyphs)
{ {
TRACE_SERIALIZE (this); TRACE_SERIALIZE (this);
if (unlikely (!c->extend_min (*this))) return TRACE_RETURN (false); if (unlikely (!c->extend_min (*this))) return_trace (false);
glyphArray.len.set (num_glyphs); glyphArray.len.set (num_glyphs);
if (unlikely (!c->extend (glyphArray))) return TRACE_RETURN (false); if (unlikely (!c->extend (glyphArray))) return_trace (false);
for (unsigned int i = 0; i < num_glyphs; i++) for (unsigned int i = 0; i < num_glyphs; i++)
glyphArray[i] = glyphs[i]; glyphArray[i] = glyphs[i];
glyphs.advance (num_glyphs); glyphs.advance (num_glyphs);
return TRACE_RETURN (true); return_trace (true);
} }
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_RETURN (glyphArray.sanitize (c)); return_trace (glyphArray.sanitize (c));
} }
inline bool intersects_coverage (const hb_set_t *glyphs, unsigned int index) const { inline bool intersects_coverage (const hb_set_t *glyphs, unsigned int index) const {
...@@ -754,16 +754,16 @@ struct CoverageFormat2 ...@@ -754,16 +754,16 @@ struct CoverageFormat2
unsigned int num_glyphs) unsigned int num_glyphs)
{ {
TRACE_SERIALIZE (this); TRACE_SERIALIZE (this);
if (unlikely (!c->extend_min (*this))) return TRACE_RETURN (false); if (unlikely (!c->extend_min (*this))) return_trace (false);
if (unlikely (!num_glyphs)) return TRACE_RETURN (true); if (unlikely (!num_glyphs)) return_trace (true);
unsigned int num_ranges = 1; unsigned int num_ranges = 1;
for (unsigned int i = 1; i < num_glyphs; i++) for (unsigned int i = 1; i < num_glyphs; i++)
if (glyphs[i - 1] + 1 != glyphs[i]) if (glyphs[i - 1] + 1 != glyphs[i])
num_ranges++; num_ranges++;
rangeRecord.len.set (num_ranges); rangeRecord.len.set (num_ranges);
if (unlikely (!c->extend (rangeRecord))) return TRACE_RETURN (false); if (unlikely (!c->extend (rangeRecord))) return_trace (false);
unsigned int range = 0; unsigned int range = 0;
rangeRecord[range].start = glyphs[0]; rangeRecord[range].start = glyphs[0];
...@@ -778,13 +778,13 @@ struct CoverageFormat2 ...@@ -778,13 +778,13 @@ struct CoverageFormat2
rangeRecord[range].end = glyphs[i]; rangeRecord[range].end = glyphs[i];
} }
glyphs.advance (num_glyphs); glyphs.advance (num_glyphs);
return TRACE_RETURN (true); return_trace (true);
} }
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_RETURN (rangeRecord.sanitize (c)); return_trace (rangeRecord.sanitize (c));
} }
inline bool intersects_coverage (const hb_set_t *glyphs, unsigned int index) const { inline bool intersects_coverage (const hb_set_t *glyphs, unsigned int index) const {
...@@ -864,27 +864,27 @@ struct Coverage ...@@ -864,27 +864,27 @@ struct Coverage
unsigned int num_glyphs) unsigned int num_glyphs)
{ {
TRACE_SERIALIZE (this); TRACE_SERIALIZE (this);
if (unlikely (!c->extend_min (*this))) return TRACE_RETURN (false); if (unlikely (!c->extend_min (*this))) return_trace (false);
unsigned int num_ranges = 1; unsigned int num_ranges = 1;
for (unsigned int i = 1; i < num_glyphs; i++) for (unsigned int i = 1; i < num_glyphs; i++)
if (glyphs[i - 1] + 1 != glyphs[i]) if (glyphs[i - 1] + 1 != glyphs[i])
num_ranges++; num_ranges++;
u.format.set (num_glyphs * 2 < num_ranges * 3 ? 1 : 2); u.format.set (num_glyphs * 2 < num_ranges * 3 ? 1 : 2);
switch (u.format) { switch (u.format) {
case 1: return TRACE_RETURN (u.format1.serialize (c, glyphs, num_glyphs)); case 1: return_trace (u.format1.serialize (c, glyphs, num_glyphs));
case 2: return TRACE_RETURN (u.format2.serialize (c, glyphs, num_glyphs)); case 2: return_trace (u.format2.serialize (c, glyphs, num_glyphs));
default:return TRACE_RETURN (false); default:return_trace (false);
} }
} }
inline bool sanitize (hb_sanitize_context_t *c) const inline bool sanitize (hb_sanitize_context_t *c) const
{ {
TRACE_SANITIZE (this); TRACE_SANITIZE (this);
if (!u.format.sanitize (c)) return TRACE_RETURN (false); if (!u.format.sanitize (c)) return_trace (false);
switch (u.format) { switch (u.format) {
case 1: return TRACE_RETURN (u.format1.sanitize (c)); case 1: return_trace (u.format1.sanitize (c));
case 2: return TRACE_RETURN (u.format2.sanitize (c)); case 2: return_trace (u.format2.sanitize (c));
default:return TRACE_RETURN (true); default:return_trace (true);
} }
} }
...@@ -993,7 +993,7 @@ struct ClassDefFormat1 ...@@ -993,7 +993,7 @@ struct ClassDefFormat1
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_RETURN (c->check_struct (this) && classValue.sanitize (c)); return_trace (c->check_struct (this) && classValue.sanitize (c));
} }
template <typename set_t> template <typename set_t>
...@@ -1050,7 +1050,7 @@ struct ClassDefFormat2 ...@@ -1050,7 +1050,7 @@ struct ClassDefFormat2
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_RETURN (rangeRecord.sanitize (c)); return_trace (rangeRecord.sanitize (c));
} }
template <typename set_t> template <typename set_t>
...@@ -1108,11 +1108,11 @@ struct ClassDef ...@@ -1108,11 +1108,11 @@ struct ClassDef
inline bool sanitize (hb_sanitize_context_t *c) const inline bool sanitize (hb_sanitize_context_t *c) const
{ {
TRACE_SANITIZE (this); TRACE_SANITIZE (this);
if (!u.format.sanitize (c)) return TRACE_RETURN (false); if (!u.format.sanitize (c)) return_trace (false);
switch (u.format) { switch (u.format) {
case 1: return TRACE_RETURN (u.format1.sanitize (c)); case 1: return_trace (u.format1.sanitize (c));
case 2: return TRACE_RETURN (u.format2.sanitize (c)); case 2: return_trace (u.format2.sanitize (c));
default:return TRACE_RETURN (true); default:return_trace (true);
} }
} }
...@@ -1201,7 +1201,7 @@ struct Device ...@@ -1201,7 +1201,7 @@ struct Device
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_RETURN (c->check_struct (this) && c->check_range (this, this->get_size ())); return_trace (c->check_struct (this) && c->check_range (this, this->get_size ()));
} }
protected: protected:
......
...@@ -74,7 +74,7 @@ struct AttachList ...@@ -74,7 +74,7 @@ struct AttachList
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_RETURN (coverage.sanitize (c, this) && attachPoint.sanitize (c, this)); return_trace (coverage.sanitize (c, this) && attachPoint.sanitize (c, this));
} }
protected: protected:
...@@ -105,7 +105,7 @@ struct CaretValueFormat1 ...@@ -105,7 +105,7 @@ struct CaretValueFormat1
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_RETURN (c->check_struct (this)); return_trace (c->check_struct (this));
} }
protected: protected:
...@@ -132,7 +132,7 @@ struct CaretValueFormat2 ...@@ -132,7 +132,7 @@ struct CaretValueFormat2
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_RETURN (c->check_struct (this)); return_trace (c->check_struct (this));
} }
protected: protected:
...@@ -156,7 +156,7 @@ struct CaretValueFormat3 ...@@ -156,7 +156,7 @@ struct CaretValueFormat3
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_RETURN (c->check_struct (this) && deviceTable.sanitize (c, this)); return_trace (c->check_struct (this) && deviceTable.sanitize (c, this));
} }
protected: protected:
...@@ -185,12 +185,12 @@ struct CaretValue ...@@ -185,12 +185,12 @@ struct CaretValue
inline bool sanitize (hb_sanitize_context_t *c) const inline bool sanitize (hb_sanitize_context_t *c) const
{ {
TRACE_SANITIZE (this); TRACE_SANITIZE (this);
if (!u.format.sanitize (c)) return TRACE_RETURN (false); if (!u.format.sanitize (c)) return_trace (false);
switch (u.format) { switch (u.format) {
case 1: return TRACE_RETURN (u.format1.sanitize (c)); case 1: return_trace (u.format1.sanitize (c));
case 2: return TRACE_RETURN (u.format2.sanitize (c)); case 2: return_trace (u.format2.sanitize (c));
case 3: return TRACE_RETURN (u.format3.sanitize (c)); case 3: return_trace (u.format3.sanitize (c));
default:return TRACE_RETURN (true); default:return_trace (true);
} }
} }
...@@ -227,7 +227,7 @@ struct LigGlyph ...@@ -227,7 +227,7 @@ struct LigGlyph
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_RETURN (carets.sanitize (c, this)); return_trace (carets.sanitize (c, this));
} }
protected: protected:
...@@ -262,7 +262,7 @@ struct LigCaretList ...@@ -262,7 +262,7 @@ struct LigCaretList
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_RETURN (coverage.sanitize (c, this) && ligGlyph.sanitize (c, this)); return_trace (coverage.sanitize (c, this) && ligGlyph.sanitize (c, this));
} }
protected: protected:
...@@ -285,7 +285,7 @@ struct MarkGlyphSetsFormat1 ...@@ -285,7 +285,7 @@ struct MarkGlyphSetsFormat1
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_RETURN (coverage.sanitize (c, this)); return_trace (coverage.sanitize (c, this));
} }
protected: protected:
...@@ -310,10 +310,10 @@ struct MarkGlyphSets ...@@ -310,10 +310,10 @@ struct MarkGlyphSets
inline bool sanitize (hb_sanitize_context_t *c) const inline bool sanitize (hb_sanitize_context_t *c) const
{ {
TRACE_SANITIZE (this); TRACE_SANITIZE (this);
if (!u.format.sanitize (c)) return TRACE_RETURN (false); if (!u.format.sanitize (c)) return_trace (false);
switch (u.format) { switch (u.format) {
case 1: return TRACE_RETURN (u.format1.sanitize (c)); case 1: return_trace (u.format1.sanitize (c));
default:return TRACE_RETURN (true); default:return_trace (true);
} }
} }
...@@ -376,7 +376,7 @@ struct GDEF ...@@ -376,7 +376,7 @@ struct GDEF
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_RETURN (version.sanitize (c) && return_trace (version.sanitize (c) &&
likely (version.major == 1) && likely (version.major == 1) &&
glyphClassDef.sanitize (c, this) && glyphClassDef.sanitize (c, this) &&
attachList.sanitize (c, this) && attachList.sanitize (c, this) &&
......
此差异已折叠。
此差异已折叠。
...@@ -57,7 +57,7 @@ struct JstfPriority ...@@ -57,7 +57,7 @@ struct JstfPriority
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_RETURN (c->check_struct (this) && return_trace (c->check_struct (this) &&
shrinkageEnableGSUB.sanitize (c, this) && shrinkageEnableGSUB.sanitize (c, this) &&
shrinkageDisableGSUB.sanitize (c, this) && shrinkageDisableGSUB.sanitize (c, this) &&
shrinkageEnableGPOS.sanitize (c, this) && shrinkageEnableGPOS.sanitize (c, this) &&
...@@ -127,7 +127,7 @@ struct JstfLangSys : OffsetListOf<JstfPriority> ...@@ -127,7 +127,7 @@ struct JstfLangSys : OffsetListOf<JstfPriority>
const Record<JstfLangSys>::sanitize_closure_t * = NULL) const const Record<JstfLangSys>::sanitize_closure_t * = NULL) const
{ {
TRACE_SANITIZE (this); TRACE_SANITIZE (this);
return TRACE_RETURN (OffsetListOf<JstfPriority>::sanitize (c)); return_trace (OffsetListOf<JstfPriority>::sanitize (c));
} }
}; };
...@@ -168,7 +168,7 @@ struct JstfScript ...@@ -168,7 +168,7 @@ struct JstfScript
const Record<JstfScript>::sanitize_closure_t * = NULL) const const Record<JstfScript>::sanitize_closure_t * = NULL) const
{ {
TRACE_SANITIZE (this); TRACE_SANITIZE (this);
return TRACE_RETURN (extenderGlyphs.sanitize (c, this) && return_trace (extenderGlyphs.sanitize (c, this) &&
defaultLangSys.sanitize (c, this) && defaultLangSys.sanitize (c, this) &&
langSys.sanitize (c, this)); langSys.sanitize (c, this));
} }
...@@ -212,7 +212,8 @@ struct JSTF ...@@ -212,7 +212,8 @@ struct JSTF
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_RETURN (version.sanitize (c) && likely (version.major == 1) && return_trace (version.sanitize (c) &&
likely (version.major == 1) &&
scriptList.sanitize (c, this)); scriptList.sanitize (c, this));
} }
......
...@@ -51,8 +51,9 @@ struct maxp ...@@ -51,8 +51,9 @@ struct maxp
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_RETURN (c->check_struct (this) && return_trace (c->check_struct (this) &&
likely (version.major == 1 || (version.major == 0 && version.minor == 0x5000u))); likely (version.major == 1 ||
(version.major == 0 && version.minor == 0x5000u)));
} }
/* We only implement version 0.5 as none of the extra fields in version 1.0 are useful. */ /* We only implement version 0.5 as none of the extra fields in version 1.0 are useful. */
......
...@@ -60,7 +60,7 @@ struct NameRecord ...@@ -60,7 +60,7 @@ struct NameRecord
{ {
TRACE_SANITIZE (this); TRACE_SANITIZE (this);
/* We can check from base all the way up to the end of string... */ /* We can check from base all the way up to the end of string... */
return TRACE_RETURN (c->check_struct (this) && c->check_range ((char *) base, (unsigned int) length + offset)); return_trace (c->check_struct (this) && c->check_range ((char *) base, (unsigned int) length + offset));
} }
USHORT platformID; /* Platform ID. */ USHORT platformID; /* Platform ID. */
...@@ -107,14 +107,14 @@ struct name ...@@ -107,14 +107,14 @@ struct name
char *string_pool = (char *) this + stringOffset; char *string_pool = (char *) this + stringOffset;
unsigned int _count = count; unsigned int _count = count;
for (unsigned int i = 0; i < _count; i++) for (unsigned int i = 0; i < _count; i++)
if (!nameRecord[i].sanitize (c, string_pool)) return TRACE_RETURN (false); if (!nameRecord[i].sanitize (c, string_pool)) return_trace (false);
return TRACE_RETURN (true); return_trace (true);
} }
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_RETURN (c->check_struct (this) && return_trace (c->check_struct (this) &&
likely (format == 0 || format == 1) && likely (format == 0 || format == 1) &&
c->check_array (nameRecord, nameRecord[0].static_size, count) && c->check_array (nameRecord, nameRecord[0].static_size, count) &&
sanitize_records (c)); sanitize_records (c));
......
...@@ -740,7 +740,7 @@ template <typename T> ...@@ -740,7 +740,7 @@ template <typename T>
static inline void _hb_warn_no_return (bool returned) static inline void _hb_warn_no_return (bool returned)
{ {
if (unlikely (!returned)) { if (unlikely (!returned)) {
fprintf (stderr, "OUCH, returned with no call to TRACE_RETURN. This is a bug, please report.\n"); fprintf (stderr, "OUCH, returned with no call to return_trace(). This is a bug, please report.\n");
} }
} }
template <> template <>
...@@ -775,7 +775,7 @@ struct hb_auto_trace_t { ...@@ -775,7 +775,7 @@ struct hb_auto_trace_t {
inline ret_t ret (ret_t v, unsigned int line = 0) inline ret_t ret (ret_t v, unsigned int line = 0)
{ {
if (unlikely (returned)) { if (unlikely (returned)) {
fprintf (stderr, "OUCH, double calls to TRACE_RETURN. This is a bug, please report.\n"); fprintf (stderr, "OUCH, double calls to return_trace(). This is a bug, please report.\n");
return v; return v;
} }
...@@ -806,7 +806,7 @@ struct hb_auto_trace_t<0, ret_t> { ...@@ -806,7 +806,7 @@ struct hb_auto_trace_t<0, ret_t> {
inline ret_t ret (ret_t v, unsigned int line HB_UNUSED = 0) { return v; } inline ret_t ret (ret_t v, unsigned int line HB_UNUSED = 0) { return v; }
}; };
#define TRACE_RETURN(RET) trace.ret (RET, __LINE__) #define return_trace(RET) return trace.ret (RET, __LINE__)
/* Misc */ /* Misc */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册