Pass this object to trace macros
This commit is contained in:
parent
902cc8aca0
commit
be218c688c
|
@ -54,7 +54,7 @@ struct TTCHeader;
|
|||
typedef struct TableRecord
|
||||
{
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
return TRACE_RETURN (c->check_struct (this));
|
||||
}
|
||||
|
||||
|
@ -103,7 +103,7 @@ typedef struct OffsetTable
|
|||
|
||||
public:
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
return TRACE_RETURN (c->check_struct (this) && c->check_array (tables, TableRecord::static_size, numTables));
|
||||
}
|
||||
|
||||
|
@ -131,7 +131,7 @@ struct TTCHeaderVersion1
|
|||
inline const OpenTypeFontFace& get_face (unsigned int i) const { return this+table[i]; }
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
return TRACE_RETURN (table.sanitize (c, this));
|
||||
}
|
||||
|
||||
|
@ -170,7 +170,7 @@ struct TTCHeader
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
if (unlikely (!u.header.version.sanitize (c))) return TRACE_RETURN (false);
|
||||
switch (u.header.version.major) {
|
||||
case 2: /* version 2 is compatible with version 1 */
|
||||
|
@ -232,7 +232,7 @@ struct OpenTypeFontFile
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
if (unlikely (!u.tag.sanitize (c))) return TRACE_RETURN (false);
|
||||
switch (u.tag) {
|
||||
case CFFTag: /* All the non-collection tags */
|
||||
|
|
|
@ -166,7 +166,7 @@ ASSERT_STATIC (Type::min_size + 1 <= sizeof (_Null##Type))
|
|||
#endif
|
||||
|
||||
|
||||
#define TRACE_SANITIZE() \
|
||||
#define TRACE_SANITIZE(this) \
|
||||
hb_auto_trace_t<HB_DEBUG_SANITIZE, bool> trace \
|
||||
(&c->debug_depth, "SANITIZE", this, HB_FUNC, \
|
||||
"");
|
||||
|
@ -342,7 +342,7 @@ struct Sanitizer
|
|||
#endif
|
||||
|
||||
|
||||
#define TRACE_SERIALIZE() \
|
||||
#define TRACE_SERIALIZE(this) \
|
||||
hb_auto_trace_t<HB_DEBUG_SERIALIZE, bool> trace \
|
||||
(&c->debug_depth, "SERIALIZE", c, HB_FUNC, \
|
||||
"");
|
||||
|
@ -539,7 +539,7 @@ struct IntType
|
|||
inline int cmp (IntType<Type> va) const { Type a = va; Type b = v; return a < b ? -1 : a == b ? 0 : +1; }
|
||||
inline int cmp (Type a) const { Type b = v; return a < b ? -1 : a == b ? 0 : +1; }
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
return TRACE_RETURN (likely (c->check_struct (this)));
|
||||
}
|
||||
protected:
|
||||
|
@ -564,7 +564,7 @@ typedef USHORT UFWORD;
|
|||
struct LONGDATETIME
|
||||
{
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
return TRACE_RETURN (likely (c->check_struct (this)));
|
||||
}
|
||||
private:
|
||||
|
@ -628,7 +628,7 @@ struct FixedVersion
|
|||
inline uint32_t to_int (void) const { return (major << 16) + minor; }
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
return TRACE_RETURN (c->check_struct (this));
|
||||
}
|
||||
|
||||
|
@ -668,7 +668,7 @@ struct GenericOffsetTo : OffsetType
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c, void *base) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
if (unlikely (!c->check_struct (this))) return TRACE_RETURN (false);
|
||||
unsigned int offset = *this;
|
||||
if (unlikely (!offset)) return TRACE_RETURN (true);
|
||||
|
@ -677,7 +677,7 @@ struct GenericOffsetTo : OffsetType
|
|||
}
|
||||
template <typename T>
|
||||
inline bool sanitize (hb_sanitize_context_t *c, void *base, T user_data) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
if (unlikely (!c->check_struct (this))) return TRACE_RETURN (false);
|
||||
unsigned int offset = *this;
|
||||
if (unlikely (!offset)) return TRACE_RETURN (true);
|
||||
|
@ -741,7 +741,7 @@ struct GenericArrayOf
|
|||
inline bool serialize (hb_serialize_context_t *c,
|
||||
unsigned int items_len)
|
||||
{
|
||||
TRACE_SERIALIZE ();
|
||||
TRACE_SERIALIZE (this);
|
||||
if (unlikely (!c->extend_min (*this))) return TRACE_RETURN (false);
|
||||
len.set (items_len); /* TODO(serialize) Overflow? */
|
||||
if (unlikely (!c->extend (*this))) return TRACE_RETURN (false);
|
||||
|
@ -752,7 +752,7 @@ struct GenericArrayOf
|
|||
Supplier<Type> &items,
|
||||
unsigned int items_len)
|
||||
{
|
||||
TRACE_SERIALIZE ();
|
||||
TRACE_SERIALIZE (this);
|
||||
if (unlikely (!serialize (c, items_len))) return TRACE_RETURN (false);
|
||||
for (unsigned int i = 0; i < items_len; i++)
|
||||
array[i] = items[i];
|
||||
|
@ -761,7 +761,7 @@ struct GenericArrayOf
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
if (unlikely (!sanitize_shallow (c))) return TRACE_RETURN (false);
|
||||
|
||||
/* Note: for structs that do not reference other structs,
|
||||
|
@ -776,7 +776,7 @@ struct GenericArrayOf
|
|||
return TRACE_RETURN (true);
|
||||
}
|
||||
inline bool sanitize (hb_sanitize_context_t *c, void *base) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
if (unlikely (!sanitize_shallow (c))) return TRACE_RETURN (false);
|
||||
unsigned int count = len;
|
||||
for (unsigned int i = 0; i < count; i++)
|
||||
|
@ -786,7 +786,7 @@ struct GenericArrayOf
|
|||
}
|
||||
template <typename T>
|
||||
inline bool sanitize (hb_sanitize_context_t *c, void *base, T user_data) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
if (unlikely (!sanitize_shallow (c))) return TRACE_RETURN (false);
|
||||
unsigned int count = len;
|
||||
for (unsigned int i = 0; i < count; i++)
|
||||
|
@ -797,7 +797,7 @@ struct GenericArrayOf
|
|||
|
||||
private:
|
||||
inline bool sanitize_shallow (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
return TRACE_RETURN (c->check_struct (this) && c->check_array (this, Type::static_size, len));
|
||||
}
|
||||
|
||||
|
@ -839,12 +839,12 @@ struct OffsetListOf : OffsetArrayOf<Type>
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
return TRACE_RETURN (OffsetArrayOf<Type>::sanitize (c, this));
|
||||
}
|
||||
template <typename T>
|
||||
inline bool sanitize (hb_sanitize_context_t *c, T user_data) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
return TRACE_RETURN (OffsetArrayOf<Type>::sanitize (c, this, user_data));
|
||||
}
|
||||
};
|
||||
|
@ -867,7 +867,7 @@ struct HeadlessArrayOf
|
|||
Supplier<Type> &items,
|
||||
unsigned int items_len)
|
||||
{
|
||||
TRACE_SERIALIZE ();
|
||||
TRACE_SERIALIZE (this);
|
||||
if (unlikely (!c->extend_min (*this))) return TRACE_RETURN (false);
|
||||
len.set (items_len); /* TODO(serialize) Overflow? */
|
||||
if (unlikely (!items_len)) return TRACE_RETURN (true);
|
||||
|
@ -884,7 +884,7 @@ struct HeadlessArrayOf
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
if (unlikely (!sanitize_shallow (c))) return TRACE_RETURN (false);
|
||||
|
||||
/* Note: for structs that do not reference other structs,
|
||||
|
|
|
@ -52,7 +52,7 @@ struct head
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
return TRACE_RETURN (c->check_struct (this) && likely (version.major == 1));
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ struct hhea
|
|||
static const hb_tag_t Tag = HB_OT_TAG_hhea;
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
return TRACE_RETURN (c->check_struct (this) && likely (version.major == 1));
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ struct hmtx
|
|||
static const hb_tag_t Tag = HB_OT_TAG_hmtx;
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
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);
|
||||
|
|
|
@ -61,7 +61,7 @@ struct Record
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c, void *base) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
return TRACE_RETURN (c->check_struct (this) && offset.sanitize (c, base));
|
||||
}
|
||||
|
||||
|
@ -115,7 +115,7 @@ struct RecordListOf : RecordArrayOf<Type>
|
|||
{ return this+RecordArrayOf<Type>::operator [](i).offset; }
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
return TRACE_RETURN (RecordArrayOf<Type>::sanitize (c, this));
|
||||
}
|
||||
};
|
||||
|
@ -129,7 +129,7 @@ struct RangeRecord
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
return TRACE_RETURN (c->check_struct (this));
|
||||
}
|
||||
|
||||
|
@ -193,7 +193,7 @@ struct LangSys
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
return TRACE_RETURN (c->check_struct (this) && featureIndex.sanitize (c));
|
||||
}
|
||||
|
||||
|
@ -231,7 +231,7 @@ struct Script
|
|||
inline const LangSys& get_default_lang_sys (void) const { return this+defaultLangSys; }
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
return TRACE_RETURN (defaultLangSys.sanitize (c, this) && langSys.sanitize (c, this));
|
||||
}
|
||||
|
||||
|
@ -261,7 +261,7 @@ struct Feature
|
|||
{ return lookupIndex.get_indexes (start_index, lookup_count, lookup_tags); }
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
return TRACE_RETURN (c->check_struct (this) && lookupIndex.sanitize (c));
|
||||
}
|
||||
|
||||
|
@ -318,7 +318,7 @@ struct Lookup
|
|||
uint32_t lookup_props,
|
||||
unsigned int num_subtables)
|
||||
{
|
||||
TRACE_SERIALIZE ();
|
||||
TRACE_SERIALIZE (this);
|
||||
if (unlikely (!c->extend_min (*this))) return TRACE_RETURN (false);
|
||||
lookupType.set (lookup_type);
|
||||
lookupFlag.set (lookup_props & 0xFFFF);
|
||||
|
@ -332,7 +332,7 @@ struct Lookup
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
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 (lookupFlag & LookupFlag::UseMarkFilteringSet)
|
||||
|
@ -377,7 +377,7 @@ struct CoverageFormat1
|
|||
Supplier<GlyphID> &glyphs,
|
||||
unsigned int num_glyphs)
|
||||
{
|
||||
TRACE_SERIALIZE ();
|
||||
TRACE_SERIALIZE (this);
|
||||
if (unlikely (!c->extend_min (*this))) return TRACE_RETURN (false);
|
||||
glyphArray.len.set (num_glyphs);
|
||||
if (unlikely (!c->extend (glyphArray))) return TRACE_RETURN (false);
|
||||
|
@ -388,7 +388,7 @@ struct CoverageFormat1
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
return TRACE_RETURN (glyphArray.sanitize (c));
|
||||
}
|
||||
|
||||
|
@ -445,7 +445,7 @@ struct CoverageFormat2
|
|||
Supplier<GlyphID> &glyphs,
|
||||
unsigned int num_glyphs)
|
||||
{
|
||||
TRACE_SERIALIZE ();
|
||||
TRACE_SERIALIZE (this);
|
||||
if (unlikely (!c->extend_min (*this))) return TRACE_RETURN (false);
|
||||
|
||||
if (unlikely (!num_glyphs)) return TRACE_RETURN (true);
|
||||
|
@ -474,7 +474,7 @@ struct CoverageFormat2
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
return TRACE_RETURN (rangeRecord.sanitize (c));
|
||||
}
|
||||
|
||||
|
@ -556,7 +556,7 @@ struct Coverage
|
|||
Supplier<GlyphID> &glyphs,
|
||||
unsigned int num_glyphs)
|
||||
{
|
||||
TRACE_SERIALIZE ();
|
||||
TRACE_SERIALIZE (this);
|
||||
if (unlikely (!c->extend_min (*this))) return TRACE_RETURN (false);
|
||||
unsigned int num_ranges = 1;
|
||||
for (unsigned int i = 1; i < num_glyphs; i++)
|
||||
|
@ -571,7 +571,7 @@ struct Coverage
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
if (!u.format.sanitize (c)) return TRACE_RETURN (false);
|
||||
switch (u.format) {
|
||||
case 1: return TRACE_RETURN (u.format1.sanitize (c));
|
||||
|
@ -682,7 +682,7 @@ struct ClassDefFormat1
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
return TRACE_RETURN (c->check_struct (this) && classValue.sanitize (c));
|
||||
}
|
||||
|
||||
|
@ -725,7 +725,7 @@ struct ClassDefFormat2
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
return TRACE_RETURN (rangeRecord.sanitize (c));
|
||||
}
|
||||
|
||||
|
@ -768,7 +768,7 @@ struct ClassDef
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
if (!u.format.sanitize (c)) return TRACE_RETURN (false);
|
||||
switch (u.format) {
|
||||
case 1: return TRACE_RETURN (u.format1.sanitize (c));
|
||||
|
@ -860,7 +860,7 @@ struct Device
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
return TRACE_RETURN (c->check_struct (this) && c->check_range (this, this->get_size ()));
|
||||
}
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ struct AttachList
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
return TRACE_RETURN (coverage.sanitize (c, this) && attachPoint.sanitize (c, this));
|
||||
}
|
||||
|
||||
|
@ -102,7 +102,7 @@ struct CaretValueFormat1
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
return TRACE_RETURN (c->check_struct (this));
|
||||
}
|
||||
|
||||
|
@ -128,7 +128,7 @@ struct CaretValueFormat2
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
return TRACE_RETURN (c->check_struct (this));
|
||||
}
|
||||
|
||||
|
@ -151,7 +151,7 @@ struct CaretValueFormat3
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
return TRACE_RETURN (c->check_struct (this) && deviceTable.sanitize (c, this));
|
||||
}
|
||||
|
||||
|
@ -179,7 +179,7 @@ struct CaretValue
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
if (!u.format.sanitize (c)) return TRACE_RETURN (false);
|
||||
switch (u.format) {
|
||||
case 1: return TRACE_RETURN (u.format1.sanitize (c));
|
||||
|
@ -220,7 +220,7 @@ struct LigGlyph
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
return TRACE_RETURN (carets.sanitize (c, this));
|
||||
}
|
||||
|
||||
|
@ -254,7 +254,7 @@ struct LigCaretList
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
return TRACE_RETURN (coverage.sanitize (c, this) && ligGlyph.sanitize (c, this));
|
||||
}
|
||||
|
||||
|
@ -276,7 +276,7 @@ struct MarkGlyphSetsFormat1
|
|||
{ return (this+coverage[set_index]).get_coverage (glyph_id) != NOT_COVERED; }
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
return TRACE_RETURN (coverage.sanitize (c, this));
|
||||
}
|
||||
|
||||
|
@ -300,7 +300,7 @@ struct MarkGlyphSets
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
if (!u.format.sanitize (c)) return TRACE_RETURN (false);
|
||||
switch (u.format) {
|
||||
case 1: return TRACE_RETURN (u.format1.sanitize (c));
|
||||
|
@ -365,7 +365,7 @@ struct GDEF
|
|||
{ return version.to_int () >= 0x00010002 && (this+markGlyphSetsDef[0]).covers (set_index, glyph_id); }
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
return TRACE_RETURN (version.sanitize (c) &&
|
||||
likely (version.major == 1) &&
|
||||
glyphClassDef.sanitize (c, this) &&
|
||||
|
|
|
@ -172,12 +172,12 @@ struct ValueFormat : USHORT
|
|||
}
|
||||
|
||||
inline bool sanitize_value (hb_sanitize_context_t *c, void *base, Value *values) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
return TRACE_RETURN (c->check_range (values, get_size ()) && (!has_device () || sanitize_value_devices (c, base, values)));
|
||||
}
|
||||
|
||||
inline bool sanitize_values (hb_sanitize_context_t *c, void *base, Value *values, unsigned int count) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
unsigned int len = get_len ();
|
||||
|
||||
if (!c->check_array (values, get_size (), count)) return TRACE_RETURN (false);
|
||||
|
@ -195,7 +195,7 @@ struct ValueFormat : USHORT
|
|||
|
||||
/* Just sanitize referenced Device tables. Doesn't check the values themselves. */
|
||||
inline bool sanitize_values_stride_unsafe (hb_sanitize_context_t *c, void *base, Value *values, unsigned int count, unsigned int stride) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
|
||||
if (!has_device ()) return TRACE_RETURN (true);
|
||||
|
||||
|
@ -220,7 +220,7 @@ struct AnchorFormat1
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
return TRACE_RETURN (c->check_struct (this));
|
||||
}
|
||||
|
||||
|
@ -249,7 +249,7 @@ struct AnchorFormat2
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
return TRACE_RETURN (c->check_struct (this));
|
||||
}
|
||||
|
||||
|
@ -277,7 +277,7 @@ struct AnchorFormat3
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
return TRACE_RETURN (c->check_struct (this) && xDeviceTable.sanitize (c, this) && yDeviceTable.sanitize (c, this));
|
||||
}
|
||||
|
||||
|
@ -312,7 +312,7 @@ struct Anchor
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
if (!u.format.sanitize (c)) return TRACE_RETURN (false);
|
||||
switch (u.format) {
|
||||
case 1: return TRACE_RETURN (u.format1.sanitize (c));
|
||||
|
@ -342,7 +342,7 @@ struct AnchorMatrix
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c, unsigned int cols) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
if (!c->check_struct (this)) return TRACE_RETURN (false);
|
||||
if (unlikely (rows > 0 && cols >= ((unsigned int) -1) / rows)) return TRACE_RETURN (false);
|
||||
unsigned int count = rows * cols;
|
||||
|
@ -367,7 +367,7 @@ struct MarkRecord
|
|||
friend struct MarkArray;
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c, void *base) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
return TRACE_RETURN (c->check_struct (this) && markAnchor.sanitize (c, base));
|
||||
}
|
||||
|
||||
|
@ -387,7 +387,7 @@ struct MarkArray : ArrayOf<MarkRecord> /* Array of MarkRecords--in Coverage orde
|
|||
const AnchorMatrix &anchors, unsigned int class_count,
|
||||
unsigned int glyph_pos) const
|
||||
{
|
||||
TRACE_APPLY ();
|
||||
TRACE_APPLY (this);
|
||||
const MarkRecord &record = ArrayOf<MarkRecord>::operator[](mark_index);
|
||||
unsigned int mark_class = record.klass;
|
||||
|
||||
|
@ -409,7 +409,7 @@ struct MarkArray : ArrayOf<MarkRecord> /* Array of MarkRecords--in Coverage orde
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
return TRACE_RETURN (ArrayOf<MarkRecord>::sanitize (c, this));
|
||||
}
|
||||
};
|
||||
|
@ -426,7 +426,7 @@ struct SinglePosFormat1
|
|||
|
||||
inline bool apply (hb_apply_context_t *c) const
|
||||
{
|
||||
TRACE_APPLY ();
|
||||
TRACE_APPLY (this);
|
||||
unsigned int index = (this+coverage) (c->buffer->cur().codepoint);
|
||||
if (likely (index == NOT_COVERED)) return TRACE_RETURN (false);
|
||||
|
||||
|
@ -438,7 +438,7 @@ struct SinglePosFormat1
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
return TRACE_RETURN (c->check_struct (this) && coverage.sanitize (c, this) && valueFormat.sanitize_value (c, this, values));
|
||||
}
|
||||
|
||||
|
@ -465,7 +465,7 @@ struct SinglePosFormat2
|
|||
|
||||
inline bool apply (hb_apply_context_t *c) const
|
||||
{
|
||||
TRACE_APPLY ();
|
||||
TRACE_APPLY (this);
|
||||
unsigned int index = (this+coverage) (c->buffer->cur().codepoint);
|
||||
if (likely (index == NOT_COVERED)) return TRACE_RETURN (false);
|
||||
|
||||
|
@ -480,7 +480,7 @@ struct SinglePosFormat2
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
return TRACE_RETURN (c->check_struct (this) && coverage.sanitize (c, this) && valueFormat.sanitize_values (c, this, values, valueCount));
|
||||
}
|
||||
|
||||
|
@ -511,7 +511,7 @@ struct SinglePos
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
if (!u.format.sanitize (c)) return TRACE_RETURN (false);
|
||||
switch (u.format) {
|
||||
case 1: return TRACE_RETURN (u.format1.sanitize (c));
|
||||
|
@ -551,7 +551,7 @@ struct PairSet
|
|||
const ValueFormat *valueFormats,
|
||||
unsigned int pos) const
|
||||
{
|
||||
TRACE_APPLY ();
|
||||
TRACE_APPLY (this);
|
||||
unsigned int len1 = valueFormats[0].get_len ();
|
||||
unsigned int len2 = valueFormats[1].get_len ();
|
||||
unsigned int record_size = USHORT::static_size * (1 + len1 + len2);
|
||||
|
@ -585,7 +585,7 @@ struct PairSet
|
|||
};
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c, const sanitize_closure_t *closure) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
if (!(c->check_struct (this)
|
||||
&& c->check_array (array, USHORT::static_size * closure->stride, len))) return TRACE_RETURN (false);
|
||||
|
||||
|
@ -612,7 +612,7 @@ struct PairPosFormat1
|
|||
|
||||
inline bool apply (hb_apply_context_t *c) const
|
||||
{
|
||||
TRACE_APPLY ();
|
||||
TRACE_APPLY (this);
|
||||
hb_apply_context_t::mark_skipping_forward_iterator_t skippy_iter (c, c->buffer->idx, 1);
|
||||
if (skippy_iter.has_no_chance ()) return TRACE_RETURN (false);
|
||||
|
||||
|
@ -625,7 +625,7 @@ struct PairPosFormat1
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
|
||||
unsigned int len1 = valueFormat1.get_len ();
|
||||
unsigned int len2 = valueFormat2.get_len ();
|
||||
|
@ -666,7 +666,7 @@ struct PairPosFormat2
|
|||
|
||||
inline bool apply (hb_apply_context_t *c) const
|
||||
{
|
||||
TRACE_APPLY ();
|
||||
TRACE_APPLY (this);
|
||||
hb_apply_context_t::mark_skipping_forward_iterator_t skippy_iter (c, c->buffer->idx, 1);
|
||||
if (skippy_iter.has_no_chance ()) return TRACE_RETURN (false);
|
||||
|
||||
|
@ -697,7 +697,7 @@ struct PairPosFormat2
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
if (!(c->check_struct (this)
|
||||
&& coverage.sanitize (c, this)
|
||||
&& classDef1.sanitize (c, this)
|
||||
|
@ -756,7 +756,7 @@ struct PairPos
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
if (!u.format.sanitize (c)) return TRACE_RETURN (false);
|
||||
switch (u.format) {
|
||||
case 1: return TRACE_RETURN (u.format1.sanitize (c));
|
||||
|
@ -779,7 +779,7 @@ struct EntryExitRecord
|
|||
friend struct CursivePosFormat1;
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c, void *base) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
return TRACE_RETURN (entryAnchor.sanitize (c, base) && exitAnchor.sanitize (c, base));
|
||||
}
|
||||
|
||||
|
@ -805,7 +805,7 @@ struct CursivePosFormat1
|
|||
|
||||
inline bool apply (hb_apply_context_t *c) const
|
||||
{
|
||||
TRACE_APPLY ();
|
||||
TRACE_APPLY (this);
|
||||
|
||||
/* We don't handle mark glyphs here. */
|
||||
if (c->property & HB_OT_LAYOUT_GLYPH_PROPS_MARK) return TRACE_RETURN (false);
|
||||
|
@ -886,7 +886,7 @@ struct CursivePosFormat1
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
return TRACE_RETURN (coverage.sanitize (c, this) && entryExitRecord.sanitize (c, this));
|
||||
}
|
||||
|
||||
|
@ -914,7 +914,7 @@ struct CursivePos
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
if (!u.format.sanitize (c)) return TRACE_RETURN (false);
|
||||
switch (u.format) {
|
||||
case 1: return TRACE_RETURN (u.format1.sanitize (c));
|
||||
|
@ -944,7 +944,7 @@ struct MarkBasePosFormat1
|
|||
|
||||
inline bool apply (hb_apply_context_t *c) const
|
||||
{
|
||||
TRACE_APPLY ();
|
||||
TRACE_APPLY (this);
|
||||
unsigned int mark_index = (this+markCoverage) (c->buffer->cur().codepoint);
|
||||
if (likely (mark_index == NOT_COVERED)) return TRACE_RETURN (false);
|
||||
|
||||
|
@ -968,7 +968,7 @@ struct MarkBasePosFormat1
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
return TRACE_RETURN (c->check_struct (this) && markCoverage.sanitize (c, this) && baseCoverage.sanitize (c, this) &&
|
||||
markArray.sanitize (c, this) && baseArray.sanitize (c, this, (unsigned int) classCount));
|
||||
}
|
||||
|
@ -1004,7 +1004,7 @@ struct MarkBasePos
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
if (!u.format.sanitize (c)) return TRACE_RETURN (false);
|
||||
switch (u.format) {
|
||||
case 1: return TRACE_RETURN (u.format1.sanitize (c));
|
||||
|
@ -1039,7 +1039,7 @@ struct MarkLigPosFormat1
|
|||
|
||||
inline bool apply (hb_apply_context_t *c) const
|
||||
{
|
||||
TRACE_APPLY ();
|
||||
TRACE_APPLY (this);
|
||||
unsigned int mark_index = (this+markCoverage) (c->buffer->cur().codepoint);
|
||||
if (likely (mark_index == NOT_COVERED)) return TRACE_RETURN (false);
|
||||
|
||||
|
@ -1079,7 +1079,7 @@ struct MarkLigPosFormat1
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
return TRACE_RETURN (c->check_struct (this) && markCoverage.sanitize (c, this) && ligatureCoverage.sanitize (c, this) &&
|
||||
markArray.sanitize (c, this) && ligatureArray.sanitize (c, this, (unsigned int) classCount));
|
||||
}
|
||||
|
@ -1116,7 +1116,7 @@ struct MarkLigPos
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
if (!u.format.sanitize (c)) return TRACE_RETURN (false);
|
||||
switch (u.format) {
|
||||
case 1: return TRACE_RETURN (u.format1.sanitize (c));
|
||||
|
@ -1146,7 +1146,7 @@ struct MarkMarkPosFormat1
|
|||
|
||||
inline bool apply (hb_apply_context_t *c) const
|
||||
{
|
||||
TRACE_APPLY ();
|
||||
TRACE_APPLY (this);
|
||||
unsigned int mark1_index = (this+mark1Coverage) (c->buffer->cur().codepoint);
|
||||
if (likely (mark1_index == NOT_COVERED)) return TRACE_RETURN (false);
|
||||
|
||||
|
@ -1187,7 +1187,7 @@ struct MarkMarkPosFormat1
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
return TRACE_RETURN (c->check_struct (this) && mark1Coverage.sanitize (c, this) &&
|
||||
mark2Coverage.sanitize (c, this) && mark1Array.sanitize (c, this)
|
||||
&& mark2Array.sanitize (c, this, (unsigned int) classCount));
|
||||
|
@ -1226,7 +1226,7 @@ struct MarkMarkPos
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
if (!u.format.sanitize (c)) return TRACE_RETURN (false);
|
||||
switch (u.format) {
|
||||
case 1: return TRACE_RETURN (u.format1.sanitize (c));
|
||||
|
@ -1317,7 +1317,7 @@ struct PosLookupSubTable
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c, unsigned int lookup_type) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
if (!u.header.sub_format.sanitize (c))
|
||||
return TRACE_RETURN (false);
|
||||
switch (lookup_type) {
|
||||
|
@ -1423,7 +1423,7 @@ struct PosLookup : Lookup
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
if (unlikely (!Lookup::sanitize (c))) return TRACE_RETURN (false);
|
||||
OffsetArrayOf<PosLookupSubTable> &list = CastR<OffsetArrayOf<PosLookupSubTable> > (subTable);
|
||||
return TRACE_RETURN (list.sanitize (c, this, get_type ()));
|
||||
|
@ -1451,7 +1451,7 @@ struct GPOS : GSUBGPOS
|
|||
static inline void position_finish (hb_font_t *font, hb_buffer_t *buffer, hb_bool_t zero_width_attahced_marks);
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
if (unlikely (!GSUBGPOS::sanitize (c))) return TRACE_RETURN (false);
|
||||
OffsetTo<PosLookupList> &list = CastR<OffsetTo<PosLookupList> > (lookupList);
|
||||
return TRACE_RETURN (list.sanitize (c, this));
|
||||
|
@ -1548,7 +1548,7 @@ inline typename context_t::return_t ExtensionPos::process (context_t *c) const
|
|||
|
||||
inline bool ExtensionPos::sanitize (hb_sanitize_context_t *c)
|
||||
{
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
if (unlikely (!Extension::sanitize (c))) return TRACE_RETURN (false);
|
||||
unsigned int offset = get_offset ();
|
||||
if (unlikely (!offset)) return TRACE_RETURN (true);
|
||||
|
|
|
@ -39,7 +39,7 @@ struct SingleSubstFormat1
|
|||
{
|
||||
inline void closure (hb_closure_context_t *c) const
|
||||
{
|
||||
TRACE_CLOSURE ();
|
||||
TRACE_CLOSURE (this);
|
||||
Coverage::Iter iter;
|
||||
for (iter.init (this+coverage); iter.more (); iter.next ()) {
|
||||
hb_codepoint_t glyph_id = iter.get_glyph ();
|
||||
|
@ -65,13 +65,13 @@ struct SingleSubstFormat1
|
|||
|
||||
inline bool would_apply (hb_would_apply_context_t *c) const
|
||||
{
|
||||
TRACE_WOULD_APPLY ();
|
||||
TRACE_WOULD_APPLY (this);
|
||||
return TRACE_RETURN (c->len == 1 && (this+coverage) (c->glyphs[0]) != NOT_COVERED);
|
||||
}
|
||||
|
||||
inline bool apply (hb_apply_context_t *c) const
|
||||
{
|
||||
TRACE_APPLY ();
|
||||
TRACE_APPLY (this);
|
||||
hb_codepoint_t glyph_id = c->buffer->cur().codepoint;
|
||||
unsigned int index = (this+coverage) (glyph_id);
|
||||
if (likely (index == NOT_COVERED)) return TRACE_RETURN (false);
|
||||
|
@ -89,7 +89,7 @@ struct SingleSubstFormat1
|
|||
unsigned int num_glyphs,
|
||||
int delta)
|
||||
{
|
||||
TRACE_SERIALIZE ();
|
||||
TRACE_SERIALIZE (this);
|
||||
if (unlikely (!c->extend_min (*this))) return TRACE_RETURN (false);
|
||||
if (unlikely (!coverage.serialize (c, this).serialize (c, glyphs, num_glyphs))) return TRACE_RETURN (false);
|
||||
deltaGlyphID.set (delta); /* TODO(serilaize) overflow? */
|
||||
|
@ -97,7 +97,7 @@ struct SingleSubstFormat1
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
return TRACE_RETURN (coverage.sanitize (c, this) && deltaGlyphID.sanitize (c));
|
||||
}
|
||||
|
||||
|
@ -116,7 +116,7 @@ struct SingleSubstFormat2
|
|||
{
|
||||
inline void closure (hb_closure_context_t *c) const
|
||||
{
|
||||
TRACE_CLOSURE ();
|
||||
TRACE_CLOSURE (this);
|
||||
Coverage::Iter iter;
|
||||
for (iter.init (this+coverage); iter.more (); iter.next ()) {
|
||||
if (c->glyphs->has (iter.get_glyph ()))
|
||||
|
@ -140,13 +140,13 @@ struct SingleSubstFormat2
|
|||
|
||||
inline bool would_apply (hb_would_apply_context_t *c) const
|
||||
{
|
||||
TRACE_WOULD_APPLY ();
|
||||
TRACE_WOULD_APPLY (this);
|
||||
return TRACE_RETURN (c->len == 1 && (this+coverage) (c->glyphs[0]) != NOT_COVERED);
|
||||
}
|
||||
|
||||
inline bool apply (hb_apply_context_t *c) const
|
||||
{
|
||||
TRACE_APPLY ();
|
||||
TRACE_APPLY (this);
|
||||
hb_codepoint_t glyph_id = c->buffer->cur().codepoint;
|
||||
unsigned int index = (this+coverage) (glyph_id);
|
||||
if (likely (index == NOT_COVERED)) return TRACE_RETURN (false);
|
||||
|
@ -164,7 +164,7 @@ struct SingleSubstFormat2
|
|||
Supplier<GlyphID> &substitutes,
|
||||
unsigned int num_glyphs)
|
||||
{
|
||||
TRACE_SERIALIZE ();
|
||||
TRACE_SERIALIZE (this);
|
||||
if (unlikely (!c->extend_min (*this))) return TRACE_RETURN (false);
|
||||
if (unlikely (!substitute.serialize (c, substitutes, num_glyphs))) return TRACE_RETURN (false);
|
||||
if (unlikely (!coverage.serialize (c, this).serialize (c, glyphs, num_glyphs))) return TRACE_RETURN (false);
|
||||
|
@ -172,7 +172,7 @@ struct SingleSubstFormat2
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
return TRACE_RETURN (coverage.sanitize (c, this) && substitute.sanitize (c));
|
||||
}
|
||||
|
||||
|
@ -205,7 +205,7 @@ struct SingleSubst
|
|||
Supplier<GlyphID> &substitutes,
|
||||
unsigned int num_glyphs)
|
||||
{
|
||||
TRACE_SERIALIZE ();
|
||||
TRACE_SERIALIZE (this);
|
||||
if (unlikely (!c->extend_min (u.format))) return TRACE_RETURN (false);
|
||||
unsigned int format = 2;
|
||||
int delta;
|
||||
|
@ -228,7 +228,7 @@ struct SingleSubst
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
if (!u.format.sanitize (c)) return TRACE_RETURN (false);
|
||||
switch (u.format) {
|
||||
case 1: return TRACE_RETURN (u.format1.sanitize (c));
|
||||
|
@ -250,7 +250,7 @@ struct Sequence
|
|||
{
|
||||
inline void closure (hb_closure_context_t *c) const
|
||||
{
|
||||
TRACE_CLOSURE ();
|
||||
TRACE_CLOSURE (this);
|
||||
unsigned int count = substitute.len;
|
||||
for (unsigned int i = 0; i < count; i++)
|
||||
c->glyphs->add (substitute[i]);
|
||||
|
@ -265,7 +265,7 @@ struct Sequence
|
|||
|
||||
inline bool apply (hb_apply_context_t *c) const
|
||||
{
|
||||
TRACE_APPLY ();
|
||||
TRACE_APPLY (this);
|
||||
if (unlikely (!substitute.len)) return TRACE_RETURN (false);
|
||||
|
||||
unsigned int klass = c->property & HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE ? HB_OT_LAYOUT_GLYPH_PROPS_BASE_GLYPH : 0;
|
||||
|
@ -283,14 +283,14 @@ struct Sequence
|
|||
Supplier<GlyphID> &glyphs,
|
||||
unsigned int num_glyphs)
|
||||
{
|
||||
TRACE_SERIALIZE ();
|
||||
TRACE_SERIALIZE (this);
|
||||
if (unlikely (!c->extend_min (*this))) return TRACE_RETURN (false);
|
||||
if (unlikely (!substitute.serialize (c, glyphs, num_glyphs))) return TRACE_RETURN (false);
|
||||
return TRACE_RETURN (true);
|
||||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
return TRACE_RETURN (substitute.sanitize (c));
|
||||
}
|
||||
|
||||
|
@ -305,7 +305,7 @@ struct MultipleSubstFormat1
|
|||
{
|
||||
inline void closure (hb_closure_context_t *c) const
|
||||
{
|
||||
TRACE_CLOSURE ();
|
||||
TRACE_CLOSURE (this);
|
||||
Coverage::Iter iter;
|
||||
for (iter.init (this+coverage); iter.more (); iter.next ()) {
|
||||
if (c->glyphs->has (iter.get_glyph ()))
|
||||
|
@ -328,13 +328,13 @@ struct MultipleSubstFormat1
|
|||
|
||||
inline bool would_apply (hb_would_apply_context_t *c) const
|
||||
{
|
||||
TRACE_WOULD_APPLY ();
|
||||
TRACE_WOULD_APPLY (this);
|
||||
return TRACE_RETURN (c->len == 1 && (this+coverage) (c->glyphs[0]) != NOT_COVERED);
|
||||
}
|
||||
|
||||
inline bool apply (hb_apply_context_t *c) const
|
||||
{
|
||||
TRACE_APPLY ();
|
||||
TRACE_APPLY (this);
|
||||
|
||||
unsigned int index = (this+coverage) (c->buffer->cur().codepoint);
|
||||
if (likely (index == NOT_COVERED)) return TRACE_RETURN (false);
|
||||
|
@ -348,7 +348,7 @@ struct MultipleSubstFormat1
|
|||
unsigned int num_glyphs,
|
||||
Supplier<GlyphID> &substitute_glyphs_list)
|
||||
{
|
||||
TRACE_SERIALIZE ();
|
||||
TRACE_SERIALIZE (this);
|
||||
if (unlikely (!c->extend_min (*this))) return TRACE_RETURN (false);
|
||||
if (unlikely (!sequence.serialize (c, num_glyphs))) return TRACE_RETURN (false);
|
||||
for (unsigned int i = 0; i < num_glyphs; i++)
|
||||
|
@ -361,7 +361,7 @@ struct MultipleSubstFormat1
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
return TRACE_RETURN (coverage.sanitize (c, this) && sequence.sanitize (c, this));
|
||||
}
|
||||
|
||||
|
@ -394,7 +394,7 @@ struct MultipleSubst
|
|||
unsigned int num_glyphs,
|
||||
Supplier<GlyphID> &substitute_glyphs_list)
|
||||
{
|
||||
TRACE_SERIALIZE ();
|
||||
TRACE_SERIALIZE (this);
|
||||
if (unlikely (!c->extend_min (u.format))) return TRACE_RETURN (false);
|
||||
unsigned int format = 1;
|
||||
u.format.set (format);
|
||||
|
@ -405,7 +405,7 @@ struct MultipleSubst
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
if (!u.format.sanitize (c)) return TRACE_RETURN (false);
|
||||
switch (u.format) {
|
||||
case 1: return TRACE_RETURN (u.format1.sanitize (c));
|
||||
|
@ -428,7 +428,7 @@ struct AlternateSubstFormat1
|
|||
{
|
||||
inline void closure (hb_closure_context_t *c) const
|
||||
{
|
||||
TRACE_CLOSURE ();
|
||||
TRACE_CLOSURE (this);
|
||||
Coverage::Iter iter;
|
||||
for (iter.init (this+coverage); iter.more (); iter.next ()) {
|
||||
if (c->glyphs->has (iter.get_glyph ())) {
|
||||
|
@ -459,13 +459,13 @@ struct AlternateSubstFormat1
|
|||
|
||||
inline bool would_apply (hb_would_apply_context_t *c) const
|
||||
{
|
||||
TRACE_WOULD_APPLY ();
|
||||
TRACE_WOULD_APPLY (this);
|
||||
return TRACE_RETURN (c->len == 1 && (this+coverage) (c->glyphs[0]) != NOT_COVERED);
|
||||
}
|
||||
|
||||
inline bool apply (hb_apply_context_t *c) const
|
||||
{
|
||||
TRACE_APPLY ();
|
||||
TRACE_APPLY (this);
|
||||
hb_codepoint_t glyph_id = c->buffer->cur().codepoint;
|
||||
|
||||
unsigned int index = (this+coverage) (glyph_id);
|
||||
|
@ -497,7 +497,7 @@ struct AlternateSubstFormat1
|
|||
unsigned int num_glyphs,
|
||||
Supplier<GlyphID> &alternate_glyphs_list)
|
||||
{
|
||||
TRACE_SERIALIZE ();
|
||||
TRACE_SERIALIZE (this);
|
||||
if (unlikely (!c->extend_min (*this))) return TRACE_RETURN (false);
|
||||
if (unlikely (!alternateSet.serialize (c, num_glyphs))) return TRACE_RETURN (false);
|
||||
for (unsigned int i = 0; i < num_glyphs; i++)
|
||||
|
@ -510,7 +510,7 @@ struct AlternateSubstFormat1
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
return TRACE_RETURN (coverage.sanitize (c, this) && alternateSet.sanitize (c, this));
|
||||
}
|
||||
|
||||
|
@ -543,7 +543,7 @@ struct AlternateSubst
|
|||
unsigned int num_glyphs,
|
||||
Supplier<GlyphID> &alternate_glyphs_list)
|
||||
{
|
||||
TRACE_SERIALIZE ();
|
||||
TRACE_SERIALIZE (this);
|
||||
if (unlikely (!c->extend_min (u.format))) return TRACE_RETURN (false);
|
||||
unsigned int format = 1;
|
||||
u.format.set (format);
|
||||
|
@ -554,7 +554,7 @@ struct AlternateSubst
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
if (!u.format.sanitize (c)) return TRACE_RETURN (false);
|
||||
switch (u.format) {
|
||||
case 1: return TRACE_RETURN (u.format1.sanitize (c));
|
||||
|
@ -574,7 +574,7 @@ struct Ligature
|
|||
{
|
||||
inline void closure (hb_closure_context_t *c) const
|
||||
{
|
||||
TRACE_CLOSURE ();
|
||||
TRACE_CLOSURE (this);
|
||||
unsigned int count = component.len;
|
||||
for (unsigned int i = 1; i < count; i++)
|
||||
if (!c->glyphs->has (component[i]))
|
||||
|
@ -592,7 +592,7 @@ struct Ligature
|
|||
|
||||
inline bool would_apply (hb_would_apply_context_t *c) const
|
||||
{
|
||||
TRACE_WOULD_APPLY ();
|
||||
TRACE_WOULD_APPLY (this);
|
||||
if (c->len != component.len)
|
||||
return TRACE_RETURN (false);
|
||||
|
||||
|
@ -605,7 +605,7 @@ struct Ligature
|
|||
|
||||
inline bool apply (hb_apply_context_t *c) const
|
||||
{
|
||||
TRACE_APPLY ();
|
||||
TRACE_APPLY (this);
|
||||
unsigned int count = component.len;
|
||||
if (unlikely (count < 1)) return TRACE_RETURN (false);
|
||||
|
||||
|
@ -642,7 +642,7 @@ struct Ligature
|
|||
Supplier<GlyphID> &components, /* Starting from second */
|
||||
unsigned int num_components /* Including first component */)
|
||||
{
|
||||
TRACE_SERIALIZE ();
|
||||
TRACE_SERIALIZE (this);
|
||||
if (unlikely (!c->extend_min (*this))) return TRACE_RETURN (false);
|
||||
ligGlyph = ligature;
|
||||
if (unlikely (!component.serialize (c, components, num_components))) return TRACE_RETURN (false);
|
||||
|
@ -651,7 +651,7 @@ struct Ligature
|
|||
|
||||
public:
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
return TRACE_RETURN (ligGlyph.sanitize (c) && component.sanitize (c));
|
||||
}
|
||||
|
||||
|
@ -669,7 +669,7 @@ struct LigatureSet
|
|||
{
|
||||
inline void closure (hb_closure_context_t *c) const
|
||||
{
|
||||
TRACE_CLOSURE ();
|
||||
TRACE_CLOSURE (this);
|
||||
unsigned int num_ligs = ligature.len;
|
||||
for (unsigned int i = 0; i < num_ligs; i++)
|
||||
(this+ligature[i]).closure (c);
|
||||
|
@ -684,7 +684,7 @@ struct LigatureSet
|
|||
|
||||
inline bool would_apply (hb_would_apply_context_t *c) const
|
||||
{
|
||||
TRACE_WOULD_APPLY ();
|
||||
TRACE_WOULD_APPLY (this);
|
||||
unsigned int num_ligs = ligature.len;
|
||||
for (unsigned int i = 0; i < num_ligs; i++)
|
||||
{
|
||||
|
@ -697,7 +697,7 @@ struct LigatureSet
|
|||
|
||||
inline bool apply (hb_apply_context_t *c) const
|
||||
{
|
||||
TRACE_APPLY ();
|
||||
TRACE_APPLY (this);
|
||||
unsigned int num_ligs = ligature.len;
|
||||
for (unsigned int i = 0; i < num_ligs; i++)
|
||||
{
|
||||
|
@ -714,7 +714,7 @@ struct LigatureSet
|
|||
unsigned int num_ligatures,
|
||||
Supplier<GlyphID> &component_list /* Starting from second for each ligature */)
|
||||
{
|
||||
TRACE_SERIALIZE ();
|
||||
TRACE_SERIALIZE (this);
|
||||
if (unlikely (!c->extend_min (*this))) return TRACE_RETURN (false);
|
||||
if (unlikely (!ligature.serialize (c, num_ligatures))) return TRACE_RETURN (false);
|
||||
for (unsigned int i = 0; i < num_ligatures; i++)
|
||||
|
@ -728,7 +728,7 @@ struct LigatureSet
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
return TRACE_RETURN (ligature.sanitize (c, this));
|
||||
}
|
||||
|
||||
|
@ -744,7 +744,7 @@ struct LigatureSubstFormat1
|
|||
{
|
||||
inline void closure (hb_closure_context_t *c) const
|
||||
{
|
||||
TRACE_CLOSURE ();
|
||||
TRACE_CLOSURE (this);
|
||||
Coverage::Iter iter;
|
||||
for (iter.init (this+coverage); iter.more (); iter.next ()) {
|
||||
if (c->glyphs->has (iter.get_glyph ()))
|
||||
|
@ -768,7 +768,7 @@ struct LigatureSubstFormat1
|
|||
|
||||
inline bool would_apply (hb_would_apply_context_t *c) const
|
||||
{
|
||||
TRACE_WOULD_APPLY ();
|
||||
TRACE_WOULD_APPLY (this);
|
||||
unsigned int index = (this+coverage) (c->glyphs[0]);
|
||||
if (likely (index == NOT_COVERED)) return TRACE_RETURN (false);
|
||||
|
||||
|
@ -778,7 +778,7 @@ struct LigatureSubstFormat1
|
|||
|
||||
inline bool apply (hb_apply_context_t *c) const
|
||||
{
|
||||
TRACE_APPLY ();
|
||||
TRACE_APPLY (this);
|
||||
hb_codepoint_t glyph_id = c->buffer->cur().codepoint;
|
||||
|
||||
unsigned int index = (this+coverage) (glyph_id);
|
||||
|
@ -796,7 +796,7 @@ struct LigatureSubstFormat1
|
|||
Supplier<unsigned int> &component_count_list,
|
||||
Supplier<GlyphID> &component_list /* Starting from second for each ligature */)
|
||||
{
|
||||
TRACE_SERIALIZE ();
|
||||
TRACE_SERIALIZE (this);
|
||||
if (unlikely (!c->extend_min (*this))) return TRACE_RETURN (false);
|
||||
if (unlikely (!ligatureSet.serialize (c, num_first_glyphs))) return TRACE_RETURN (false);
|
||||
for (unsigned int i = 0; i < num_first_glyphs; i++)
|
||||
|
@ -811,7 +811,7 @@ struct LigatureSubstFormat1
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
return TRACE_RETURN (coverage.sanitize (c, this) && ligatureSet.sanitize (c, this));
|
||||
}
|
||||
|
||||
|
@ -846,7 +846,7 @@ struct LigatureSubst
|
|||
Supplier<unsigned int> &component_count_list,
|
||||
Supplier<GlyphID> &component_list /* Starting from second for each ligature */)
|
||||
{
|
||||
TRACE_SERIALIZE ();
|
||||
TRACE_SERIALIZE (this);
|
||||
if (unlikely (!c->extend_min (u.format))) return TRACE_RETURN (false);
|
||||
unsigned int format = 1;
|
||||
u.format.set (format);
|
||||
|
@ -858,7 +858,7 @@ struct LigatureSubst
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
if (!u.format.sanitize (c)) return TRACE_RETURN (false);
|
||||
switch (u.format) {
|
||||
case 1: return TRACE_RETURN (u.format1.sanitize (c));
|
||||
|
@ -915,7 +915,7 @@ struct ReverseChainSingleSubstFormat1
|
|||
{
|
||||
inline void closure (hb_closure_context_t *c) const
|
||||
{
|
||||
TRACE_CLOSURE ();
|
||||
TRACE_CLOSURE (this);
|
||||
const OffsetArrayOf<Coverage> &lookahead = StructAfter<OffsetArrayOf<Coverage> > (backtrack);
|
||||
|
||||
unsigned int count;
|
||||
|
@ -967,13 +967,13 @@ struct ReverseChainSingleSubstFormat1
|
|||
|
||||
inline bool would_apply (hb_would_apply_context_t *c) const
|
||||
{
|
||||
TRACE_WOULD_APPLY ();
|
||||
TRACE_WOULD_APPLY (this);
|
||||
return TRACE_RETURN (c->len == 1 && (this+coverage) (c->glyphs[0]) != NOT_COVERED);
|
||||
}
|
||||
|
||||
inline bool apply (hb_apply_context_t *c) const
|
||||
{
|
||||
TRACE_APPLY ();
|
||||
TRACE_APPLY (this);
|
||||
if (unlikely (c->nesting_level_left != MAX_NESTING_LEVEL))
|
||||
return TRACE_RETURN (false); /* No chaining to this type */
|
||||
|
||||
|
@ -1000,7 +1000,7 @@ struct ReverseChainSingleSubstFormat1
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
if (!(coverage.sanitize (c, this) && backtrack.sanitize (c, this)))
|
||||
return TRACE_RETURN (false);
|
||||
OffsetArrayOf<Coverage> &lookahead = StructAfter<OffsetArrayOf<Coverage> > (backtrack);
|
||||
|
@ -1042,7 +1042,7 @@ struct ReverseChainSingleSubst
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
if (!u.format.sanitize (c)) return TRACE_RETURN (false);
|
||||
switch (u.format) {
|
||||
case 1: return TRACE_RETURN (u.format1.sanitize (c));
|
||||
|
@ -1095,7 +1095,7 @@ struct SubstLookupSubTable
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c, unsigned int lookup_type) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
if (!u.header.sub_format.sanitize (c))
|
||||
return TRACE_RETURN (false);
|
||||
switch (lookup_type) {
|
||||
|
@ -1176,7 +1176,7 @@ struct SubstLookup : Lookup
|
|||
|
||||
inline bool would_apply (hb_would_apply_context_t *c, const hb_set_digest_t *digest) const
|
||||
{
|
||||
TRACE_WOULD_APPLY ();
|
||||
TRACE_WOULD_APPLY (this);
|
||||
if (unlikely (!c->len)) return TRACE_RETURN (false);
|
||||
if (!digest->may_have (c->glyphs[0])) return TRACE_RETURN (false);
|
||||
return TRACE_RETURN (process (c));
|
||||
|
@ -1251,7 +1251,7 @@ struct SubstLookup : Lookup
|
|||
Supplier<GlyphID> &substitutes,
|
||||
unsigned int num_glyphs)
|
||||
{
|
||||
TRACE_SERIALIZE ();
|
||||
TRACE_SERIALIZE (this);
|
||||
if (unlikely (!Lookup::serialize (c, SubstLookupSubTable::Single, lookup_props, 1))) return TRACE_RETURN (false);
|
||||
return TRACE_RETURN (serialize_subtable (c, 0).u.single.serialize (c, glyphs, substitutes, num_glyphs));
|
||||
}
|
||||
|
@ -1263,7 +1263,7 @@ struct SubstLookup : Lookup
|
|||
unsigned int num_glyphs,
|
||||
Supplier<GlyphID> &substitute_glyphs_list)
|
||||
{
|
||||
TRACE_SERIALIZE ();
|
||||
TRACE_SERIALIZE (this);
|
||||
if (unlikely (!Lookup::serialize (c, SubstLookupSubTable::Multiple, lookup_props, 1))) return TRACE_RETURN (false);
|
||||
return TRACE_RETURN (serialize_subtable (c, 0).u.multiple.serialize (c, glyphs, substitute_len_list, num_glyphs,
|
||||
substitute_glyphs_list));
|
||||
|
@ -1276,7 +1276,7 @@ struct SubstLookup : Lookup
|
|||
unsigned int num_glyphs,
|
||||
Supplier<GlyphID> &alternate_glyphs_list)
|
||||
{
|
||||
TRACE_SERIALIZE ();
|
||||
TRACE_SERIALIZE (this);
|
||||
if (unlikely (!Lookup::serialize (c, SubstLookupSubTable::Alternate, lookup_props, 1))) return TRACE_RETURN (false);
|
||||
return TRACE_RETURN (serialize_subtable (c, 0).u.alternate.serialize (c, glyphs, alternate_len_list, num_glyphs,
|
||||
alternate_glyphs_list));
|
||||
|
@ -1291,7 +1291,7 @@ struct SubstLookup : Lookup
|
|||
Supplier<unsigned int> &component_count_list,
|
||||
Supplier<GlyphID> &component_list /* Starting from second for each ligature */)
|
||||
{
|
||||
TRACE_SERIALIZE ();
|
||||
TRACE_SERIALIZE (this);
|
||||
if (unlikely (!Lookup::serialize (c, SubstLookupSubTable::Ligature, lookup_props, 1))) return TRACE_RETURN (false);
|
||||
return TRACE_RETURN (serialize_subtable (c, 0).u.ligature.serialize (c, first_glyphs, ligature_per_first_glyph_count_list, num_first_glyphs,
|
||||
ligatures_list, component_count_list, component_list));
|
||||
|
@ -1299,7 +1299,7 @@ struct SubstLookup : Lookup
|
|||
|
||||
inline bool sanitize (hb_sanitize_context_t *c)
|
||||
{
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
if (unlikely (!Lookup::sanitize (c))) return TRACE_RETURN (false);
|
||||
OffsetArrayOf<SubstLookupSubTable> &list = CastR<OffsetArrayOf<SubstLookupSubTable> > (subTable);
|
||||
if (unlikely (!list.sanitize (c, this, get_type ()))) return TRACE_RETURN (false);
|
||||
|
@ -1362,7 +1362,7 @@ struct GSUB : GSUBGPOS
|
|||
#endif
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
if (unlikely (!GSUBGPOS::sanitize (c))) return TRACE_RETURN (false);
|
||||
OffsetTo<SubstLookupList> &list = CastR<OffsetTo<SubstLookupList> > (lookupList);
|
||||
return TRACE_RETURN (list.sanitize (c, this));
|
||||
|
@ -1403,7 +1403,7 @@ inline typename context_t::return_t ExtensionSubst::process (context_t *c) const
|
|||
|
||||
inline bool ExtensionSubst::sanitize (hb_sanitize_context_t *c)
|
||||
{
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
if (unlikely (!Extension::sanitize (c))) return TRACE_RETURN (false);
|
||||
unsigned int offset = get_offset ();
|
||||
if (unlikely (!offset)) return TRACE_RETURN (true);
|
||||
|
|
|
@ -42,7 +42,7 @@ namespace OT {
|
|||
#define HB_DEBUG_CLOSURE (HB_DEBUG+0)
|
||||
#endif
|
||||
|
||||
#define TRACE_CLOSURE() \
|
||||
#define TRACE_CLOSURE(this) \
|
||||
hb_auto_trace_t<HB_DEBUG_CLOSURE, void_t> trace \
|
||||
(&c->debug_depth, "CLOSURE", this, HB_FUNC, \
|
||||
"");
|
||||
|
@ -89,7 +89,7 @@ struct hb_closure_context_t
|
|||
#define HB_DEBUG_WOULD_APPLY (HB_DEBUG+0)
|
||||
#endif
|
||||
|
||||
#define TRACE_WOULD_APPLY() \
|
||||
#define TRACE_WOULD_APPLY(this) \
|
||||
hb_auto_trace_t<HB_DEBUG_WOULD_APPLY, bool> trace \
|
||||
(&c->debug_depth, "WOULD_APPLY", this, HB_FUNC, \
|
||||
"%d glyphs", c->len);
|
||||
|
@ -126,7 +126,7 @@ struct hb_would_apply_context_t
|
|||
#define HB_DEBUG_COLLECT_GLYPHS (HB_DEBUG+0)
|
||||
#endif
|
||||
|
||||
#define TRACE_COLLECT_GLYPHS() \
|
||||
#define TRACE_COLLECT_GLYPHS(this) \
|
||||
hb_auto_trace_t<HB_DEBUG_COLLECT_GLYPHS, void_t> trace \
|
||||
(&c->debug_depth, "COLLECT_GLYPHS", this, HB_FUNC, \
|
||||
"");
|
||||
|
@ -187,7 +187,7 @@ struct hb_get_coverage_context_t
|
|||
#define HB_DEBUG_APPLY (HB_DEBUG+0)
|
||||
#endif
|
||||
|
||||
#define TRACE_APPLY() \
|
||||
#define TRACE_APPLY(this) \
|
||||
hb_auto_trace_t<HB_DEBUG_APPLY, bool> trace \
|
||||
(&c->debug_depth, "APPLY", this, HB_FUNC, \
|
||||
"idx %d codepoint %u", c->buffer->idx, c->buffer->cur().codepoint);
|
||||
|
@ -734,7 +734,7 @@ static inline bool match_lookahead (hb_apply_context_t *c,
|
|||
struct LookupRecord
|
||||
{
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
return TRACE_RETURN (c->check_struct (this));
|
||||
}
|
||||
|
||||
|
@ -877,7 +877,7 @@ struct Rule
|
|||
{
|
||||
inline void closure (hb_closure_context_t *c, ContextClosureLookupContext &lookup_context) const
|
||||
{
|
||||
TRACE_CLOSURE ();
|
||||
TRACE_CLOSURE (this);
|
||||
const LookupRecord *lookupRecord = &StructAtOffset<LookupRecord> (input, input[0].static_size * (inputCount ? inputCount - 1 : 0));
|
||||
context_closure_lookup (c,
|
||||
inputCount, input,
|
||||
|
@ -887,21 +887,21 @@ struct Rule
|
|||
|
||||
inline bool would_apply (hb_would_apply_context_t *c, ContextApplyLookupContext &lookup_context) const
|
||||
{
|
||||
TRACE_WOULD_APPLY ();
|
||||
TRACE_WOULD_APPLY (this);
|
||||
const LookupRecord *lookupRecord = &StructAtOffset<LookupRecord> (input, input[0].static_size * (inputCount ? inputCount - 1 : 0));
|
||||
return TRACE_RETURN (context_would_apply_lookup (c, inputCount, input, lookupCount, lookupRecord, lookup_context));
|
||||
}
|
||||
|
||||
inline bool apply (hb_apply_context_t *c, ContextApplyLookupContext &lookup_context) const
|
||||
{
|
||||
TRACE_APPLY ();
|
||||
TRACE_APPLY (this);
|
||||
const LookupRecord *lookupRecord = &StructAtOffset<LookupRecord> (input, input[0].static_size * (inputCount ? inputCount - 1 : 0));
|
||||
return TRACE_RETURN (context_apply_lookup (c, inputCount, input, lookupCount, lookupRecord, lookup_context));
|
||||
}
|
||||
|
||||
public:
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
return inputCount.sanitize (c)
|
||||
&& lookupCount.sanitize (c)
|
||||
&& c->check_range (input,
|
||||
|
@ -926,7 +926,7 @@ struct RuleSet
|
|||
{
|
||||
inline void closure (hb_closure_context_t *c, ContextClosureLookupContext &lookup_context) const
|
||||
{
|
||||
TRACE_CLOSURE ();
|
||||
TRACE_CLOSURE (this);
|
||||
unsigned int num_rules = rule.len;
|
||||
for (unsigned int i = 0; i < num_rules; i++)
|
||||
(this+rule[i]).closure (c, lookup_context);
|
||||
|
@ -934,7 +934,7 @@ struct RuleSet
|
|||
|
||||
inline bool would_apply (hb_would_apply_context_t *c, ContextApplyLookupContext &lookup_context) const
|
||||
{
|
||||
TRACE_WOULD_APPLY ();
|
||||
TRACE_WOULD_APPLY (this);
|
||||
unsigned int num_rules = rule.len;
|
||||
for (unsigned int i = 0; i < num_rules; i++)
|
||||
{
|
||||
|
@ -946,7 +946,7 @@ struct RuleSet
|
|||
|
||||
inline bool apply (hb_apply_context_t *c, ContextApplyLookupContext &lookup_context) const
|
||||
{
|
||||
TRACE_APPLY ();
|
||||
TRACE_APPLY (this);
|
||||
unsigned int num_rules = rule.len;
|
||||
for (unsigned int i = 0; i < num_rules; i++)
|
||||
{
|
||||
|
@ -957,7 +957,7 @@ struct RuleSet
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
return TRACE_RETURN (rule.sanitize (c, this));
|
||||
}
|
||||
|
||||
|
@ -974,7 +974,7 @@ struct ContextFormat1
|
|||
{
|
||||
inline void closure (hb_closure_context_t *c) const
|
||||
{
|
||||
TRACE_CLOSURE ();
|
||||
TRACE_CLOSURE (this);
|
||||
|
||||
const Coverage &cov = (this+coverage);
|
||||
|
||||
|
@ -993,7 +993,7 @@ struct ContextFormat1
|
|||
|
||||
inline bool would_apply (hb_would_apply_context_t *c) const
|
||||
{
|
||||
TRACE_WOULD_APPLY ();
|
||||
TRACE_WOULD_APPLY (this);
|
||||
|
||||
const RuleSet &rule_set = this+ruleSet[(this+coverage) (c->glyphs[0])];
|
||||
struct ContextApplyLookupContext lookup_context = {
|
||||
|
@ -1010,7 +1010,7 @@ struct ContextFormat1
|
|||
|
||||
inline bool apply (hb_apply_context_t *c) const
|
||||
{
|
||||
TRACE_APPLY ();
|
||||
TRACE_APPLY (this);
|
||||
unsigned int index = (this+coverage) (c->buffer->cur().codepoint);
|
||||
if (likely (index == NOT_COVERED))
|
||||
return TRACE_RETURN (false);
|
||||
|
@ -1024,7 +1024,7 @@ struct ContextFormat1
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
return TRACE_RETURN (coverage.sanitize (c, this) && ruleSet.sanitize (c, this));
|
||||
}
|
||||
|
||||
|
@ -1045,7 +1045,7 @@ struct ContextFormat2
|
|||
{
|
||||
inline void closure (hb_closure_context_t *c) const
|
||||
{
|
||||
TRACE_CLOSURE ();
|
||||
TRACE_CLOSURE (this);
|
||||
if (!(this+coverage).intersects (c->glyphs))
|
||||
return;
|
||||
|
||||
|
@ -1066,7 +1066,7 @@ struct ContextFormat2
|
|||
|
||||
inline bool would_apply (hb_would_apply_context_t *c) const
|
||||
{
|
||||
TRACE_WOULD_APPLY ();
|
||||
TRACE_WOULD_APPLY (this);
|
||||
|
||||
const ClassDef &class_def = this+classDef;
|
||||
unsigned int index = class_def (c->glyphs[0]);
|
||||
|
@ -1085,7 +1085,7 @@ struct ContextFormat2
|
|||
|
||||
inline bool apply (hb_apply_context_t *c) const
|
||||
{
|
||||
TRACE_APPLY ();
|
||||
TRACE_APPLY (this);
|
||||
unsigned int index = (this+coverage) (c->buffer->cur().codepoint);
|
||||
if (likely (index == NOT_COVERED)) return TRACE_RETURN (false);
|
||||
|
||||
|
@ -1100,7 +1100,7 @@ struct ContextFormat2
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
return TRACE_RETURN (coverage.sanitize (c, this) && classDef.sanitize (c, this) && ruleSet.sanitize (c, this));
|
||||
}
|
||||
|
||||
|
@ -1124,7 +1124,7 @@ struct ContextFormat3
|
|||
{
|
||||
inline void closure (hb_closure_context_t *c) const
|
||||
{
|
||||
TRACE_CLOSURE ();
|
||||
TRACE_CLOSURE (this);
|
||||
if (!(this+coverage[0]).intersects (c->glyphs))
|
||||
return;
|
||||
|
||||
|
@ -1141,7 +1141,7 @@ struct ContextFormat3
|
|||
|
||||
inline bool would_apply (hb_would_apply_context_t *c) const
|
||||
{
|
||||
TRACE_WOULD_APPLY ();
|
||||
TRACE_WOULD_APPLY (this);
|
||||
|
||||
const LookupRecord *lookupRecord = &StructAtOffset<LookupRecord> (coverage, coverage[0].static_size * glyphCount);
|
||||
struct ContextApplyLookupContext lookup_context = {
|
||||
|
@ -1158,7 +1158,7 @@ struct ContextFormat3
|
|||
|
||||
inline bool apply (hb_apply_context_t *c) const
|
||||
{
|
||||
TRACE_APPLY ();
|
||||
TRACE_APPLY (this);
|
||||
unsigned int index = (this+coverage[0]) (c->buffer->cur().codepoint);
|
||||
if (likely (index == NOT_COVERED)) return TRACE_RETURN (false);
|
||||
|
||||
|
@ -1171,7 +1171,7 @@ struct ContextFormat3
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
if (!c->check_struct (this)) return TRACE_RETURN (false);
|
||||
unsigned int count = glyphCount;
|
||||
if (!c->check_array (coverage, coverage[0].static_size, count)) return TRACE_RETURN (false);
|
||||
|
@ -1209,7 +1209,7 @@ struct Context
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
if (!u.format.sanitize (c)) return TRACE_RETURN (false);
|
||||
switch (u.format) {
|
||||
case 1: return TRACE_RETURN (u.format1.sanitize (c));
|
||||
|
@ -1316,7 +1316,7 @@ struct ChainRule
|
|||
{
|
||||
inline void closure (hb_closure_context_t *c, ChainContextClosureLookupContext &lookup_context) const
|
||||
{
|
||||
TRACE_CLOSURE ();
|
||||
TRACE_CLOSURE (this);
|
||||
const HeadlessArrayOf<USHORT> &input = StructAfter<HeadlessArrayOf<USHORT> > (backtrack);
|
||||
const ArrayOf<USHORT> &lookahead = StructAfter<ArrayOf<USHORT> > (input);
|
||||
const ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead);
|
||||
|
@ -1330,7 +1330,7 @@ struct ChainRule
|
|||
|
||||
inline bool would_apply (hb_would_apply_context_t *c, ChainContextApplyLookupContext &lookup_context) const
|
||||
{
|
||||
TRACE_WOULD_APPLY ();
|
||||
TRACE_WOULD_APPLY (this);
|
||||
const HeadlessArrayOf<USHORT> &input = StructAfter<HeadlessArrayOf<USHORT> > (backtrack);
|
||||
const ArrayOf<USHORT> &lookahead = StructAfter<ArrayOf<USHORT> > (input);
|
||||
const ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead);
|
||||
|
@ -1343,7 +1343,7 @@ struct ChainRule
|
|||
|
||||
inline bool apply (hb_apply_context_t *c, ChainContextApplyLookupContext &lookup_context) const
|
||||
{
|
||||
TRACE_APPLY ();
|
||||
TRACE_APPLY (this);
|
||||
const HeadlessArrayOf<USHORT> &input = StructAfter<HeadlessArrayOf<USHORT> > (backtrack);
|
||||
const ArrayOf<USHORT> &lookahead = StructAfter<ArrayOf<USHORT> > (input);
|
||||
const ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead);
|
||||
|
@ -1355,7 +1355,7 @@ struct ChainRule
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
if (!backtrack.sanitize (c)) return TRACE_RETURN (false);
|
||||
HeadlessArrayOf<USHORT> &input = StructAfter<HeadlessArrayOf<USHORT> > (backtrack);
|
||||
if (!input.sanitize (c)) return TRACE_RETURN (false);
|
||||
|
@ -1387,7 +1387,7 @@ struct ChainRuleSet
|
|||
{
|
||||
inline void closure (hb_closure_context_t *c, ChainContextClosureLookupContext &lookup_context) const
|
||||
{
|
||||
TRACE_CLOSURE ();
|
||||
TRACE_CLOSURE (this);
|
||||
unsigned int num_rules = rule.len;
|
||||
for (unsigned int i = 0; i < num_rules; i++)
|
||||
(this+rule[i]).closure (c, lookup_context);
|
||||
|
@ -1395,7 +1395,7 @@ struct ChainRuleSet
|
|||
|
||||
inline bool would_apply (hb_would_apply_context_t *c, ChainContextApplyLookupContext &lookup_context) const
|
||||
{
|
||||
TRACE_WOULD_APPLY ();
|
||||
TRACE_WOULD_APPLY (this);
|
||||
unsigned int num_rules = rule.len;
|
||||
for (unsigned int i = 0; i < num_rules; i++)
|
||||
if ((this+rule[i]).would_apply (c, lookup_context))
|
||||
|
@ -1406,7 +1406,7 @@ struct ChainRuleSet
|
|||
|
||||
inline bool apply (hb_apply_context_t *c, ChainContextApplyLookupContext &lookup_context) const
|
||||
{
|
||||
TRACE_APPLY ();
|
||||
TRACE_APPLY (this);
|
||||
unsigned int num_rules = rule.len;
|
||||
for (unsigned int i = 0; i < num_rules; i++)
|
||||
if ((this+rule[i]).apply (c, lookup_context))
|
||||
|
@ -1416,7 +1416,7 @@ struct ChainRuleSet
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
return TRACE_RETURN (rule.sanitize (c, this));
|
||||
}
|
||||
|
||||
|
@ -1432,7 +1432,7 @@ struct ChainContextFormat1
|
|||
{
|
||||
inline void closure (hb_closure_context_t *c) const
|
||||
{
|
||||
TRACE_CLOSURE ();
|
||||
TRACE_CLOSURE (this);
|
||||
const Coverage &cov = (this+coverage);
|
||||
|
||||
struct ChainContextClosureLookupContext lookup_context = {
|
||||
|
@ -1450,7 +1450,7 @@ struct ChainContextFormat1
|
|||
|
||||
inline bool would_apply (hb_would_apply_context_t *c) const
|
||||
{
|
||||
TRACE_WOULD_APPLY ();
|
||||
TRACE_WOULD_APPLY (this);
|
||||
|
||||
const ChainRuleSet &rule_set = this+ruleSet[(this+coverage) (c->glyphs[0])];
|
||||
struct ChainContextApplyLookupContext lookup_context = {
|
||||
|
@ -1467,7 +1467,7 @@ struct ChainContextFormat1
|
|||
|
||||
inline bool apply (hb_apply_context_t *c) const
|
||||
{
|
||||
TRACE_APPLY ();
|
||||
TRACE_APPLY (this);
|
||||
unsigned int index = (this+coverage) (c->buffer->cur().codepoint);
|
||||
if (likely (index == NOT_COVERED)) return TRACE_RETURN (false);
|
||||
|
||||
|
@ -1480,7 +1480,7 @@ struct ChainContextFormat1
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
return TRACE_RETURN (coverage.sanitize (c, this) && ruleSet.sanitize (c, this));
|
||||
}
|
||||
|
||||
|
@ -1500,7 +1500,7 @@ struct ChainContextFormat2
|
|||
{
|
||||
inline void closure (hb_closure_context_t *c) const
|
||||
{
|
||||
TRACE_CLOSURE ();
|
||||
TRACE_CLOSURE (this);
|
||||
if (!(this+coverage).intersects (c->glyphs))
|
||||
return;
|
||||
|
||||
|
@ -1525,7 +1525,7 @@ struct ChainContextFormat2
|
|||
|
||||
inline bool would_apply (hb_would_apply_context_t *c) const
|
||||
{
|
||||
TRACE_WOULD_APPLY ();
|
||||
TRACE_WOULD_APPLY (this);
|
||||
|
||||
const ClassDef &input_class_def = this+inputClassDef;
|
||||
|
||||
|
@ -1545,7 +1545,7 @@ struct ChainContextFormat2
|
|||
|
||||
inline bool apply (hb_apply_context_t *c) const
|
||||
{
|
||||
TRACE_APPLY ();
|
||||
TRACE_APPLY (this);
|
||||
unsigned int index = (this+coverage) (c->buffer->cur().codepoint);
|
||||
if (likely (index == NOT_COVERED)) return TRACE_RETURN (false);
|
||||
|
||||
|
@ -1565,7 +1565,7 @@ struct ChainContextFormat2
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
return TRACE_RETURN (coverage.sanitize (c, this) && backtrackClassDef.sanitize (c, this) &&
|
||||
inputClassDef.sanitize (c, this) && lookaheadClassDef.sanitize (c, this) &&
|
||||
ruleSet.sanitize (c, this));
|
||||
|
@ -1599,7 +1599,7 @@ struct ChainContextFormat3
|
|||
{
|
||||
inline void closure (hb_closure_context_t *c) const
|
||||
{
|
||||
TRACE_CLOSURE ();
|
||||
TRACE_CLOSURE (this);
|
||||
const OffsetArrayOf<Coverage> &input = StructAfter<OffsetArrayOf<Coverage> > (backtrack);
|
||||
|
||||
if (!(this+input[0]).intersects (c->glyphs))
|
||||
|
@ -1621,7 +1621,7 @@ struct ChainContextFormat3
|
|||
|
||||
inline bool would_apply (hb_would_apply_context_t *c) const
|
||||
{
|
||||
TRACE_WOULD_APPLY ();
|
||||
TRACE_WOULD_APPLY (this);
|
||||
|
||||
const OffsetArrayOf<Coverage> &input = StructAfter<OffsetArrayOf<Coverage> > (backtrack);
|
||||
const OffsetArrayOf<Coverage> &lookahead = StructAfter<OffsetArrayOf<Coverage> > (input);
|
||||
|
@ -1645,7 +1645,7 @@ struct ChainContextFormat3
|
|||
|
||||
inline bool apply (hb_apply_context_t *c) const
|
||||
{
|
||||
TRACE_APPLY ();
|
||||
TRACE_APPLY (this);
|
||||
const OffsetArrayOf<Coverage> &input = StructAfter<OffsetArrayOf<Coverage> > (backtrack);
|
||||
|
||||
unsigned int index = (this+input[0]) (c->buffer->cur().codepoint);
|
||||
|
@ -1665,7 +1665,7 @@ struct ChainContextFormat3
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
if (!backtrack.sanitize (c, this)) return TRACE_RETURN (false);
|
||||
OffsetArrayOf<Coverage> &input = StructAfter<OffsetArrayOf<Coverage> > (backtrack);
|
||||
if (!input.sanitize (c, this)) return TRACE_RETURN (false);
|
||||
|
@ -1710,7 +1710,7 @@ struct ChainContext
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
if (!u.format.sanitize (c)) return TRACE_RETURN (false);
|
||||
switch (u.format) {
|
||||
case 1: return TRACE_RETURN (u.format1.sanitize (c));
|
||||
|
@ -1736,7 +1736,7 @@ struct ExtensionFormat1
|
|||
inline unsigned int get_offset (void) const { return extensionOffset; }
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
return TRACE_RETURN (c->check_struct (this));
|
||||
}
|
||||
|
||||
|
@ -1769,7 +1769,7 @@ struct Extension
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
if (!u.format.sanitize (c)) return TRACE_RETURN (false);
|
||||
switch (u.format) {
|
||||
case 1: return TRACE_RETURN (u.format1.sanitize (c));
|
||||
|
@ -1826,7 +1826,7 @@ struct GSUBGPOS
|
|||
{ return (this+lookupList)[i]; }
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
return TRACE_RETURN (version.sanitize (c) && likely (version.major == 1) &&
|
||||
scriptList.sanitize (c, this) &&
|
||||
featureList.sanitize (c, this) &&
|
||||
|
|
|
@ -48,7 +48,7 @@ struct maxp
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
return TRACE_RETURN (c->check_struct (this) &&
|
||||
likely (version.major == 1 || (version.major == 0 && version.minor == 0x5000)));
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ struct NameRecord
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c, void *base) {
|
||||
TRACE_SANITIZE ();
|
||||
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));
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ struct name
|
|||
}
|
||||
|
||||
inline bool sanitize_records (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
char *string_pool = (char *) this + stringOffset;
|
||||
unsigned int _count = count;
|
||||
for (unsigned int i = 0; i < _count; i++)
|
||||
|
@ -108,7 +108,7 @@ struct name
|
|||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||
TRACE_SANITIZE ();
|
||||
TRACE_SANITIZE (this);
|
||||
return TRACE_RETURN (c->check_struct (this) &&
|
||||
likely (format == 0 || format == 1) &&
|
||||
c->check_array (nameRecord, nameRecord[0].static_size, count) &&
|
||||
|
|
Loading…
Reference in New Issue