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

Define return_trace()

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