private:
inline const Device& get_device (void) const {
if (HB_UNLIKELY (!deviceTable)) return Null(Device);
- return *(const Device*)((const char*)this + deviceTable);
+ return (const Device&)*((const char*)this + deviceTable);
}
inline int get_caret_value (int ppem) const {
struct PosLookup : Lookup {
inline const PosLookupSubTable& get_subtable (unsigned int i) const {
- return *(PosLookupSubTable*)&(((Lookup *)this)->get_subtable (i));
+ return (const PosLookupSubTable&) Lookup::get_subtable (i);
}
/* Like get_type(), but looks through extension lookups.
/* XXX check version here? */
inline const PosLookup& get_lookup (unsigned int i) const {
- return *(PosLookup*)&(((GSUBGPOS *)this)->get_lookup (i));
+ return (PosLookup&)(((GSUBGPOS *)this)->get_lookup (i));
}
inline bool position_lookup (hb_ot_layout_t *layout,
if (HB_UNLIKELY (lookup_type == GPOS_Extension))
return false;
- return (*(PosLookupSubTable *)(((char *) this) + get_offset ())).position (LOOKUP_ARGS, lookup_type);
+ return ((PosLookupSubTable&)*(((char *) this) + get_offset ())).position (LOOKUP_ARGS, lookup_type);
}
static inline bool position_lookup (LOOKUP_ARGS_DEF, unsigned int lookup_index) {
struct SubstLookup : Lookup {
inline const SubstLookupSubTable& get_subtable (unsigned int i) const {
- return *(SubstLookupSubTable*)&(((Lookup *)this)->get_subtable (i));
+ return (const SubstLookupSubTable&) Lookup::get_subtable (i);
}
/* Like get_type(), but looks through extension lookups.
/* XXX check version here? */
inline const SubstLookup& get_lookup (unsigned int i) const {
- return *(SubstLookup*)&(((GSUBGPOS *)this)->get_lookup (i));
+ return (SubstLookup&)(((GSUBGPOS *)this)->get_lookup (i));
}
inline bool substitute_lookup (hb_ot_layout_t *layout,
if (HB_UNLIKELY (lookup_type == GSUB_Extension))
return false;
- return (*(SubstLookupSubTable *)(((char *) this) + get_offset ())).substitute (LOOKUP_ARGS, lookup_type);
+ return ((SubstLookupSubTable&)*(((char *) this) + get_offset ())).substitute (LOOKUP_ARGS, lookup_type);
}
static inline bool substitute_lookup (LOOKUP_ARGS_DEF, unsigned int lookup_index) {
inline const Type& operator[] (unsigned int i) const { \
if (HB_UNLIKELY (i >= num)) return Null(Type); \
if (HB_UNLIKELY (!array[i])) return Null(Type); \
- return *(const Type *)((const char*)this + array[i]); \
+ return (const Type&)*((const char*)this + array[i]); \
}
template <typename Type>
struct Null {
ASSERT_STATIC (sizeof (Type) <= sizeof (NullPool));
- static inline const Type &get () { return (const Type&) *(const Type*) NullPool; }
+ static inline const Type &get () { return (const Type&) *NullPool; }
};
/* Specializaiton for arbitrary-content arbitrary-sized Null objects. */
#define DEFINE_NULL_DATA(Type, size, data) \
template <> \
struct Null <Type> { \
- static inline const Type &get () { static const char bytes[size] = data; return (const Type&) *(const Type*) bytes; } \
+ static inline const Type &get () { static const char bytes[size] = data; return (const Type&) *bytes; /* XXX */ } \
}
/* Accessor macro. */
#define STATIC_DEFINE_GET_FOR_DATA(Type) \
static inline const Type& get_for_data (const char *data) { \
if (HB_UNLIKELY (data == NULL)) return Null(Type); \
- return *(const Type*)data; \
+ return (const Type&)*data; \
} \
static inline Type& get_for_data (char *data) { \
- return *(Type*)data; \
+ return (Type&)*data; \
}