diff --git a/src/hb-machinery.hh b/src/hb-machinery.hh index 66b0969e6..8e96a3a7d 100644 --- a/src/hb-machinery.hh +++ b/src/hb-machinery.hh @@ -41,14 +41,6 @@ * Casts */ -/* Cast to struct T, reference to reference */ -template -static inline const Type& CastR(const TObject &X) -{ return reinterpret_cast (X); } -template -static inline Type& CastR(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-open-file.hh b/src/hb-open-file.hh index cb1fdf1c9..23ca44dee 100644 --- a/src/hb-open-file.hh +++ b/src/hb-open-file.hh @@ -284,7 +284,7 @@ struct TTCHeader struct ResourceRecord { const OpenTypeFontFace & get_face (const void *data_base) const - { return CastR ((data_base+offset).arrayZ); } + { return * reinterpret_cast ((data_base+offset).arrayZ); } bool sanitize (hb_sanitize_context_t *c, const void *data_base) const diff --git a/src/hb-ot-layout-common.hh b/src/hb-ot-layout-common.hh index 5031a2099..abd88334c 100644 --- a/src/hb-ot-layout-common.hh +++ b/src/hb-ot-layout-common.hh @@ -775,10 +775,10 @@ struct Lookup template const OffsetArrayOf& get_subtables () const - { return CastR> (subTable); } + { return reinterpret_cast &> (subTable); } template OffsetArrayOf& get_subtables () - { return CastR> (subTable); } + { return reinterpret_cast &> (subTable); } template const TSubTable& get_subtable (unsigned int i) const diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh index d11aae28d..ff09ecb42 100644 --- a/src/hb-ot-layout-gpos-table.hh +++ b/src/hb-ot-layout-gpos-table.hh @@ -1918,7 +1918,7 @@ struct GPOS : GSUBGPOS static constexpr hb_tag_t tableTag = HB_OT_TAG_GPOS; const PosLookup& get_lookup (unsigned int i) const - { return CastR (GSUBGPOS::get_lookup (i)); } + { return static_cast (GSUBGPOS::get_lookup (i)); } static inline void position_start (hb_font_t *font, hb_buffer_t *buffer); static inline void position_finish_advances (hb_font_t *font, hb_buffer_t *buffer); diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh index fc21cb056..c0966e27d 100644 --- a/src/hb-ot-layout-gsub-table.hh +++ b/src/hb-ot-layout-gsub-table.hh @@ -1343,7 +1343,7 @@ struct SubstLookup : Lookup { unsigned int type = get_type (); if (unlikely (type == SubTable::Extension)) - return CastR (get_subtable(0)).is_reverse (); + return reinterpret_cast (get_subtable(0)).is_reverse (); return lookup_type_is_reverse (type); } @@ -1499,7 +1499,7 @@ struct GSUB : GSUBGPOS static constexpr hb_tag_t tableTag = HB_OT_TAG_GSUB; const SubstLookup& get_lookup (unsigned int i) const - { return CastR (GSUBGPOS::get_lookup (i)); } + { return static_cast (GSUBGPOS::get_lookup (i)); } bool subset (hb_subset_context_t *c) const { return GSUBGPOS::subset (c); } @@ -1524,7 +1524,7 @@ struct GSUB_accelerator_t : GSUB::accelerator_t {}; { unsigned int type = get_type (); if (unlikely (type == SubTable::Extension)) - return CastR (get_subtable()).is_reverse (); + return reinterpret_cast (get_subtable()).is_reverse (); return SubstLookup::lookup_type_is_reverse (type); } template diff --git a/src/hb-ot-layout-gsubgpos.hh b/src/hb-ot-layout-gsubgpos.hh index 82cf96966..7c89fed6c 100644 --- a/src/hb-ot-layout-gsubgpos.hh +++ b/src/hb-ot-layout-gsubgpos.hh @@ -2741,7 +2741,7 @@ struct ExtensionFormat1 template const X& get_subtable () const - { return this + CastR> (extensionOffset); } + { return this + reinterpret_cast &> (extensionOffset); } template typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const @@ -2913,9 +2913,9 @@ struct GSUBGPOS typedef OffsetListOf TLookupList; /* TODO Use intersects() to count how many subtables survive? */ - CastR> (out->lookupList) + reinterpret_cast &> (out->lookupList) .serialize_subset (c, - CastR> (lookupList), + reinterpret_cast &> (lookupList), this, out); @@ -2942,7 +2942,7 @@ struct GSUBGPOS likely (version.major == 1) && scriptList.sanitize (c, this) && featureList.sanitize (c, this) && - CastR> (lookupList).sanitize (c, this)))) + reinterpret_cast &> (lookupList).sanitize (c, this)))) return_trace (false); #ifndef HB_NO_VAR