Use templates for const char * casts

This commit is contained in:
Behdad Esfahbod 2010-04-21 13:35:36 -04:00
parent 1922ffe701
commit 198facdc55
6 changed files with 56 additions and 56 deletions

View File

@ -52,7 +52,7 @@ typedef struct TableDirectory
inline bool sanitize (SANITIZE_ARG_DEF, const void *base) { inline bool sanitize (SANITIZE_ARG_DEF, const void *base) {
TRACE_SANITIZE (); TRACE_SANITIZE ();
return SANITIZE_SELF () && SANITIZE (tag) && return SANITIZE_SELF () && SANITIZE (tag) &&
SANITIZE_MEM (CONST_CHARP(base) + (unsigned long) offset, length); SANITIZE_MEM (ConstCharP(base) + (unsigned long) offset, length);
} }
Tag tag; /* 4-byte identifier. */ Tag tag; /* 4-byte identifier. */
@ -150,7 +150,7 @@ struct TTCHeader
TRACE_SANITIZE (); 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;
return table.sanitize (SANITIZE_ARG, CONST_CHARP(this), CONST_CHARP(this)); return table.sanitize (SANITIZE_ARG, ConstCharP(this), ConstCharP(this));
} }
private: private:
@ -180,8 +180,8 @@ struct OpenTypeFontFile
{ {
switch (tag) { switch (tag) {
default: return 0; default: return 0;
case TrueTypeTag: case CFFTag: return OffsetTable::get_for_data (CONST_CHARP(this)).get_face_count (); case TrueTypeTag: case CFFTag: return OffsetTable::get_for_data (ConstCharP(this)).get_face_count ();
case TTCTag: return TTCHeader::get_for_data (CONST_CHARP(this)).get_face_count (); case TTCTag: return TTCHeader::get_for_data (ConstCharP(this)).get_face_count ();
} }
} }
inline const OpenTypeFontFace& get_face (unsigned int i) const inline const OpenTypeFontFace& get_face (unsigned int i) const
@ -191,8 +191,8 @@ struct OpenTypeFontFile
/* Note: for non-collection SFNT data we ignore index. This is because /* Note: for non-collection SFNT data we ignore index. This is because
* Apple dfont container is a container of SFNT's. So each SFNT is a * Apple dfont container is a container of SFNT's. So each SFNT is a
* non-TTC, but the index is more than zero. */ * non-TTC, but the index is more than zero. */
case TrueTypeTag: case CFFTag: return OffsetTable::get_for_data (CONST_CHARP(this)); case TrueTypeTag: case CFFTag: return OffsetTable::get_for_data (ConstCharP(this));
case TTCTag: return TTCHeader::get_for_data (CONST_CHARP(this)).get_face (i); case TTCTag: return TTCHeader::get_for_data (ConstCharP(this)).get_face (i);
} }
} }

View File

@ -39,19 +39,19 @@
* Casts * Casts
*/ */
#define CONST_CHARP(X) (reinterpret_cast<const char *>(X)) template <typename Type> const char * ConstCharP (const Type X) { return reinterpret_cast<const char *>(X); }
#define DECONST_CHARP(X) ((char *)reinterpret_cast<const char *>(X)) template <typename Type> char * CharP (Type X) { return reinterpret_cast<char *>(X); }
#define CHARP(X) (reinterpret_cast<char *>(X)) template <typename Type> char * DeConstCharP (const Type X) { return (char *) reinterpret_cast<const char *>(X); }
#define CONST_CAST(T,X,Ofs) (*(reinterpret_cast<const T *>(CONST_CHARP(&(X)) + Ofs))) #define CONST_CAST(T,X,Ofs) (*(reinterpret_cast<const T *>(ConstCharP(&(X)) + Ofs)))
#define DECONST_CAST(T,X,Ofs) (*(reinterpret_cast<T *>((char *)CONST_CHARP(&(X)) + Ofs))) #define DECONST_CAST(T,X,Ofs) (*(reinterpret_cast<T *>((char *)ConstCharP(&(X)) + Ofs)))
#define CAST(T,X,Ofs) (*(reinterpret_cast<T *>(CHARP(&(X)) + Ofs))) #define CAST(T,X,Ofs) (*(reinterpret_cast<T *>(CharP(&(X)) + Ofs)))
#define CONST_NEXT(T,X) (*(reinterpret_cast<const T *>(CONST_CHARP(&(X)) + (X).get_size ()))) #define CONST_NEXT(T,X) (*(reinterpret_cast<const T *>(ConstCharP(&(X)) + (X).get_size ())))
#define NEXT(T,X) (*(reinterpret_cast<T *>(CHARP(&(X)) + (X).get_size ()))) #define NEXT(T,X) (*(reinterpret_cast<T *>(CharP(&(X)) + (X).get_size ())))
#define CONST_ARRAY_AFTER(T,X) ((reinterpret_cast<const T *>(CONST_CHARP(&(X)) + X.get_size ()))) #define CONST_ARRAY_AFTER(T,X) ((reinterpret_cast<const T *>(ConstCharP(&(X)) + X.get_size ())))
#define ARRAY_AFTER(T,X) ((reinterpret_cast<T *>(CHARP(&(X)) + X.get_size ()))) #define ARRAY_AFTER(T,X) ((reinterpret_cast<T *>(CharP(&(X)) + X.get_size ())))
/* /*
* Class features * Class features
@ -119,7 +119,7 @@ inline const Type& Null<Type> () { \
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", \
(CONST_CHARP (this) == CONST_CHARP (&NullPool)) ? 0 : this, \ (ConstCharP (this) == ConstCharP (&NullPool)) ? 0 : this, \
sanitize_depth, sanitize_depth, \ sanitize_depth, sanitize_depth, \
__PRETTY_FUNCTION__); \ __PRETTY_FUNCTION__); \
} HB_STMT_END } HB_STMT_END
@ -237,7 +237,7 @@ _hb_sanitize_edit (SANITIZE_ARG_DEF,
#define SANITIZE(X) HB_LIKELY ((X).sanitize (SANITIZE_ARG)) #define SANITIZE(X) HB_LIKELY ((X).sanitize (SANITIZE_ARG))
#define SANITIZE2(X,Y) (SANITIZE (X) && SANITIZE (Y)) #define SANITIZE2(X,Y) (SANITIZE (X) && SANITIZE (Y))
#define SANITIZE_THIS(X) HB_LIKELY ((X).sanitize (SANITIZE_ARG, CONST_CHARP(this))) #define SANITIZE_THIS(X) HB_LIKELY ((X).sanitize (SANITIZE_ARG, ConstCharP(this)))
#define SANITIZE_THIS2(X,Y) (SANITIZE_THIS (X) && SANITIZE_THIS (Y)) #define SANITIZE_THIS2(X,Y) (SANITIZE_THIS (X) && SANITIZE_THIS (Y))
#define SANITIZE_THIS3(X,Y,Z) (SANITIZE_THIS (X) && SANITIZE_THIS (Y) && SANITIZE_THIS(Z)) #define SANITIZE_THIS3(X,Y,Z) (SANITIZE_THIS (X) && SANITIZE_THIS (Y) && SANITIZE_THIS(Z))
@ -248,13 +248,13 @@ _hb_sanitize_edit (SANITIZE_ARG_DEF,
#define SANITIZE_OBJ(X) SANITIZE_MEM(&(X), sizeof (X)) #define SANITIZE_OBJ(X) SANITIZE_MEM(&(X), sizeof (X))
#define SANITIZE_GET_SIZE() SANITIZE_SELF() && SANITIZE_MEM (this, this->get_size ()) #define SANITIZE_GET_SIZE() SANITIZE_SELF() && SANITIZE_MEM (this, this->get_size ())
#define SANITIZE_MEM(B,L) HB_LIKELY (_hb_sanitize_check (SANITIZE_ARG, CONST_CHARP(B), (L))) #define SANITIZE_MEM(B,L) HB_LIKELY (_hb_sanitize_check (SANITIZE_ARG, ConstCharP(B), (L)))
#define SANITIZE_ARRAY(A,S,L) HB_LIKELY (_hb_sanitize_array (SANITIZE_ARG, CONST_CHARP(A), S, L)) #define SANITIZE_ARRAY(A,S,L) HB_LIKELY (_hb_sanitize_array (SANITIZE_ARG, ConstCharP(A), S, L))
#define NEUTER(Var, Val) \ #define NEUTER(Var, Val) \
(SANITIZE_OBJ (Var) && \ (SANITIZE_OBJ (Var) && \
_hb_sanitize_edit (SANITIZE_ARG, CONST_CHARP(&(Var)), sizeof (Var)) && \ _hb_sanitize_edit (SANITIZE_ARG, ConstCharP(&(Var)), sizeof (Var)) && \
((Var).set (Val), true)) ((Var).set (Val), true))
@ -275,7 +275,7 @@ struct Sanitizer
_hb_sanitize_init (&context, blob); _hb_sanitize_init (&context, blob);
Type *t = &CAST (Type, *DECONST_CHARP(context.start), 0); Type *t = &CAST (Type, *DeConstCharP(context.start), 0);
sane = t->sanitize (SANITIZE_ARG_INIT); sane = t->sanitize (SANITIZE_ARG_INIT);
if (sane) { if (sane) {
@ -389,8 +389,8 @@ ASSERT_SIZE (LONG, 4);
struct Tag : ULONG struct Tag : ULONG
{ {
/* What the char* converters return is NOT nul-terminated. Print using "%.4s" */ /* What the char* converters return is NOT nul-terminated. Print using "%.4s" */
inline operator const char* (void) const { return CONST_CHARP(this); } inline operator const char* (void) const { return ConstCharP(this); }
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) {
TRACE_SANITIZE (); TRACE_SANITIZE ();
@ -462,7 +462,7 @@ struct GenericOffsetTo : OffsetType
{ {
unsigned int offset = *this; unsigned int offset = *this;
if (HB_UNLIKELY (!offset)) return Null(Type); if (HB_UNLIKELY (!offset)) return Null(Type);
return CONST_CAST(Type, *CONST_CHARP(base), offset); return CONST_CAST(Type, *ConstCharP(base), offset);
} }
inline bool sanitize (SANITIZE_ARG_DEF, const void *base) { inline bool sanitize (SANITIZE_ARG_DEF, const void *base) {
@ -470,21 +470,21 @@ struct GenericOffsetTo : OffsetType
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, *DeConstCharP(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) {
TRACE_SANITIZE (); 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, *DeConstCharP(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) {
TRACE_SANITIZE (); 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), user_data) || NEUTER (DECONST_CAST(OffsetType,*this,0), 0); return SANITIZE_BASE (CAST(Type, *DeConstCharP(base), offset), user_data) || NEUTER (DECONST_CAST(OffsetType,*this,0), 0);
} }
}; };
template <typename Base, typename OffsetType, typename Type> template <typename Base, typename OffsetType, typename Type>
@ -608,11 +608,11 @@ struct OffsetListOf : OffsetArrayOf<Type>
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
TRACE_SANITIZE (); TRACE_SANITIZE ();
return OffsetArrayOf<Type>::sanitize (SANITIZE_ARG, CONST_CHARP(this)); return OffsetArrayOf<Type>::sanitize (SANITIZE_ARG, ConstCharP(this));
} }
inline bool sanitize (SANITIZE_ARG_DEF, unsigned int user_data) { inline bool sanitize (SANITIZE_ARG_DEF, unsigned int user_data) {
TRACE_SANITIZE (); TRACE_SANITIZE ();
return OffsetArrayOf<Type>::sanitize (SANITIZE_ARG, CONST_CHARP(this), user_data); return OffsetArrayOf<Type>::sanitize (SANITIZE_ARG, ConstCharP(this), user_data);
} }
}; };

View File

@ -111,7 +111,7 @@ struct RecordListOf : RecordArrayOf<Type>
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
TRACE_SANITIZE (); TRACE_SANITIZE ();
return RecordArrayOf<Type>::sanitize (SANITIZE_ARG, CONST_CHARP(this)); return RecordArrayOf<Type>::sanitize (SANITIZE_ARG, ConstCharP(this));
} }
}; };

View File

@ -413,7 +413,7 @@ struct SinglePosFormat1
if (HB_LIKELY (index == NOT_COVERED)) if (HB_LIKELY (index == NOT_COVERED))
return false; return false;
valueFormat.apply_value (context, CONST_CHARP(this), values, CURPOSITION ()); valueFormat.apply_value (context, ConstCharP(this), values, CURPOSITION ());
buffer->in_pos++; buffer->in_pos++;
return true; return true;
@ -422,7 +422,7 @@ struct SinglePosFormat1
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
TRACE_SANITIZE (); TRACE_SANITIZE ();
return SANITIZE_SELF () && SANITIZE_THIS (coverage) && return SANITIZE_SELF () && SANITIZE_THIS (coverage) &&
valueFormat.sanitize_value (SANITIZE_ARG, CHARP(this), values); valueFormat.sanitize_value (SANITIZE_ARG, CharP(this), values);
} }
private: private:
@ -453,7 +453,7 @@ struct SinglePosFormat2
if (HB_LIKELY (index >= valueCount)) if (HB_LIKELY (index >= valueCount))
return false; return false;
valueFormat.apply_value (context, CONST_CHARP(this), valueFormat.apply_value (context, ConstCharP(this),
&values[index * valueFormat.get_len ()], &values[index * valueFormat.get_len ()],
CURPOSITION ()); CURPOSITION ());
@ -464,7 +464,7 @@ struct SinglePosFormat2
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
TRACE_SANITIZE (); TRACE_SANITIZE ();
return SANITIZE_SELF () && SANITIZE_THIS (coverage) && return SANITIZE_SELF () && SANITIZE_THIS (coverage) &&
valueFormat.sanitize_values (SANITIZE_ARG, CHARP(this), values, valueCount); valueFormat.sanitize_values (SANITIZE_ARG, CharP(this), values, valueCount);
} }
private: private:
@ -582,8 +582,8 @@ struct PairPosFormat1
{ {
if (IN_GLYPH (j) == record->secondGlyph) if (IN_GLYPH (j) == record->secondGlyph)
{ {
valueFormat1.apply_value (context, CONST_CHARP(this), &record->values[0], CURPOSITION ()); valueFormat1.apply_value (context, ConstCharP(this), &record->values[0], CURPOSITION ());
valueFormat2.apply_value (context, CONST_CHARP(this), &record->values[len1], POSITION (j)); valueFormat2.apply_value (context, ConstCharP(this), &record->values[len1], POSITION (j));
if (len2) if (len2)
j++; j++;
buffer->in_pos = j; buffer->in_pos = j;
@ -602,7 +602,7 @@ struct PairPosFormat1
unsigned int len2 = valueFormat2.get_len (); unsigned int len2 = valueFormat2.get_len ();
if (!(SANITIZE_SELF () && SANITIZE_THIS (coverage) && if (!(SANITIZE_SELF () && SANITIZE_THIS (coverage) &&
pairSet.sanitize (SANITIZE_ARG, CONST_CHARP(this), len1 + len2))) return false; pairSet.sanitize (SANITIZE_ARG, ConstCharP(this), len1 + len2))) return false;
if (!(valueFormat1.has_device () || valueFormat2.has_device ())) return true; if (!(valueFormat1.has_device () || valueFormat2.has_device ())) return true;
@ -614,8 +614,8 @@ struct PairPosFormat1
unsigned int count2 = pair_set.len; unsigned int count2 = pair_set.len;
const PairValueRecord *record = pair_set.array; const PairValueRecord *record = pair_set.array;
if (!(valueFormat1.sanitize_values_stride_unsafe (SANITIZE_ARG, CHARP(this), &record->values[0], count2, stride) && if (!(valueFormat1.sanitize_values_stride_unsafe (SANITIZE_ARG, CharP(this), &record->values[0], count2, stride) &&
valueFormat2.sanitize_values_stride_unsafe (SANITIZE_ARG, CHARP(this), &record->values[len1], count2, stride))) valueFormat2.sanitize_values_stride_unsafe (SANITIZE_ARG, CharP(this), &record->values[len1], count2, stride)))
return false; return false;
} }
@ -673,8 +673,8 @@ struct PairPosFormat2
return false; return false;
const Value *v = &values[record_len * (klass1 * class2Count + klass2)]; const Value *v = &values[record_len * (klass1 * class2Count + klass2)];
valueFormat1.apply_value (context, CONST_CHARP(this), v, CURPOSITION ()); valueFormat1.apply_value (context, ConstCharP(this), v, CURPOSITION ());
valueFormat2.apply_value (context, CONST_CHARP(this), v + len1, POSITION (j)); valueFormat2.apply_value (context, ConstCharP(this), v + len1, POSITION (j));
if (len2) if (len2)
j++; j++;
@ -694,8 +694,8 @@ struct PairPosFormat2
unsigned int record_size = valueFormat1.get_size () + valueFormat2.get_size (); unsigned int record_size = valueFormat1.get_size () + valueFormat2.get_size ();
unsigned int count = (unsigned int) class1Count * (unsigned int) class2Count; unsigned int count = (unsigned int) class1Count * (unsigned int) class2Count;
return SANITIZE_ARRAY (values, record_size, count) && return SANITIZE_ARRAY (values, record_size, count) &&
valueFormat1.sanitize_values_stride_unsafe (SANITIZE_ARG, CHARP(this), &values[0], count, stride) && valueFormat1.sanitize_values_stride_unsafe (SANITIZE_ARG, CharP(this), &values[0], count, stride) &&
valueFormat2.sanitize_values_stride_unsafe (SANITIZE_ARG, CHARP(this), &values[len1], count, stride); valueFormat2.sanitize_values_stride_unsafe (SANITIZE_ARG, CharP(this), &values[len1], count, stride);
} }
private: private:
@ -1050,7 +1050,7 @@ struct MarkBasePosFormat1
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
TRACE_SANITIZE (); 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, ConstCharP(this), classCount);
} }
private: private:
@ -1171,7 +1171,7 @@ struct MarkLigPosFormat1
TRACE_SANITIZE (); 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, ConstCharP(this), classCount);
} }
private: private:
@ -1270,7 +1270,7 @@ struct MarkMarkPosFormat1
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
TRACE_SANITIZE (); 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, ConstCharP(this), classCount);
} }
private: private:

View File

@ -591,10 +591,10 @@ struct ReverseChainSingleSubstFormat1
if (match_backtrack (APPLY_ARG, if (match_backtrack (APPLY_ARG,
backtrack.len, (USHORT *) backtrack.const_array(), backtrack.len, (USHORT *) backtrack.const_array(),
match_coverage, CONST_CHARP(this)) && match_coverage, ConstCharP(this)) &&
match_lookahead (APPLY_ARG, match_lookahead (APPLY_ARG,
lookahead.len, (USHORT *) lookahead.const_array(), lookahead.len, (USHORT *) lookahead.const_array(),
match_coverage, CONST_CHARP(this), match_coverage, ConstCharP(this),
1)) 1))
{ {
IN_CURGLYPH () = substitute[index]; IN_CURGLYPH () = substitute[index];

View File

@ -44,7 +44,7 @@
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", \
(CONST_CHARP (this) == CONST_CHARP (&NullPool)) ? 0 : this, \ (ConstCharP (this) == ConstCharP (&NullPool)) ? 0 : this, \
apply_depth, apply_depth, \ apply_depth, apply_depth, \
__PRETTY_FUNCTION__); \ __PRETTY_FUNCTION__); \
} HB_STMT_END } HB_STMT_END
@ -411,7 +411,7 @@ struct ContextFormat2
*/ */
struct ContextLookupContext lookup_context = { struct ContextLookupContext lookup_context = {
{match_class, apply_func}, {match_class, apply_func},
CONST_CHARP(&class_def) ConstCharP(&class_def)
}; };
return rule_set.apply (APPLY_ARG, lookup_context); return rule_set.apply (APPLY_ARG, lookup_context);
} }
@ -451,7 +451,7 @@ struct ContextFormat3
const LookupRecord *lookupRecord = &CONST_CAST(LookupRecord, coverage, coverage[0].get_size () * glyphCount); const LookupRecord *lookupRecord = &CONST_CAST(LookupRecord, coverage, coverage[0].get_size () * glyphCount);
struct ContextLookupContext lookup_context = { struct ContextLookupContext lookup_context = {
{match_coverage, apply_func}, {match_coverage, apply_func},
CONST_CHARP(this) ConstCharP(this)
}; };
return context_lookup (APPLY_ARG, return context_lookup (APPLY_ARG,
glyphCount, (const USHORT *) (coverage + 1), glyphCount, (const USHORT *) (coverage + 1),
@ -696,9 +696,9 @@ struct ChainContextFormat2
*/ */
struct ChainContextLookupContext lookup_context = { struct ChainContextLookupContext lookup_context = {
{match_class, apply_func}, {match_class, apply_func},
{CONST_CHARP(&backtrack_class_def), {ConstCharP(&backtrack_class_def),
CONST_CHARP(&input_class_def), ConstCharP(&input_class_def),
CONST_CHARP(&lookahead_class_def)} ConstCharP(&lookahead_class_def)}
}; };
return rule_set.apply (APPLY_ARG, lookup_context); return rule_set.apply (APPLY_ARG, lookup_context);
} }
@ -752,7 +752,7 @@ struct ChainContextFormat3
const ArrayOf<LookupRecord> &lookup = CONST_NEXT (ArrayOf<LookupRecord>, lookahead); const ArrayOf<LookupRecord> &lookup = CONST_NEXT (ArrayOf<LookupRecord>, lookahead);
struct ChainContextLookupContext lookup_context = { struct ChainContextLookupContext lookup_context = {
{match_coverage, apply_func}, {match_coverage, apply_func},
{CONST_CHARP(this), CONST_CHARP(this), CONST_CHARP(this)} {ConstCharP(this), ConstCharP(this), ConstCharP(this)}
}; };
return chain_context_lookup (APPLY_ARG, return chain_context_lookup (APPLY_ARG,
backtrack.len, (const USHORT *) backtrack.const_array(), backtrack.len, (const USHORT *) backtrack.const_array(),