[machinery] Remove CastP
This commit is contained in:
parent
85574ec287
commit
b84ceb2fcf
|
@ -49,14 +49,6 @@ template<typename Type, typename TObject>
|
|||
static inline Type& CastR(TObject &X)
|
||||
{ return reinterpret_cast<Type&> (X); }
|
||||
|
||||
/* Cast to struct T, pointer to pointer */
|
||||
template<typename Type, typename TObject>
|
||||
static inline const Type* CastP(const TObject *X)
|
||||
{ return reinterpret_cast<const Type*> (X); }
|
||||
template<typename Type, typename TObject>
|
||||
static inline Type* CastP(TObject *X)
|
||||
{ return reinterpret_cast<Type*> (X); }
|
||||
|
||||
/* StructAtOffset<T>(P,Ofs) returns the struct T& that is placed at memory
|
||||
* location pointed to by P plus Ofs bytes. */
|
||||
template<typename Type>
|
||||
|
|
|
@ -174,17 +174,19 @@ struct ValueFormat : HBUINT16
|
|||
}
|
||||
|
||||
HB_INTERNAL static OffsetTo<Device>& get_device (Value* value)
|
||||
{ return *CastP<OffsetTo<Device>> (value); }
|
||||
{
|
||||
return *static_cast<OffsetTo<Device> *> (value);
|
||||
}
|
||||
HB_INTERNAL static const OffsetTo<Device>& get_device (const Value* value, bool *worked=nullptr)
|
||||
{
|
||||
if (worked) *worked |= bool (*value);
|
||||
return *CastP<OffsetTo<Device>> (value);
|
||||
return *static_cast<const OffsetTo<Device> *> (value);
|
||||
}
|
||||
|
||||
HB_INTERNAL static const HBINT16& get_short (const Value* value, bool *worked=nullptr)
|
||||
{
|
||||
if (worked) *worked |= bool (*value);
|
||||
return *CastP<HBINT16> (value);
|
||||
return *reinterpret_cast<const HBINT16 *> (value);
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
|
@ -115,7 +115,7 @@ main (int argc, char **argv)
|
|||
case HB_OT_TAG_GPOS:
|
||||
{
|
||||
|
||||
const GSUBGPOS &g = *CastP<GSUBGPOS> (font_data + table.offset);
|
||||
const GSUBGPOS &g = *reinterpret_cast<const GSUBGPOS *> (font_data + table.offset);
|
||||
|
||||
int num_scripts = g.get_script_count ();
|
||||
printf (" %d script(s) found in table\n", num_scripts);
|
||||
|
@ -185,7 +185,7 @@ main (int argc, char **argv)
|
|||
case GDEF::tableTag:
|
||||
{
|
||||
|
||||
const GDEF &gdef = *CastP<GDEF> (font_data + table.offset);
|
||||
const GDEF &gdef = *reinterpret_cast<const GDEF *> (font_data + table.offset);
|
||||
|
||||
printf (" Has %sglyph classes\n",
|
||||
gdef.has_glyph_classes () ? "" : "no ");
|
||||
|
|
Loading…
Reference in New Issue