From b84ceb2fcf7a71fe03f499dd0c4611254b561f1d Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 10 Dec 2019 13:02:48 -0600 Subject: [PATCH] [machinery] Remove CastP --- src/hb-machinery.hh | 8 -------- src/hb-ot-layout-gpos-table.hh | 8 +++++--- src/main.cc | 4 ++-- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/hb-machinery.hh b/src/hb-machinery.hh index 4730922aa..66b0969e6 100644 --- a/src/hb-machinery.hh +++ b/src/hb-machinery.hh @@ -49,14 +49,6 @@ template static inline Type& CastR(TObject &X) { return reinterpret_cast (X); } -/* Cast to struct T, pointer to pointer */ -template -static inline const Type* CastP(const TObject *X) -{ return reinterpret_cast (X); } -template -static inline Type* CastP(TObject *X) -{ return reinterpret_cast (X); } - /* StructAtOffset(P,Ofs) returns the struct T& that is placed at memory * location pointed to by P plus Ofs bytes. */ template diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh index d680dea60..d11aae28d 100644 --- a/src/hb-ot-layout-gpos-table.hh +++ b/src/hb-ot-layout-gpos-table.hh @@ -174,17 +174,19 @@ struct ValueFormat : HBUINT16 } HB_INTERNAL static OffsetTo& get_device (Value* value) - { return *CastP> (value); } + { + return *static_cast *> (value); + } HB_INTERNAL static const OffsetTo& get_device (const Value* value, bool *worked=nullptr) { if (worked) *worked |= bool (*value); - return *CastP> (value); + return *static_cast *> (value); } HB_INTERNAL static const HBINT16& get_short (const Value* value, bool *worked=nullptr) { if (worked) *worked |= bool (*value); - return *CastP (value); + return *reinterpret_cast (value); } public: diff --git a/src/main.cc b/src/main.cc index 983cb557d..54d8629fb 100644 --- a/src/main.cc +++ b/src/main.cc @@ -115,7 +115,7 @@ main (int argc, char **argv) case HB_OT_TAG_GPOS: { - const GSUBGPOS &g = *CastP (font_data + table.offset); + const GSUBGPOS &g = *reinterpret_cast (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 (font_data + table.offset); + const GDEF &gdef = *reinterpret_cast (font_data + table.offset); printf (" Has %sglyph classes\n", gdef.has_glyph_classes () ? "" : "no ");