parent
bea34c7cbb
commit
09766b1ec5
|
@ -65,23 +65,23 @@ template<typename Type, typename TObject>
|
||||||
inline Type* CastP(TObject *X)
|
inline Type* CastP(TObject *X)
|
||||||
{ return reinterpret_cast<Type*> (X); }
|
{ return reinterpret_cast<Type*> (X); }
|
||||||
|
|
||||||
/* StructAtOffset<T>(X,Ofs) returns the struct T& that is placed at memory
|
/* StructAtOffset<T>(P,Ofs) returns the struct T& that is placed at memory
|
||||||
* location of X plus Ofs bytes. */
|
* location pointed to by P plus Ofs bytes. */
|
||||||
template<typename Type, typename TObject>
|
template<typename Type>
|
||||||
inline const Type& StructAtOffset(const TObject &X, unsigned int offset)
|
inline const Type& StructAtOffset(const void *P, unsigned int offset)
|
||||||
{ return * reinterpret_cast<const Type*> (CharP(&X) + offset); }
|
{ return * reinterpret_cast<const Type*> (CharP(P) + offset); }
|
||||||
template<typename Type, typename TObject>
|
template<typename Type>
|
||||||
inline Type& StructAtOffset(TObject &X, unsigned int offset)
|
inline Type& StructAtOffset(void *P, unsigned int offset)
|
||||||
{ return * reinterpret_cast<Type*> (CharP(&X) + offset); }
|
{ return * reinterpret_cast<Type*> (CharP(P) + offset); }
|
||||||
|
|
||||||
/* StructAfter<T>(X) returns the struct T& that is placed after X.
|
/* StructAfter<T>(X) returns the struct T& that is placed after X.
|
||||||
* Works with X of variable size also. X must implement get_size() */
|
* Works with X of variable size also. X must implement get_size() */
|
||||||
template<typename Type, typename TObject>
|
template<typename Type, typename TObject>
|
||||||
inline const Type& StructAfter(const TObject &X)
|
inline const Type& StructAfter(const TObject &X)
|
||||||
{ return StructAtOffset<Type>(X, X.get_size()); }
|
{ return StructAtOffset<Type>(&X, X.get_size()); }
|
||||||
template<typename Type, typename TObject>
|
template<typename Type, typename TObject>
|
||||||
inline Type& StructAfter(TObject &X)
|
inline Type& StructAfter(TObject &X)
|
||||||
{ return StructAtOffset<Type>(X, X.get_size()); }
|
{ return StructAtOffset<Type>(&X, X.get_size()); }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -472,7 +472,7 @@ struct GenericOffsetTo : OffsetType
|
||||||
{
|
{
|
||||||
unsigned int offset = *this;
|
unsigned int offset = *this;
|
||||||
if (unlikely (!offset)) return Null(Type);
|
if (unlikely (!offset)) return Null(Type);
|
||||||
return StructAtOffset<Type> (*CharP(base), offset);
|
return StructAtOffset<Type> (base, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *context, void *base) {
|
inline bool sanitize (hb_sanitize_context_t *context, void *base) {
|
||||||
|
@ -480,7 +480,7 @@ struct GenericOffsetTo : OffsetType
|
||||||
if (!context->check_struct (this)) return false;
|
if (!context->check_struct (this)) return false;
|
||||||
unsigned int offset = *this;
|
unsigned int offset = *this;
|
||||||
if (unlikely (!offset)) return true;
|
if (unlikely (!offset)) return true;
|
||||||
Type &obj = StructAtOffset<Type> (*CharP(base), offset);
|
Type &obj = StructAtOffset<Type> (base, offset);
|
||||||
return likely (obj.sanitize (context)) || neuter (context);
|
return likely (obj.sanitize (context)) || neuter (context);
|
||||||
}
|
}
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
@ -489,7 +489,7 @@ struct GenericOffsetTo : OffsetType
|
||||||
if (!context->check_struct (this)) return false;
|
if (!context->check_struct (this)) return false;
|
||||||
unsigned int offset = *this;
|
unsigned int offset = *this;
|
||||||
if (unlikely (!offset)) return true;
|
if (unlikely (!offset)) return true;
|
||||||
Type &obj = StructAtOffset<Type> (*CharP(base), offset);
|
Type &obj = StructAtOffset<Type> (base, offset);
|
||||||
return likely (obj.sanitize (context, user_data)) || neuter (context);
|
return likely (obj.sanitize (context, user_data)) || neuter (context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -618,7 +618,7 @@ struct PairPosFormat1
|
||||||
context->buffer->in_pos = j;
|
context->buffer->in_pos = j;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
record = &StructAtOffset<PairValueRecord> (*record, record_size);
|
record = &StructAtOffset<PairValueRecord> (record, record_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -1409,7 +1409,7 @@ struct ExtensionPos : Extension
|
||||||
{
|
{
|
||||||
unsigned int offset = get_offset ();
|
unsigned int offset = get_offset ();
|
||||||
if (unlikely (!offset)) return Null(PosLookupSubTable);
|
if (unlikely (!offset)) return Null(PosLookupSubTable);
|
||||||
return StructAtOffset<PosLookupSubTable> (*this, offset);
|
return StructAtOffset<PosLookupSubTable> (this, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool apply (hb_apply_context_t *context) const;
|
inline bool apply (hb_apply_context_t *context) const;
|
||||||
|
@ -1608,7 +1608,7 @@ inline bool ExtensionPos::sanitize (hb_sanitize_context_t *context)
|
||||||
if (unlikely (!Extension::sanitize (context))) return false;
|
if (unlikely (!Extension::sanitize (context))) return false;
|
||||||
unsigned int offset = get_offset ();
|
unsigned int offset = get_offset ();
|
||||||
if (unlikely (!offset)) return true;
|
if (unlikely (!offset)) return true;
|
||||||
return StructAtOffset<PosLookupSubTable> (*this, offset).sanitize (context);
|
return StructAtOffset<PosLookupSubTable> (this, offset).sanitize (context);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool position_lookup (hb_apply_context_t *context, unsigned int lookup_index)
|
static inline bool position_lookup (hb_apply_context_t *context, unsigned int lookup_index)
|
||||||
|
|
|
@ -586,7 +586,7 @@ struct ExtensionSubst : Extension
|
||||||
{
|
{
|
||||||
unsigned int offset = get_offset ();
|
unsigned int offset = get_offset ();
|
||||||
if (unlikely (!offset)) return Null(SubstLookupSubTable);
|
if (unlikely (!offset)) return Null(SubstLookupSubTable);
|
||||||
return StructAtOffset<SubstLookupSubTable> (*this, offset);
|
return StructAtOffset<SubstLookupSubTable> (this, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool apply (hb_apply_context_t *context) const;
|
inline bool apply (hb_apply_context_t *context) const;
|
||||||
|
@ -916,7 +916,7 @@ inline bool ExtensionSubst::sanitize (hb_sanitize_context_t *context)
|
||||||
if (unlikely (!Extension::sanitize (context))) return false;
|
if (unlikely (!Extension::sanitize (context))) return false;
|
||||||
unsigned int offset = get_offset ();
|
unsigned int offset = get_offset ();
|
||||||
if (unlikely (!offset)) return true;
|
if (unlikely (!offset)) return true;
|
||||||
return StructAtOffset<SubstLookupSubTable> (*this, offset).sanitize (context);
|
return StructAtOffset<SubstLookupSubTable> (this, offset).sanitize (context);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool ExtensionSubst::is_reverse (void) const
|
inline bool ExtensionSubst::is_reverse (void) const
|
||||||
|
|
Loading…
Reference in New Issue