[HB] Rename DEBUG to TRACE where appropriate

This commit is contained in:
Behdad Esfahbod 2009-08-28 17:17:11 -04:00
parent 0535b50f43
commit 3e2401f6c5
7 changed files with 176 additions and 176 deletions

View File

@ -48,7 +48,7 @@ struct TTCHeader;
typedef struct TableDirectory typedef struct TableDirectory
{ {
inline bool sanitize (SANITIZE_ARG_DEF, const void *base) { inline bool sanitize (SANITIZE_ARG_DEF, const void *base) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
return SANITIZE_SELF () && SANITIZE (tag) && return SANITIZE_SELF () && SANITIZE (tag) &&
SANITIZE_MEM (CONST_CHARP(base) + (unsigned long) offset, length); SANITIZE_MEM (CONST_CHARP(base) + (unsigned long) offset, length);
} }
@ -107,7 +107,7 @@ typedef struct OffsetTable
public: public:
inline bool sanitize (SANITIZE_ARG_DEF, const void *base) { inline bool sanitize (SANITIZE_ARG_DEF, const void *base) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
if (!(SANITIZE_SELF () && SANITIZE_MEM (tableDir, sizeof (tableDir[0]) * numTables))) return false; if (!(SANITIZE_SELF () && SANITIZE_MEM (tableDir, sizeof (tableDir[0]) * numTables))) return false;
unsigned int count = numTables; unsigned int count = numTables;
for (unsigned int i = 0; i < count; i++) for (unsigned int i = 0; i < count; i++)
@ -144,7 +144,7 @@ struct TTCHeader
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
if (!SANITIZE (version)) return false; if (!SANITIZE (version)) return false;
if (version.major < 1 || version.major > 2) return true; if (version.major < 1 || version.major > 2) return true;
/* TODO Maybe we shouldn't NEUTER these offsets, they may cause a full copy /* TODO Maybe we shouldn't NEUTER these offsets, they may cause a full copy
@ -203,7 +203,7 @@ struct OpenTypeFontFile
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
if (!SANITIZE_SELF ()) return false; if (!SANITIZE_SELF ()) return false;
switch (tag) { switch (tag) {
default: return true; default: return true;

View File

@ -114,10 +114,10 @@ struct Null <Type> \
#endif #endif
#if HB_DEBUG_SANITIZE #if HB_DEBUG_SANITIZE
#define SANITIZE_DEBUG_ARG_DEF , unsigned int sanitize_depth #define TRACE_SANITIZE_ARG_DEF , unsigned int sanitize_depth
#define SANITIZE_DEBUG_ARG , sanitize_depth + 1 #define TRACE_SANITIZE_ARG , sanitize_depth + 1
#define SANITIZE_DEBUG_ARG_INIT , 1 #define TRACE_SANITIZE_ARG_INIT , 1
#define SANITIZE_DEBUG() \ #define TRACE_SANITIZE() \
HB_STMT_START { \ HB_STMT_START { \
if (sanitize_depth < HB_DEBUG_SANITIZE) \ if (sanitize_depth < HB_DEBUG_SANITIZE) \
fprintf (stderr, "SANITIZE(%p) %-*d-> %s\n", \ fprintf (stderr, "SANITIZE(%p) %-*d-> %s\n", \
@ -126,18 +126,18 @@ struct Null <Type> \
__PRETTY_FUNCTION__); \ __PRETTY_FUNCTION__); \
} HB_STMT_END } HB_STMT_END
#else #else
#define SANITIZE_DEBUG_ARG_DEF #define TRACE_SANITIZE_ARG_DEF
#define SANITIZE_DEBUG_ARG #define TRACE_SANITIZE_ARG
#define SANITIZE_DEBUG_ARG_INIT #define TRACE_SANITIZE_ARG_INIT
#define SANITIZE_DEBUG() HB_STMT_START {} HB_STMT_END #define TRACE_SANITIZE() HB_STMT_START {} HB_STMT_END
#endif #endif
#define SANITIZE_ARG_DEF \ #define SANITIZE_ARG_DEF \
hb_sanitize_context_t *context SANITIZE_DEBUG_ARG_DEF hb_sanitize_context_t *context TRACE_SANITIZE_ARG_DEF
#define SANITIZE_ARG \ #define SANITIZE_ARG \
context SANITIZE_DEBUG_ARG context TRACE_SANITIZE_ARG
#define SANITIZE_ARG_INIT \ #define SANITIZE_ARG_INIT \
&context SANITIZE_DEBUG_ARG_INIT &context TRACE_SANITIZE_ARG_INIT
typedef struct _hb_sanitize_context_t hb_sanitize_context_t; typedef struct _hb_sanitize_context_t hb_sanitize_context_t;
struct _hb_sanitize_context_t struct _hb_sanitize_context_t
@ -349,7 +349,7 @@ struct Sanitizer
inline operator TYPE(void) const { return BIG_ENDIAN ((TYPE&) v); } \ inline operator TYPE(void) const { return BIG_ENDIAN ((TYPE&) v); } \
inline bool operator== (NAME o) const { return (TYPE&) v == (TYPE&) o.v; } \ inline bool operator== (NAME o) const { return (TYPE&) v == (TYPE&) o.v; } \
inline bool sanitize (SANITIZE_ARG_DEF) { \ inline bool sanitize (SANITIZE_ARG_DEF) { \
SANITIZE_DEBUG (); \ TRACE_SANITIZE (); \
return SANITIZE_SELF (); \ return SANITIZE_SELF (); \
} \ } \
private: unsigned char v[BYTES]; \ private: unsigned char v[BYTES]; \
@ -363,7 +363,7 @@ struct Sanitizer
inline operator TYPE(void) const { return BIG_ENDIAN##_get_unaligned (v); } \ inline operator TYPE(void) const { return BIG_ENDIAN##_get_unaligned (v); } \
inline bool operator== (NAME o) const { return BIG_ENDIAN##_cmp_unaligned (v, o.v); } \ inline bool operator== (NAME o) const { return BIG_ENDIAN##_cmp_unaligned (v, o.v); } \
inline bool sanitize (SANITIZE_ARG_DEF) { \ inline bool sanitize (SANITIZE_ARG_DEF) { \
SANITIZE_DEBUG (); \ TRACE_SANITIZE (); \
return SANITIZE_SELF (); \ return SANITIZE_SELF (); \
} \ } \
private: unsigned char v[BYTES]; \ private: unsigned char v[BYTES]; \
@ -392,7 +392,7 @@ struct Tag : ULONG
inline operator char* (void) { return CHARP(this); } inline operator char* (void) { return CHARP(this); }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
/* Note: Only accept ASCII-visible tags (mind DEL) /* Note: Only accept ASCII-visible tags (mind DEL)
* This is one of the few times (only time?) we check * This is one of the few times (only time?) we check
* for data integrity, as opposed o just boundary checks * for data integrity, as opposed o just boundary checks
@ -440,7 +440,7 @@ struct FixedVersion
inline operator uint32_t (void) const { return (major << 16) + minor; } inline operator uint32_t (void) const { return (major << 16) + minor; }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
return SANITIZE_SELF (); return SANITIZE_SELF ();
} }
@ -467,21 +467,21 @@ struct GenericOffsetTo : OffsetType
} }
inline bool sanitize (SANITIZE_ARG_DEF, const void *base) { inline bool sanitize (SANITIZE_ARG_DEF, const void *base) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
if (!SANITIZE_SELF ()) return false; if (!SANITIZE_SELF ()) return false;
unsigned int offset = *this; unsigned int offset = *this;
if (HB_UNLIKELY (!offset)) return true; if (HB_UNLIKELY (!offset)) return true;
return SANITIZE (CAST(Type, *DECONST_CHARP(base), offset)) || NEUTER (DECONST_CAST(OffsetType,*this,0), 0); return SANITIZE (CAST(Type, *DECONST_CHARP(base), offset)) || NEUTER (DECONST_CAST(OffsetType,*this,0), 0);
} }
inline bool sanitize (SANITIZE_ARG_DEF, const void *base, const void *base2) { inline bool sanitize (SANITIZE_ARG_DEF, const void *base, const void *base2) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
if (!SANITIZE_SELF ()) return false; if (!SANITIZE_SELF ()) return false;
unsigned int offset = *this; unsigned int offset = *this;
if (HB_UNLIKELY (!offset)) return true; if (HB_UNLIKELY (!offset)) return true;
return SANITIZE_BASE (CAST(Type, *DECONST_CHARP(base), offset), base2) || NEUTER (DECONST_CAST(OffsetType,*this,0), 0); return SANITIZE_BASE (CAST(Type, *DECONST_CHARP(base), offset), base2) || NEUTER (DECONST_CAST(OffsetType,*this,0), 0);
} }
inline bool sanitize (SANITIZE_ARG_DEF, const void *base, unsigned int user_data) { inline bool sanitize (SANITIZE_ARG_DEF, const void *base, unsigned int user_data) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
if (!SANITIZE_SELF ()) return false; if (!SANITIZE_SELF ()) return false;
unsigned int offset = *this; unsigned int offset = *this;
if (HB_UNLIKELY (!offset)) return true; if (HB_UNLIKELY (!offset)) return true;
@ -514,7 +514,7 @@ struct GenericArrayOf
{ return sizeof (len) + len * sizeof (array[0]); } { return sizeof (len) + len * sizeof (array[0]); }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
if (!SANITIZE_GET_SIZE()) return false; if (!SANITIZE_GET_SIZE()) return false;
/* Note: /* Note:
* for non-recursive types, this is not much needed. * for non-recursive types, this is not much needed.
@ -528,7 +528,7 @@ struct GenericArrayOf
return true; return true;
} }
inline bool sanitize (SANITIZE_ARG_DEF, const void *base) { inline bool sanitize (SANITIZE_ARG_DEF, const void *base) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
if (!SANITIZE_GET_SIZE()) return false; if (!SANITIZE_GET_SIZE()) return 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++)
@ -537,7 +537,7 @@ struct GenericArrayOf
return true; return true;
} }
inline bool sanitize (SANITIZE_ARG_DEF, const void *base, const void *base2) { inline bool sanitize (SANITIZE_ARG_DEF, const void *base, const void *base2) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
if (!SANITIZE_GET_SIZE()) return false; if (!SANITIZE_GET_SIZE()) return 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++)
@ -546,7 +546,7 @@ struct GenericArrayOf
return true; return true;
} }
inline bool sanitize (SANITIZE_ARG_DEF, const void *base, unsigned int user_data) { inline bool sanitize (SANITIZE_ARG_DEF, const void *base, unsigned int user_data) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
if (!SANITIZE_GET_SIZE()) return false; if (!SANITIZE_GET_SIZE()) return 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++)
@ -590,11 +590,11 @@ struct OffsetListOf : OffsetArrayOf<Type>
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
return OffsetArrayOf<Type>::sanitize (SANITIZE_ARG, CONST_CHARP(this)); return OffsetArrayOf<Type>::sanitize (SANITIZE_ARG, CONST_CHARP(this));
} }
inline bool sanitize (SANITIZE_ARG_DEF, unsigned int user_data) { inline bool sanitize (SANITIZE_ARG_DEF, unsigned int user_data) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
return OffsetArrayOf<Type>::sanitize (SANITIZE_ARG, CONST_CHARP(this), user_data); return OffsetArrayOf<Type>::sanitize (SANITIZE_ARG, CONST_CHARP(this), user_data);
} }
}; };
@ -614,7 +614,7 @@ struct HeadlessArrayOf
{ return sizeof (len) + (len ? len - 1 : 0) * sizeof (array[0]); } { return sizeof (len) + (len ? len - 1 : 0) * sizeof (array[0]); }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
if (!SANITIZE_GET_SIZE()) return false; if (!SANITIZE_GET_SIZE()) return false;
/* Note: /* Note:
* for non-recursive types, this is not much needed. * for non-recursive types, this is not much needed.

View File

@ -52,7 +52,7 @@ template <typename Type>
struct Record struct Record
{ {
inline bool sanitize (SANITIZE_ARG_DEF, const void *base) { inline bool sanitize (SANITIZE_ARG_DEF, const void *base) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
return SANITIZE (tag) && SANITIZE_BASE (offset, base); return SANITIZE (tag) && SANITIZE_BASE (offset, base);
} }
@ -104,7 +104,7 @@ struct RecordListOf : RecordArrayOf<Type>
{ return this+RecordArrayOf<Type>::operator[](i).offset; } { return this+RecordArrayOf<Type>::operator[](i).offset; }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
return RecordArrayOf<Type>::sanitize (SANITIZE_ARG, CONST_CHARP(this)); return RecordArrayOf<Type>::sanitize (SANITIZE_ARG, CONST_CHARP(this));
} }
}; };
@ -155,7 +155,7 @@ struct LangSys
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
return SANITIZE_SELF () && SANITIZE (featureIndex); return SANITIZE_SELF () && SANITIZE (featureIndex);
} }
@ -190,7 +190,7 @@ struct Script
inline const LangSys& get_default_lang_sys (void) const { return this+defaultLangSys; } inline const LangSys& get_default_lang_sys (void) const { return this+defaultLangSys; }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
return SANITIZE_THIS (defaultLangSys) && SANITIZE_THIS (langSys); return SANITIZE_THIS (defaultLangSys) && SANITIZE_THIS (langSys);
} }
@ -219,7 +219,7 @@ struct Feature
{ return lookupIndex.get_indexes (lookup_count, lookup_tags); } { return lookupIndex.get_indexes (lookup_count, lookup_tags); }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
return SANITIZE_SELF () && SANITIZE (lookupIndex); return SANITIZE_SELF () && SANITIZE (lookupIndex);
} }
@ -254,7 +254,7 @@ ASSERT_SIZE (LookupFlag, 2);
struct LookupSubTable struct LookupSubTable
{ {
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
return SANITIZE_SELF (); return SANITIZE_SELF ();
} }
@ -281,7 +281,7 @@ struct Lookup
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
if (!(SANITIZE_SELF () && SANITIZE_THIS (subTable))) return false; if (!(SANITIZE_SELF () && SANITIZE_THIS (subTable))) return false;
if (HB_UNLIKELY (lookupFlag & LookupFlag::UseMarkFilteringSet)) if (HB_UNLIKELY (lookupFlag & LookupFlag::UseMarkFilteringSet))
{ {
@ -329,7 +329,7 @@ struct CoverageFormat1
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
return SANITIZE (glyphArray); return SANITIZE (glyphArray);
} }
@ -354,7 +354,7 @@ struct CoverageRangeRecord
public: public:
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
return SANITIZE_SELF (); return SANITIZE_SELF ();
} }
@ -385,7 +385,7 @@ struct CoverageFormat2
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
return SANITIZE (rangeRecord); return SANITIZE (rangeRecord);
} }
@ -412,7 +412,7 @@ struct Coverage
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
if (!SANITIZE (u.format)) return false; if (!SANITIZE (u.format)) return false;
switch (u.format) { switch (u.format) {
case 1: return u.format1->sanitize (SANITIZE_ARG); case 1: return u.format1->sanitize (SANITIZE_ARG);
@ -448,7 +448,7 @@ struct ClassDefFormat1
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
return SANITIZE_SELF () && SANITIZE (classValue); return SANITIZE_SELF () && SANITIZE (classValue);
} }
@ -473,7 +473,7 @@ struct ClassRangeRecord
public: public:
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
return SANITIZE_SELF (); return SANITIZE_SELF ();
} }
@ -503,7 +503,7 @@ struct ClassDefFormat2
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
return SANITIZE (rangeRecord); return SANITIZE (rangeRecord);
} }
@ -528,7 +528,7 @@ struct ClassDef
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
if (!SANITIZE (u.format)) return false; if (!SANITIZE (u.format)) return false;
switch (u.format) { switch (u.format) {
case 1: return u.format1->sanitize (SANITIZE_ARG); case 1: return u.format1->sanitize (SANITIZE_ARG);
@ -586,7 +586,7 @@ struct Device
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
return SANITIZE_GET_SIZE (); return SANITIZE_GET_SIZE ();
} }

View File

@ -64,7 +64,7 @@ struct AttachList
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
return SANITIZE_THIS2 (coverage, attachPoint); return SANITIZE_THIS2 (coverage, attachPoint);
} }
@ -94,7 +94,7 @@ struct CaretValueFormat1
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
return SANITIZE_SELF (); return SANITIZE_SELF ();
} }
@ -115,7 +115,7 @@ struct CaretValueFormat2
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
return SANITIZE_SELF (); return SANITIZE_SELF ();
} }
@ -137,7 +137,7 @@ struct CaretValueFormat3
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
return SANITIZE_SELF () && SANITIZE_THIS (deviceTable); return SANITIZE_SELF () && SANITIZE_THIS (deviceTable);
} }
@ -164,7 +164,7 @@ struct CaretValue
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
if (!SANITIZE (u.format)) return false; if (!SANITIZE (u.format)) return false;
switch (u.format) { switch (u.format) {
case 1: return u.format1->sanitize (SANITIZE_ARG); case 1: return u.format1->sanitize (SANITIZE_ARG);
@ -200,7 +200,7 @@ struct LigGlyph
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
return SANITIZE_THIS (carets); return SANITIZE_THIS (carets);
} }
@ -231,7 +231,7 @@ struct LigCaretList
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
return SANITIZE_THIS2 (coverage, ligGlyph); return SANITIZE_THIS2 (coverage, ligGlyph);
} }
@ -252,7 +252,7 @@ struct MarkGlyphSetsFormat1
{ return (this+coverage[set_index]).get_coverage (glyph_id) != NOT_COVERED; } { return (this+coverage[set_index]).get_coverage (glyph_id) != NOT_COVERED; }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
return SANITIZE_THIS (coverage); return SANITIZE_THIS (coverage);
} }
@ -275,7 +275,7 @@ struct MarkGlyphSets
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
if (!SANITIZE (u.format)) return false; if (!SANITIZE (u.format)) return false;
switch (u.format) { switch (u.format) {
case 1: return u.format1->sanitize (SANITIZE_ARG); case 1: return u.format1->sanitize (SANITIZE_ARG);
@ -336,7 +336,7 @@ struct GDEF
{ return version >= 0x00010002 && (this+markGlyphSetsDef[0]).covers (set_index, glyph_id); } { return version >= 0x00010002 && (this+markGlyphSetsDef[0]).covers (set_index, glyph_id); }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
if (!SANITIZE (version)) return false; if (!SANITIZE (version)) return false;
if (version.major != 1) return true; if (version.major != 1) return true;
return SANITIZE_THIS2 (glyphClassDef, attachList) && return SANITIZE_THIS2 (glyphClassDef, attachList) &&

View File

@ -157,7 +157,7 @@ struct AnchorFormat1
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
return SANITIZE_SELF (); return SANITIZE_SELF ();
} }
@ -182,7 +182,7 @@ struct AnchorFormat2
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
return SANITIZE_SELF (); return SANITIZE_SELF ();
} }
@ -212,7 +212,7 @@ struct AnchorFormat3
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
return SANITIZE_SELF () && SANITIZE_THIS2 (xDeviceTable, yDeviceTable); return SANITIZE_SELF () && SANITIZE_THIS2 (xDeviceTable, yDeviceTable);
} }
@ -246,7 +246,7 @@ struct Anchor
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
if (!SANITIZE (u.format)) return false; if (!SANITIZE (u.format)) return false;
switch (u.format) { switch (u.format) {
case 1: return u.format1->sanitize (SANITIZE_ARG); case 1: return u.format1->sanitize (SANITIZE_ARG);
@ -275,7 +275,7 @@ struct AnchorMatrix
} }
inline bool sanitize (SANITIZE_ARG_DEF, unsigned int cols) { inline bool sanitize (SANITIZE_ARG_DEF, unsigned int cols) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
if (!SANITIZE_SELF ()) return false; if (!SANITIZE_SELF ()) return false;
unsigned int count = rows * cols; unsigned int count = rows * cols;
if (!SANITIZE_ARRAY (matrix, sizeof (matrix[0]), count)) return false; if (!SANITIZE_ARRAY (matrix, sizeof (matrix[0]), count)) return false;
@ -298,7 +298,7 @@ struct MarkRecord
friend struct MarkArray; friend struct MarkArray;
inline bool sanitize (SANITIZE_ARG_DEF, const void *base) { inline bool sanitize (SANITIZE_ARG_DEF, const void *base) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
return SANITIZE_SELF () && SANITIZE_BASE (markAnchor, base); return SANITIZE_SELF () && SANITIZE_BASE (markAnchor, base);
} }
@ -317,7 +317,7 @@ struct MarkArray
const AnchorMatrix &anchors, unsigned int class_count, const AnchorMatrix &anchors, unsigned int class_count,
unsigned int glyph_pos) const unsigned int glyph_pos) const
{ {
APPLY_DEBUG (); TRACE_APPLY ();
const MarkRecord &record = markRecord[mark_index]; const MarkRecord &record = markRecord[mark_index];
unsigned int mark_class = record.klass; unsigned int mark_class = record.klass;
@ -341,7 +341,7 @@ struct MarkArray
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
return SANITIZE_THIS (markRecord); return SANITIZE_THIS (markRecord);
} }
@ -361,7 +361,7 @@ struct SinglePosFormat1
private: private:
inline bool apply (APPLY_ARG_DEF) const inline bool apply (APPLY_ARG_DEF) const
{ {
APPLY_DEBUG (); TRACE_APPLY ();
unsigned int index = (this+coverage) (IN_CURGLYPH ()); unsigned int index = (this+coverage) (IN_CURGLYPH ());
if (HB_LIKELY (index == NOT_COVERED)) if (HB_LIKELY (index == NOT_COVERED))
return false; return false;
@ -373,7 +373,7 @@ struct SinglePosFormat1
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
return SANITIZE_SELF () && SANITIZE_THIS (coverage) && return SANITIZE_SELF () && SANITIZE_THIS (coverage) &&
SANITIZE_MEM (values, valueFormat.get_size ()); SANITIZE_MEM (values, valueFormat.get_size ());
} }
@ -398,7 +398,7 @@ struct SinglePosFormat2
private: private:
inline bool apply (APPLY_ARG_DEF) const inline bool apply (APPLY_ARG_DEF) const
{ {
APPLY_DEBUG (); TRACE_APPLY ();
unsigned int index = (this+coverage) (IN_CURGLYPH ()); unsigned int index = (this+coverage) (IN_CURGLYPH ());
if (HB_LIKELY (index == NOT_COVERED)) if (HB_LIKELY (index == NOT_COVERED))
return false; return false;
@ -415,7 +415,7 @@ struct SinglePosFormat2
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
return SANITIZE_SELF () && SANITIZE_THIS (coverage) && return SANITIZE_SELF () && SANITIZE_THIS (coverage) &&
SANITIZE_MEM (values, valueFormat.get_size () * valueCount); SANITIZE_MEM (values, valueFormat.get_size () * valueCount);
} }
@ -440,7 +440,7 @@ struct SinglePos
private: private:
inline bool apply (APPLY_ARG_DEF) const inline bool apply (APPLY_ARG_DEF) const
{ {
APPLY_DEBUG (); TRACE_APPLY ();
switch (u.format) { switch (u.format) {
case 1: return u.format1->apply (APPLY_ARG); case 1: return u.format1->apply (APPLY_ARG);
case 2: return u.format2->apply (APPLY_ARG); case 2: return u.format2->apply (APPLY_ARG);
@ -449,7 +449,7 @@ struct SinglePos
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
if (!SANITIZE (u.format)) return false; if (!SANITIZE (u.format)) return false;
switch (u.format) { switch (u.format) {
case 1: return u.format1->sanitize (SANITIZE_ARG); case 1: return u.format1->sanitize (SANITIZE_ARG);
@ -486,7 +486,7 @@ struct PairSet
friend struct PairPosFormat1; friend struct PairPosFormat1;
inline bool sanitize (SANITIZE_ARG_DEF, unsigned int format_len) { inline bool sanitize (SANITIZE_ARG_DEF, unsigned int format_len) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
if (!SANITIZE_SELF ()) return false; if (!SANITIZE_SELF ()) return false;
unsigned int count = (1 + format_len) * len; unsigned int count = (1 + format_len) * len;
return SANITIZE_MEM (array, sizeof (array[0]) * count); return SANITIZE_MEM (array, sizeof (array[0]) * count);
@ -507,7 +507,7 @@ struct PairPosFormat1
private: private:
inline bool apply (APPLY_ARG_DEF) const inline bool apply (APPLY_ARG_DEF) const
{ {
APPLY_DEBUG (); TRACE_APPLY ();
unsigned int end = MIN (buffer->in_length, buffer->in_pos + context_length); unsigned int end = MIN (buffer->in_length, buffer->in_pos + context_length);
if (HB_UNLIKELY (buffer->in_pos + 2 > end)) if (HB_UNLIKELY (buffer->in_pos + 2 > end))
return false; return false;
@ -550,7 +550,7 @@ struct PairPosFormat1
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
return SANITIZE_SELF () && SANITIZE_THIS (coverage) && return SANITIZE_SELF () && SANITIZE_THIS (coverage) &&
pairSet.sanitize (SANITIZE_ARG, CONST_CHARP(this), pairSet.sanitize (SANITIZE_ARG, CONST_CHARP(this),
valueFormat1.get_len () + valueFormat2.get_len ()); valueFormat1.get_len () + valueFormat2.get_len ());
@ -580,7 +580,7 @@ struct PairPosFormat2
private: private:
inline bool apply (APPLY_ARG_DEF) const inline bool apply (APPLY_ARG_DEF) const
{ {
APPLY_DEBUG (); TRACE_APPLY ();
unsigned int end = MIN (buffer->in_length, buffer->in_pos + context_length); unsigned int end = MIN (buffer->in_length, buffer->in_pos + context_length);
if (HB_UNLIKELY (buffer->in_pos + 2 > end)) if (HB_UNLIKELY (buffer->in_pos + 2 > end))
return false; return false;
@ -618,7 +618,7 @@ struct PairPosFormat2
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
if (!(SANITIZE_SELF () && SANITIZE_THIS (coverage) && if (!(SANITIZE_SELF () && SANITIZE_THIS (coverage) &&
SANITIZE_THIS2 (classDef1, classDef2))) return false; SANITIZE_THIS2 (classDef1, classDef2))) return false;
@ -663,7 +663,7 @@ struct PairPos
private: private:
inline bool apply (APPLY_ARG_DEF) const inline bool apply (APPLY_ARG_DEF) const
{ {
APPLY_DEBUG (); TRACE_APPLY ();
switch (u.format) { switch (u.format) {
case 1: return u.format1->apply (APPLY_ARG); case 1: return u.format1->apply (APPLY_ARG);
case 2: return u.format2->apply (APPLY_ARG); case 2: return u.format2->apply (APPLY_ARG);
@ -672,7 +672,7 @@ struct PairPos
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
if (!SANITIZE (u.format)) return false; if (!SANITIZE (u.format)) return false;
switch (u.format) { switch (u.format) {
case 1: return u.format1->sanitize (SANITIZE_ARG); case 1: return u.format1->sanitize (SANITIZE_ARG);
@ -694,7 +694,7 @@ ASSERT_SIZE (PairPos, 2);
struct EntryExitRecord struct EntryExitRecord
{ {
inline bool sanitize (SANITIZE_ARG_DEF, const void *base) { inline bool sanitize (SANITIZE_ARG_DEF, const void *base) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
return SANITIZE_BASE2 (entryAnchor, exitAnchor, base); return SANITIZE_BASE2 (entryAnchor, exitAnchor, base);
} }
@ -716,7 +716,7 @@ struct CursivePosFormat1
private: private:
inline bool apply (APPLY_ARG_DEF) const inline bool apply (APPLY_ARG_DEF) const
{ {
APPLY_DEBUG (); TRACE_APPLY ();
/* Now comes the messiest part of the whole OpenType /* Now comes the messiest part of the whole OpenType
specification. At first glance, cursive connections seem easy specification. At first glance, cursive connections seem easy
to understand, but there are pitfalls! The reason is that to understand, but there are pitfalls! The reason is that
@ -890,7 +890,7 @@ struct CursivePosFormat1
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
return SANITIZE_THIS2 (coverage, entryExitRecord); return SANITIZE_THIS2 (coverage, entryExitRecord);
} }
@ -912,7 +912,7 @@ struct CursivePos
private: private:
inline bool apply (APPLY_ARG_DEF) const inline bool apply (APPLY_ARG_DEF) const
{ {
APPLY_DEBUG (); TRACE_APPLY ();
switch (u.format) { switch (u.format) {
case 1: return u.format1->apply (APPLY_ARG); case 1: return u.format1->apply (APPLY_ARG);
default:return false; default:return false;
@ -920,7 +920,7 @@ struct CursivePos
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
if (!SANITIZE (u.format)) return false; if (!SANITIZE (u.format)) return false;
switch (u.format) { switch (u.format) {
case 1: return u.format1->sanitize (SANITIZE_ARG); case 1: return u.format1->sanitize (SANITIZE_ARG);
@ -950,7 +950,7 @@ struct MarkBasePosFormat1
private: private:
inline bool apply (APPLY_ARG_DEF) const inline bool apply (APPLY_ARG_DEF) const
{ {
APPLY_DEBUG (); TRACE_APPLY ();
unsigned int mark_index = (this+markCoverage) (IN_CURGLYPH ()); unsigned int mark_index = (this+markCoverage) (IN_CURGLYPH ());
if (HB_LIKELY (mark_index == NOT_COVERED)) if (HB_LIKELY (mark_index == NOT_COVERED))
return false; return false;
@ -978,7 +978,7 @@ struct MarkBasePosFormat1
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
return SANITIZE_SELF () && SANITIZE_THIS2 (markCoverage, baseCoverage) && return SANITIZE_SELF () && SANITIZE_THIS2 (markCoverage, baseCoverage) &&
SANITIZE_THIS (markArray) && baseArray.sanitize (SANITIZE_ARG, CONST_CHARP(this), classCount); SANITIZE_THIS (markArray) && baseArray.sanitize (SANITIZE_ARG, CONST_CHARP(this), classCount);
} }
@ -1008,7 +1008,7 @@ struct MarkBasePos
private: private:
inline bool apply (APPLY_ARG_DEF) const inline bool apply (APPLY_ARG_DEF) const
{ {
APPLY_DEBUG (); TRACE_APPLY ();
switch (u.format) { switch (u.format) {
case 1: return u.format1->apply (APPLY_ARG); case 1: return u.format1->apply (APPLY_ARG);
default:return false; default:return false;
@ -1016,7 +1016,7 @@ struct MarkBasePos
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
if (!SANITIZE (u.format)) return false; if (!SANITIZE (u.format)) return false;
switch (u.format) { switch (u.format) {
case 1: return u.format1->sanitize (SANITIZE_ARG); case 1: return u.format1->sanitize (SANITIZE_ARG);
@ -1052,7 +1052,7 @@ struct MarkLigPosFormat1
private: private:
inline bool apply (APPLY_ARG_DEF) const inline bool apply (APPLY_ARG_DEF) const
{ {
APPLY_DEBUG (); TRACE_APPLY ();
unsigned int mark_index = (this+markCoverage) (IN_CURGLYPH ()); unsigned int mark_index = (this+markCoverage) (IN_CURGLYPH ());
if (HB_LIKELY (mark_index == NOT_COVERED)) if (HB_LIKELY (mark_index == NOT_COVERED))
return false; return false;
@ -1101,7 +1101,7 @@ struct MarkLigPosFormat1
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
return SANITIZE_SELF () && return SANITIZE_SELF () &&
SANITIZE_THIS2 (markCoverage, ligatureCoverage) && SANITIZE_THIS2 (markCoverage, ligatureCoverage) &&
SANITIZE_THIS (markArray) && ligatureArray.sanitize (SANITIZE_ARG, CONST_CHARP(this), classCount); SANITIZE_THIS (markArray) && ligatureArray.sanitize (SANITIZE_ARG, CONST_CHARP(this), classCount);
@ -1133,7 +1133,7 @@ struct MarkLigPos
private: private:
inline bool apply (APPLY_ARG_DEF) const inline bool apply (APPLY_ARG_DEF) const
{ {
APPLY_DEBUG (); TRACE_APPLY ();
switch (u.format) { switch (u.format) {
case 1: return u.format1->apply (APPLY_ARG); case 1: return u.format1->apply (APPLY_ARG);
default:return false; default:return false;
@ -1141,7 +1141,7 @@ struct MarkLigPos
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
if (!SANITIZE (u.format)) return false; if (!SANITIZE (u.format)) return false;
switch (u.format) { switch (u.format) {
case 1: return u.format1->sanitize (SANITIZE_ARG); case 1: return u.format1->sanitize (SANITIZE_ARG);
@ -1171,7 +1171,7 @@ struct MarkMarkPosFormat1
private: private:
inline bool apply (APPLY_ARG_DEF) const inline bool apply (APPLY_ARG_DEF) const
{ {
APPLY_DEBUG (); TRACE_APPLY ();
unsigned int mark1_index = (this+mark1Coverage) (IN_CURGLYPH ()); unsigned int mark1_index = (this+mark1Coverage) (IN_CURGLYPH ());
if (HB_LIKELY (mark1_index == NOT_COVERED)) if (HB_LIKELY (mark1_index == NOT_COVERED))
return false; return false;
@ -1202,7 +1202,7 @@ struct MarkMarkPosFormat1
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
return SANITIZE_SELF () && SANITIZE_THIS2 (mark1Coverage, mark2Coverage) && return SANITIZE_SELF () && SANITIZE_THIS2 (mark1Coverage, mark2Coverage) &&
SANITIZE_THIS (mark1Array) && mark2Array.sanitize (SANITIZE_ARG, CONST_CHARP(this), classCount); SANITIZE_THIS (mark1Array) && mark2Array.sanitize (SANITIZE_ARG, CONST_CHARP(this), classCount);
} }
@ -1234,7 +1234,7 @@ struct MarkMarkPos
private: private:
inline bool apply (APPLY_ARG_DEF) const inline bool apply (APPLY_ARG_DEF) const
{ {
APPLY_DEBUG (); TRACE_APPLY ();
switch (u.format) { switch (u.format) {
case 1: return u.format1->apply (APPLY_ARG); case 1: return u.format1->apply (APPLY_ARG);
default:return false; default:return false;
@ -1242,7 +1242,7 @@ struct MarkMarkPos
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
if (!SANITIZE (u.format)) return false; if (!SANITIZE (u.format)) return false;
switch (u.format) { switch (u.format) {
case 1: return u.format1->sanitize (SANITIZE_ARG); case 1: return u.format1->sanitize (SANITIZE_ARG);
@ -1268,7 +1268,7 @@ struct ContextPos : Context
private: private:
inline bool apply (APPLY_ARG_DEF) const inline bool apply (APPLY_ARG_DEF) const
{ {
APPLY_DEBUG (); TRACE_APPLY ();
return Context::apply (APPLY_ARG, position_lookup); return Context::apply (APPLY_ARG, position_lookup);
} }
}; };
@ -1281,7 +1281,7 @@ struct ChainContextPos : ChainContext
private: private:
inline bool apply (APPLY_ARG_DEF) const inline bool apply (APPLY_ARG_DEF) const
{ {
APPLY_DEBUG (); TRACE_APPLY ();
return ChainContext::apply (APPLY_ARG, position_lookup); return ChainContext::apply (APPLY_ARG, position_lookup);
} }
}; };
@ -1327,7 +1327,7 @@ struct PosLookupSubTable
inline bool apply (APPLY_ARG_DEF, unsigned int lookup_type) const inline bool apply (APPLY_ARG_DEF, unsigned int lookup_type) const
{ {
APPLY_DEBUG (); TRACE_APPLY ();
switch (lookup_type) { switch (lookup_type) {
case Single: return u.single->apply (APPLY_ARG); case Single: return u.single->apply (APPLY_ARG);
case Pair: return u.pair->apply (APPLY_ARG); case Pair: return u.pair->apply (APPLY_ARG);
@ -1343,7 +1343,7 @@ struct PosLookupSubTable
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
if (!SANITIZE (u.format)) return false; if (!SANITIZE (u.format)) return false;
switch (u.format) { switch (u.format) {
case Single: return u.single->sanitize (SANITIZE_ARG); case Single: return u.single->sanitize (SANITIZE_ARG);
@ -1456,7 +1456,7 @@ struct PosLookup : Lookup
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
if (!Lookup::sanitize (SANITIZE_ARG)) return false; if (!Lookup::sanitize (SANITIZE_ARG)) return false;
OffsetArrayOf<PosLookupSubTable> &list = (OffsetArrayOf<PosLookupSubTable> &) subTable; OffsetArrayOf<PosLookupSubTable> &list = (OffsetArrayOf<PosLookupSubTable> &) subTable;
return SANITIZE_THIS (list); return SANITIZE_THIS (list);
@ -1488,7 +1488,7 @@ struct GPOS : GSUBGPOS
{ return get_lookup (lookup_index).apply_string (context, buffer, mask); } { return get_lookup (lookup_index).apply_string (context, buffer, mask); }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
if (!GSUBGPOS::sanitize (SANITIZE_ARG)) return false; if (!GSUBGPOS::sanitize (SANITIZE_ARG)) return false;
OffsetTo<PosLookupList> &list = CAST(OffsetTo<PosLookupList>, lookupList, 0); OffsetTo<PosLookupList> &list = CAST(OffsetTo<PosLookupList>, lookupList, 0);
return SANITIZE_THIS (list); return SANITIZE_THIS (list);
@ -1501,7 +1501,7 @@ ASSERT_SIZE (GPOS, 10);
inline bool ExtensionPos::apply (APPLY_ARG_DEF) const inline bool ExtensionPos::apply (APPLY_ARG_DEF) const
{ {
APPLY_DEBUG (); TRACE_APPLY ();
unsigned int lookup_type = get_type (); unsigned int lookup_type = get_type ();
if (HB_UNLIKELY (lookup_type == PosLookupSubTable::Extension)) if (HB_UNLIKELY (lookup_type == PosLookupSubTable::Extension))
@ -1512,7 +1512,7 @@ inline bool ExtensionPos::apply (APPLY_ARG_DEF) const
inline bool ExtensionPos::sanitize (SANITIZE_ARG_DEF) inline bool ExtensionPos::sanitize (SANITIZE_ARG_DEF)
{ {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
return Extension::sanitize (SANITIZE_ARG) && return Extension::sanitize (SANITIZE_ARG) &&
(&(Extension::get_subtable ()) == &Null(LookupSubTable) || (&(Extension::get_subtable ()) == &Null(LookupSubTable) ||
get_type () == PosLookupSubTable::Extension || get_type () == PosLookupSubTable::Extension ||

View File

@ -38,7 +38,7 @@ struct SingleSubstFormat1
inline bool apply (APPLY_ARG_DEF) const inline bool apply (APPLY_ARG_DEF) const
{ {
APPLY_DEBUG (); TRACE_APPLY ();
hb_codepoint_t glyph_id = IN_CURGLYPH (); hb_codepoint_t glyph_id = IN_CURGLYPH ();
unsigned int index = (this+coverage) (glyph_id); unsigned int index = (this+coverage) (glyph_id);
if (HB_LIKELY (index == NOT_COVERED)) if (HB_LIKELY (index == NOT_COVERED))
@ -55,7 +55,7 @@ struct SingleSubstFormat1
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
return SANITIZE_THIS (coverage) && SANITIZE (deltaGlyphID); return SANITIZE_THIS (coverage) && SANITIZE (deltaGlyphID);
} }
@ -77,7 +77,7 @@ struct SingleSubstFormat2
inline bool apply (APPLY_ARG_DEF) const inline bool apply (APPLY_ARG_DEF) const
{ {
APPLY_DEBUG (); TRACE_APPLY ();
hb_codepoint_t glyph_id = IN_CURGLYPH (); hb_codepoint_t glyph_id = IN_CURGLYPH ();
unsigned int index = (this+coverage) (glyph_id); unsigned int index = (this+coverage) (glyph_id);
if (HB_LIKELY (index == NOT_COVERED)) if (HB_LIKELY (index == NOT_COVERED))
@ -97,7 +97,7 @@ struct SingleSubstFormat2
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
return SANITIZE_THIS (coverage) && SANITIZE (substitute); return SANITIZE_THIS (coverage) && SANITIZE (substitute);
} }
@ -120,7 +120,7 @@ struct SingleSubst
inline bool apply (APPLY_ARG_DEF) const inline bool apply (APPLY_ARG_DEF) const
{ {
APPLY_DEBUG (); TRACE_APPLY ();
switch (u.format) { switch (u.format) {
case 1: return u.format1->apply (APPLY_ARG); case 1: return u.format1->apply (APPLY_ARG);
case 2: return u.format2->apply (APPLY_ARG); case 2: return u.format2->apply (APPLY_ARG);
@ -129,7 +129,7 @@ struct SingleSubst
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
if (!SANITIZE (u.format)) return false; if (!SANITIZE (u.format)) return false;
switch (u.format) { switch (u.format) {
case 1: return u.format1->sanitize (SANITIZE_ARG); case 1: return u.format1->sanitize (SANITIZE_ARG);
@ -155,7 +155,7 @@ struct Sequence
private: private:
inline bool apply (APPLY_ARG_DEF) const inline bool apply (APPLY_ARG_DEF) const
{ {
APPLY_DEBUG (); TRACE_APPLY ();
if (HB_UNLIKELY (!substitute.len)) if (HB_UNLIKELY (!substitute.len))
return false; return false;
@ -179,7 +179,7 @@ struct Sequence
public: public:
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
return SANITIZE (substitute); return SANITIZE (substitute);
} }
@ -197,7 +197,7 @@ struct MultipleSubstFormat1
inline bool apply (APPLY_ARG_DEF) const inline bool apply (APPLY_ARG_DEF) const
{ {
APPLY_DEBUG (); TRACE_APPLY ();
unsigned int index = (this+coverage) (IN_CURGLYPH ()); unsigned int index = (this+coverage) (IN_CURGLYPH ());
if (HB_LIKELY (index == NOT_COVERED)) if (HB_LIKELY (index == NOT_COVERED))
@ -207,7 +207,7 @@ struct MultipleSubstFormat1
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
return SANITIZE_THIS2 (coverage, sequence); return SANITIZE_THIS2 (coverage, sequence);
} }
@ -230,7 +230,7 @@ struct MultipleSubst
inline bool apply (APPLY_ARG_DEF) const inline bool apply (APPLY_ARG_DEF) const
{ {
APPLY_DEBUG (); TRACE_APPLY ();
switch (u.format) { switch (u.format) {
case 1: return u.format1->apply (APPLY_ARG); case 1: return u.format1->apply (APPLY_ARG);
default:return false; default:return false;
@ -238,7 +238,7 @@ struct MultipleSubst
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
if (!SANITIZE (u.format)) return false; if (!SANITIZE (u.format)) return false;
switch (u.format) { switch (u.format) {
case 1: return u.format1->sanitize (SANITIZE_ARG); case 1: return u.format1->sanitize (SANITIZE_ARG);
@ -267,7 +267,7 @@ struct AlternateSubstFormat1
inline bool apply (APPLY_ARG_DEF) const inline bool apply (APPLY_ARG_DEF) const
{ {
APPLY_DEBUG (); TRACE_APPLY ();
hb_codepoint_t glyph_id = IN_CURGLYPH (); hb_codepoint_t glyph_id = IN_CURGLYPH ();
unsigned int index = (this+coverage) (glyph_id); unsigned int index = (this+coverage) (glyph_id);
@ -303,7 +303,7 @@ struct AlternateSubstFormat1
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
return SANITIZE_THIS2 (coverage, alternateSet); return SANITIZE_THIS2 (coverage, alternateSet);
} }
@ -326,7 +326,7 @@ struct AlternateSubst
inline bool apply (APPLY_ARG_DEF) const inline bool apply (APPLY_ARG_DEF) const
{ {
APPLY_DEBUG (); TRACE_APPLY ();
switch (u.format) { switch (u.format) {
case 1: return u.format1->apply (APPLY_ARG); case 1: return u.format1->apply (APPLY_ARG);
default:return false; default:return false;
@ -334,7 +334,7 @@ struct AlternateSubst
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
if (!SANITIZE (u.format)) return false; if (!SANITIZE (u.format)) return false;
switch (u.format) { switch (u.format) {
case 1: return u.format1->sanitize (SANITIZE_ARG); case 1: return u.format1->sanitize (SANITIZE_ARG);
@ -358,7 +358,7 @@ struct Ligature
private: private:
inline bool apply (APPLY_ARG_DEF, bool is_mark) const inline bool apply (APPLY_ARG_DEF, bool is_mark) const
{ {
APPLY_DEBUG (); TRACE_APPLY ();
unsigned int i, j; unsigned int i, j;
unsigned int count = component.len; unsigned int count = component.len;
unsigned int end = MIN (buffer->in_length, buffer->in_pos + context_length); unsigned int end = MIN (buffer->in_length, buffer->in_pos + context_length);
@ -424,7 +424,7 @@ struct Ligature
public: public:
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
return SANITIZE2 (ligGlyph, component); return SANITIZE2 (ligGlyph, component);
} }
@ -444,7 +444,7 @@ struct LigatureSet
private: private:
inline bool apply (APPLY_ARG_DEF, bool is_mark) const inline bool apply (APPLY_ARG_DEF, bool is_mark) const
{ {
APPLY_DEBUG (); TRACE_APPLY ();
unsigned int num_ligs = ligature.len; unsigned int num_ligs = ligature.len;
for (unsigned int i = 0; i < num_ligs; i++) for (unsigned int i = 0; i < num_ligs; i++)
{ {
@ -458,7 +458,7 @@ struct LigatureSet
public: public:
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
return SANITIZE_THIS (ligature); return SANITIZE_THIS (ligature);
} }
@ -476,7 +476,7 @@ struct LigatureSubstFormat1
private: private:
inline bool apply (APPLY_ARG_DEF) const inline bool apply (APPLY_ARG_DEF) const
{ {
APPLY_DEBUG (); TRACE_APPLY ();
hb_codepoint_t glyph_id = IN_CURGLYPH (); hb_codepoint_t glyph_id = IN_CURGLYPH ();
bool first_is_mark = !!(property & HB_OT_LAYOUT_GLYPH_CLASS_MARK); bool first_is_mark = !!(property & HB_OT_LAYOUT_GLYPH_CLASS_MARK);
@ -490,7 +490,7 @@ struct LigatureSubstFormat1
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
return SANITIZE_THIS2 (coverage, ligatureSet); return SANITIZE_THIS2 (coverage, ligatureSet);
} }
@ -512,7 +512,7 @@ struct LigatureSubst
private: private:
inline bool apply (APPLY_ARG_DEF) const inline bool apply (APPLY_ARG_DEF) const
{ {
APPLY_DEBUG (); TRACE_APPLY ();
switch (u.format) { switch (u.format) {
case 1: return u.format1->apply (APPLY_ARG); case 1: return u.format1->apply (APPLY_ARG);
default:return false; default:return false;
@ -520,7 +520,7 @@ struct LigatureSubst
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
if (!SANITIZE (u.format)) return false; if (!SANITIZE (u.format)) return false;
switch (u.format) { switch (u.format) {
case 1: return u.format1->sanitize (SANITIZE_ARG); case 1: return u.format1->sanitize (SANITIZE_ARG);
@ -547,7 +547,7 @@ struct ContextSubst : Context
private: private:
inline bool apply (APPLY_ARG_DEF) const inline bool apply (APPLY_ARG_DEF) const
{ {
APPLY_DEBUG (); TRACE_APPLY ();
return Context::apply (APPLY_ARG, substitute_lookup); return Context::apply (APPLY_ARG, substitute_lookup);
} }
}; };
@ -560,7 +560,7 @@ struct ChainContextSubst : ChainContext
private: private:
inline bool apply (APPLY_ARG_DEF) const inline bool apply (APPLY_ARG_DEF) const
{ {
APPLY_DEBUG (); TRACE_APPLY ();
return ChainContext::apply (APPLY_ARG, substitute_lookup); return ChainContext::apply (APPLY_ARG, substitute_lookup);
} }
}; };
@ -589,7 +589,7 @@ struct ReverseChainSingleSubstFormat1
private: private:
inline bool apply (APPLY_ARG_DEF) const inline bool apply (APPLY_ARG_DEF) const
{ {
APPLY_DEBUG (); TRACE_APPLY ();
if (HB_UNLIKELY (context_length != NO_CONTEXT)) if (HB_UNLIKELY (context_length != NO_CONTEXT))
return false; /* No chaining to this type */ return false; /* No chaining to this type */
@ -617,7 +617,7 @@ struct ReverseChainSingleSubstFormat1
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
if (!SANITIZE_THIS2 (coverage, backtrack)) if (!SANITIZE_THIS2 (coverage, backtrack))
return false; return false;
OffsetArrayOf<Coverage> &lookahead = NEXT (OffsetArrayOf<Coverage>, backtrack); OffsetArrayOf<Coverage> &lookahead = NEXT (OffsetArrayOf<Coverage>, backtrack);
@ -653,7 +653,7 @@ struct ReverseChainSingleSubst
private: private:
inline bool apply (APPLY_ARG_DEF) const inline bool apply (APPLY_ARG_DEF) const
{ {
APPLY_DEBUG (); TRACE_APPLY ();
switch (u.format) { switch (u.format) {
case 1: return u.format1->apply (APPLY_ARG); case 1: return u.format1->apply (APPLY_ARG);
default:return false; default:return false;
@ -661,7 +661,7 @@ struct ReverseChainSingleSubst
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
if (!SANITIZE (u.format)) return false; if (!SANITIZE (u.format)) return false;
switch (u.format) { switch (u.format) {
case 1: return u.format1->sanitize (SANITIZE_ARG); case 1: return u.format1->sanitize (SANITIZE_ARG);
@ -700,7 +700,7 @@ struct SubstLookupSubTable
inline bool apply (APPLY_ARG_DEF, unsigned int lookup_type) const inline bool apply (APPLY_ARG_DEF, unsigned int lookup_type) const
{ {
APPLY_DEBUG (); TRACE_APPLY ();
switch (lookup_type) { switch (lookup_type) {
case Single: return u.single->apply (APPLY_ARG); case Single: return u.single->apply (APPLY_ARG);
case Multiple: return u.multiple->apply (APPLY_ARG); case Multiple: return u.multiple->apply (APPLY_ARG);
@ -715,7 +715,7 @@ struct SubstLookupSubTable
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
if (!SANITIZE (u.format)) return false; if (!SANITIZE (u.format)) return false;
switch (u.format) { switch (u.format) {
case Single: return u.single->sanitize (SANITIZE_ARG); case Single: return u.single->sanitize (SANITIZE_ARG);
@ -840,7 +840,7 @@ struct SubstLookup : Lookup
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
if (!Lookup::sanitize (SANITIZE_ARG)) return false; if (!Lookup::sanitize (SANITIZE_ARG)) return false;
OffsetArrayOf<SubstLookupSubTable> &list = (OffsetArrayOf<SubstLookupSubTable> &) subTable; OffsetArrayOf<SubstLookupSubTable> &list = (OffsetArrayOf<SubstLookupSubTable> &) subTable;
return SANITIZE_THIS (list); return SANITIZE_THIS (list);
@ -873,7 +873,7 @@ struct GSUB : GSUBGPOS
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
if (!GSUBGPOS::sanitize (SANITIZE_ARG)) return false; if (!GSUBGPOS::sanitize (SANITIZE_ARG)) return false;
OffsetTo<SubstLookupList> &list = CAST(OffsetTo<SubstLookupList>, lookupList, 0); OffsetTo<SubstLookupList> &list = CAST(OffsetTo<SubstLookupList>, lookupList, 0);
return SANITIZE_THIS (list); return SANITIZE_THIS (list);
@ -886,7 +886,7 @@ ASSERT_SIZE (GSUB, 10);
inline bool ExtensionSubst::apply (APPLY_ARG_DEF) const inline bool ExtensionSubst::apply (APPLY_ARG_DEF) const
{ {
APPLY_DEBUG (); TRACE_APPLY ();
unsigned int lookup_type = get_type (); unsigned int lookup_type = get_type ();
if (HB_UNLIKELY (lookup_type == SubstLookupSubTable::Extension)) if (HB_UNLIKELY (lookup_type == SubstLookupSubTable::Extension))
@ -897,7 +897,7 @@ inline bool ExtensionSubst::apply (APPLY_ARG_DEF) const
inline bool ExtensionSubst::sanitize (SANITIZE_ARG_DEF) inline bool ExtensionSubst::sanitize (SANITIZE_ARG_DEF)
{ {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
return Extension::sanitize (SANITIZE_ARG) && return Extension::sanitize (SANITIZE_ARG) &&
(&(Extension::get_subtable ()) == &Null(LookupSubTable) || (&(Extension::get_subtable ()) == &Null(LookupSubTable) ||
get_type () == SubstLookupSubTable::Extension || get_type () == SubstLookupSubTable::Extension ||

View File

@ -36,10 +36,10 @@
#endif #endif
#if HB_DEBUG_APPLY #if HB_DEBUG_APPLY
#define APPLY_DEBUG_ARG_DEF , unsigned int apply_depth #define TRACE_APPLY_ARG_DEF , unsigned int apply_depth
#define APPLY_DEBUG_ARG , apply_depth + 1 #define TRACE_APPLY_ARG , apply_depth + 1
#define APPLY_DEBUG_ARG_INIT , 1 #define TRACE_APPLY_ARG_INIT , 1
#define APPLY_DEBUG() \ #define TRACE_APPLY() \
HB_STMT_START { \ HB_STMT_START { \
if (apply_depth < HB_DEBUG_APPLY) \ if (apply_depth < HB_DEBUG_APPLY) \
fprintf (stderr, "APPLY(%p) %-*d-> %s\n", \ fprintf (stderr, "APPLY(%p) %-*d-> %s\n", \
@ -48,10 +48,10 @@
__PRETTY_FUNCTION__); \ __PRETTY_FUNCTION__); \
} HB_STMT_END } HB_STMT_END
#else #else
#define APPLY_DEBUG_ARG_DEF #define TRACE_APPLY_ARG_DEF
#define APPLY_DEBUG_ARG #define TRACE_APPLY_ARG
#define APPLY_DEBUG_ARG_INIT #define TRACE_APPLY_ARG_INIT
#define APPLY_DEBUG() HB_STMT_START {} HB_STMT_END #define TRACE_APPLY() HB_STMT_START {} HB_STMT_END
#endif #endif
#define APPLY_ARG_DEF \ #define APPLY_ARG_DEF \
@ -61,7 +61,7 @@
unsigned int nesting_level_left HB_GNUC_UNUSED, \ unsigned int nesting_level_left HB_GNUC_UNUSED, \
unsigned int lookup_flag, \ unsigned int lookup_flag, \
unsigned int property HB_GNUC_UNUSED /* propety of first glyph */ \ unsigned int property HB_GNUC_UNUSED /* propety of first glyph */ \
APPLY_DEBUG_ARG_DEF TRACE_APPLY_ARG_DEF
#define APPLY_ARG \ #define APPLY_ARG \
context, \ context, \
buffer, \ buffer, \
@ -69,7 +69,7 @@
nesting_level_left, \ nesting_level_left, \
lookup_flag, \ lookup_flag, \
property \ property \
APPLY_DEBUG_ARG TRACE_APPLY_ARG
#define APPLY_ARG_INIT \ #define APPLY_ARG_INIT \
context, \ context, \
buffer, \ buffer, \
@ -77,7 +77,7 @@
nesting_level_left, \ nesting_level_left, \
lookup_flag, \ lookup_flag, \
property \ property \
APPLY_DEBUG_ARG_INIT TRACE_APPLY_ARG_INIT
typedef bool (*match_func_t) (hb_codepoint_t glyph_id, const USHORT &value, char *data); typedef bool (*match_func_t) (hb_codepoint_t glyph_id, const USHORT &value, char *data);
@ -196,7 +196,7 @@ struct LookupRecord
{ {
public: public:
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
return SANITIZE_SELF (); return SANITIZE_SELF ();
} }
@ -290,7 +290,7 @@ struct Rule
private: private:
inline bool apply (APPLY_ARG_DEF, ContextLookupContext &lookup_context) const inline bool apply (APPLY_ARG_DEF, ContextLookupContext &lookup_context) const
{ {
APPLY_DEBUG (); TRACE_APPLY ();
const LookupRecord *lookupRecord = &CONST_CAST (LookupRecord, input, sizeof (input[0]) * (inputCount ? inputCount - 1 : 0)); const LookupRecord *lookupRecord = &CONST_CAST (LookupRecord, input, sizeof (input[0]) * (inputCount ? inputCount - 1 : 0));
return context_lookup (APPLY_ARG, return context_lookup (APPLY_ARG,
inputCount, input, inputCount, input,
@ -300,7 +300,7 @@ struct Rule
public: public:
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
if (!SANITIZE_SELF ()) return false; if (!SANITIZE_SELF ()) return false;
return SANITIZE_MEM (input, return SANITIZE_MEM (input,
sizeof (input[0]) * inputCount + sizeof (input[0]) * inputCount +
@ -323,7 +323,7 @@ struct RuleSet
{ {
inline bool apply (APPLY_ARG_DEF, ContextLookupContext &lookup_context) const inline bool apply (APPLY_ARG_DEF, ContextLookupContext &lookup_context) const
{ {
APPLY_DEBUG (); TRACE_APPLY ();
unsigned int num_rules = rule.len; unsigned int num_rules = rule.len;
for (unsigned int i = 0; i < num_rules; i++) for (unsigned int i = 0; i < num_rules; i++)
{ {
@ -335,7 +335,7 @@ struct RuleSet
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
return SANITIZE_THIS (rule); return SANITIZE_THIS (rule);
} }
@ -353,7 +353,7 @@ struct ContextFormat1
private: private:
inline bool apply (APPLY_ARG_DEF, apply_lookup_func_t apply_func) const inline bool apply (APPLY_ARG_DEF, apply_lookup_func_t apply_func) const
{ {
APPLY_DEBUG (); TRACE_APPLY ();
unsigned int index = (this+coverage) (IN_CURGLYPH ()); unsigned int index = (this+coverage) (IN_CURGLYPH ());
if (HB_LIKELY (index == NOT_COVERED)) if (HB_LIKELY (index == NOT_COVERED))
return false; return false;
@ -367,7 +367,7 @@ struct ContextFormat1
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
return SANITIZE_THIS2 (coverage, ruleSet); return SANITIZE_THIS2 (coverage, ruleSet);
} }
@ -390,7 +390,7 @@ struct ContextFormat2
private: private:
inline bool apply (APPLY_ARG_DEF, apply_lookup_func_t apply_func) const inline bool apply (APPLY_ARG_DEF, apply_lookup_func_t apply_func) const
{ {
APPLY_DEBUG (); TRACE_APPLY ();
unsigned int index = (this+coverage) (IN_CURGLYPH ()); unsigned int index = (this+coverage) (IN_CURGLYPH ());
if (HB_LIKELY (index == NOT_COVERED)) if (HB_LIKELY (index == NOT_COVERED))
return false; return false;
@ -409,7 +409,7 @@ struct ContextFormat2
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
return SANITIZE_THIS3 (coverage, classDef, ruleSet); return SANITIZE_THIS3 (coverage, classDef, ruleSet);
} }
@ -435,7 +435,7 @@ struct ContextFormat3
private: private:
inline bool apply (APPLY_ARG_DEF, apply_lookup_func_t apply_func) const inline bool apply (APPLY_ARG_DEF, apply_lookup_func_t apply_func) const
{ {
APPLY_DEBUG (); TRACE_APPLY ();
unsigned int index = (this+coverage[0]) (IN_CURGLYPH ()); unsigned int index = (this+coverage[0]) (IN_CURGLYPH ());
if (HB_LIKELY (index == NOT_COVERED)) if (HB_LIKELY (index == NOT_COVERED))
return false; return false;
@ -452,7 +452,7 @@ struct ContextFormat3
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
if (!SANITIZE_SELF ()) return false; if (!SANITIZE_SELF ()) return false;
unsigned int count = glyphCount; unsigned int count = glyphCount;
for (unsigned int i = 0; i < count; i++) for (unsigned int i = 0; i < count; i++)
@ -479,7 +479,7 @@ struct Context
protected: protected:
inline bool apply (APPLY_ARG_DEF, apply_lookup_func_t apply_func) const inline bool apply (APPLY_ARG_DEF, apply_lookup_func_t apply_func) const
{ {
APPLY_DEBUG (); TRACE_APPLY ();
switch (u.format) { switch (u.format) {
case 1: return u.format1->apply (APPLY_ARG, apply_func); case 1: return u.format1->apply (APPLY_ARG, apply_func);
case 2: return u.format2->apply (APPLY_ARG, apply_func); case 2: return u.format2->apply (APPLY_ARG, apply_func);
@ -489,7 +489,7 @@ struct Context
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
if (!SANITIZE (u.format)) return false; if (!SANITIZE (u.format)) return false;
switch (u.format) { switch (u.format) {
case 1: return u.format1->sanitize (SANITIZE_ARG); case 1: return u.format1->sanitize (SANITIZE_ARG);
@ -561,7 +561,7 @@ struct ChainRule
private: private:
inline bool apply (APPLY_ARG_DEF, ChainContextLookupContext &lookup_context) const inline bool apply (APPLY_ARG_DEF, ChainContextLookupContext &lookup_context) const
{ {
APPLY_DEBUG (); TRACE_APPLY ();
const HeadlessArrayOf<USHORT> &input = CONST_NEXT (HeadlessArrayOf<USHORT>, backtrack); const HeadlessArrayOf<USHORT> &input = CONST_NEXT (HeadlessArrayOf<USHORT>, backtrack);
const ArrayOf<USHORT> &lookahead = CONST_NEXT (ArrayOf<USHORT>, input); const ArrayOf<USHORT> &lookahead = CONST_NEXT (ArrayOf<USHORT>, input);
const ArrayOf<LookupRecord> &lookup = CONST_NEXT (ArrayOf<LookupRecord>, lookahead); const ArrayOf<LookupRecord> &lookup = CONST_NEXT (ArrayOf<LookupRecord>, lookahead);
@ -576,7 +576,7 @@ struct ChainRule
public: public:
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
if (!SANITIZE (backtrack)) return false; if (!SANITIZE (backtrack)) return false;
HeadlessArrayOf<USHORT> &input = NEXT (HeadlessArrayOf<USHORT>, backtrack); HeadlessArrayOf<USHORT> &input = NEXT (HeadlessArrayOf<USHORT>, backtrack);
if (!SANITIZE (input)) return false; if (!SANITIZE (input)) return false;
@ -607,7 +607,7 @@ struct ChainRuleSet
{ {
inline bool apply (APPLY_ARG_DEF, ChainContextLookupContext &lookup_context) const inline bool apply (APPLY_ARG_DEF, ChainContextLookupContext &lookup_context) const
{ {
APPLY_DEBUG (); TRACE_APPLY ();
unsigned int num_rules = rule.len; unsigned int num_rules = rule.len;
for (unsigned int i = 0; i < num_rules; i++) for (unsigned int i = 0; i < num_rules; i++)
{ {
@ -619,7 +619,7 @@ struct ChainRuleSet
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
return SANITIZE_THIS (rule); return SANITIZE_THIS (rule);
} }
@ -637,7 +637,7 @@ struct ChainContextFormat1
private: private:
inline bool apply (APPLY_ARG_DEF, apply_lookup_func_t apply_func) const inline bool apply (APPLY_ARG_DEF, apply_lookup_func_t apply_func) const
{ {
APPLY_DEBUG (); TRACE_APPLY ();
unsigned int index = (this+coverage) (IN_CURGLYPH ()); unsigned int index = (this+coverage) (IN_CURGLYPH ());
if (HB_LIKELY (index == NOT_COVERED)) if (HB_LIKELY (index == NOT_COVERED))
return false; return false;
@ -651,7 +651,7 @@ struct ChainContextFormat1
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
return SANITIZE_THIS2 (coverage, ruleSet); return SANITIZE_THIS2 (coverage, ruleSet);
} }
@ -673,7 +673,7 @@ struct ChainContextFormat2
private: private:
inline bool apply (APPLY_ARG_DEF, apply_lookup_func_t apply_func) const inline bool apply (APPLY_ARG_DEF, apply_lookup_func_t apply_func) const
{ {
APPLY_DEBUG (); TRACE_APPLY ();
unsigned int index = (this+coverage) (IN_CURGLYPH ()); unsigned int index = (this+coverage) (IN_CURGLYPH ());
if (HB_LIKELY (index == NOT_COVERED)) if (HB_LIKELY (index == NOT_COVERED))
return false; return false;
@ -697,7 +697,7 @@ struct ChainContextFormat2
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
return SANITIZE_THIS2 (coverage, backtrackClassDef) && return SANITIZE_THIS2 (coverage, backtrackClassDef) &&
SANITIZE_THIS2 (inputClassDef, lookaheadClassDef) && SANITIZE_THIS2 (inputClassDef, lookaheadClassDef) &&
SANITIZE_THIS (ruleSet); SANITIZE_THIS (ruleSet);
@ -734,7 +734,7 @@ struct ChainContextFormat3
inline bool apply (APPLY_ARG_DEF, apply_lookup_func_t apply_func) const inline bool apply (APPLY_ARG_DEF, apply_lookup_func_t apply_func) const
{ {
APPLY_DEBUG (); TRACE_APPLY ();
const OffsetArrayOf<Coverage> &input = CONST_NEXT (OffsetArrayOf<Coverage>, backtrack); const OffsetArrayOf<Coverage> &input = CONST_NEXT (OffsetArrayOf<Coverage>, backtrack);
unsigned int index = (this+input[0]) (IN_CURGLYPH ()); unsigned int index = (this+input[0]) (IN_CURGLYPH ());
@ -757,7 +757,7 @@ struct ChainContextFormat3
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
if (!SANITIZE_THIS (backtrack)) return false; if (!SANITIZE_THIS (backtrack)) return false;
OffsetArrayOf<Coverage> &input = NEXT (OffsetArrayOf<Coverage>, backtrack); OffsetArrayOf<Coverage> &input = NEXT (OffsetArrayOf<Coverage>, backtrack);
if (!SANITIZE_THIS (input)) return false; if (!SANITIZE_THIS (input)) return false;
@ -792,7 +792,7 @@ struct ChainContext
protected: protected:
inline bool apply (APPLY_ARG_DEF, apply_lookup_func_t apply_func) const inline bool apply (APPLY_ARG_DEF, apply_lookup_func_t apply_func) const
{ {
APPLY_DEBUG (); TRACE_APPLY ();
switch (u.format) { switch (u.format) {
case 1: return u.format1->apply (APPLY_ARG, apply_func); case 1: return u.format1->apply (APPLY_ARG, apply_func);
case 2: return u.format2->apply (APPLY_ARG, apply_func); case 2: return u.format2->apply (APPLY_ARG, apply_func);
@ -802,7 +802,7 @@ struct ChainContext
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
if (!SANITIZE (u.format)) return false; if (!SANITIZE (u.format)) return false;
switch (u.format) { switch (u.format) {
case 1: return u.format1->sanitize (SANITIZE_ARG); case 1: return u.format1->sanitize (SANITIZE_ARG);
@ -838,7 +838,7 @@ struct ExtensionFormat1
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
return SANITIZE_SELF (); return SANITIZE_SELF ();
} }
@ -872,7 +872,7 @@ struct Extension
} }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
if (!SANITIZE (u.format)) return false; if (!SANITIZE (u.format)) return false;
switch (u.format) { switch (u.format) {
case 1: return u.format1->sanitize (SANITIZE_ARG); case 1: return u.format1->sanitize (SANITIZE_ARG);
@ -930,7 +930,7 @@ struct GSUBGPOS
{ return (this+lookupList)[i]; } { return (this+lookupList)[i]; }
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
SANITIZE_DEBUG (); TRACE_SANITIZE ();
if (!SANITIZE (version)) return false; if (!SANITIZE (version)) return false;
if (version.major != 1) return true; if (version.major != 1) return true;
return SANITIZE_THIS3 (scriptList, featureList, lookupList); return SANITIZE_THIS3 (scriptList, featureList, lookupList);