[pango/harfbuzz-ng] [HB] Would have helped if I actually knew C++ before using it...
- From: Behdad Esfahbod <behdad src gnome org>
- To: svn-commits-list gnome org
- Subject: [pango/harfbuzz-ng] [HB] Would have helped if I actually knew C++ before using it...
- Date: Mon, 25 May 2009 04:28:21 -0400 (EDT)
commit 6e506f425a89d0ff330497b38ec8227e30d5681b
Author: Behdad Esfahbod <behdad behdad org>
Date: Mon May 25 03:20:18 2009 -0400
[HB] Would have helped if I actually knew C++ before using it...
---
pango/opentype/hb-ot-layout-gsubgpos-private.h | 4 ++--
pango/opentype/hb-ot-layout-open-private.h | 24 ++++++++++++------------
2 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/pango/opentype/hb-ot-layout-gsubgpos-private.h b/pango/opentype/hb-ot-layout-gsubgpos-private.h
index 427af25..2445f05 100644
--- a/pango/opentype/hb-ot-layout-gsubgpos-private.h
+++ b/pango/opentype/hb-ot-layout-gsubgpos-private.h
@@ -64,7 +64,7 @@ static inline bool match_glyph (hb_codepoint_t glyph_id, const USHORT &value, ch
static inline bool match_class (hb_codepoint_t glyph_id, const USHORT &value, char *data)
{
- const ClassDef &class_def = (const ClassDef &)*data;
+ const ClassDef &class_def = *(const ClassDef *)data;
return class_def.get_class (glyph_id) == value;
}
@@ -697,7 +697,7 @@ struct ExtensionFormat1
{
unsigned int offset = get_offset ();
if (HB_UNLIKELY (!offset)) return Null(LookupSubTable);
- return (LookupSubTable&) *(((char *) this) + offset);
+ return *(LookupSubTable*)(((char *) this) + offset);
}
private:
diff --git a/pango/opentype/hb-ot-layout-open-private.h b/pango/opentype/hb-ot-layout-open-private.h
index 5f02c65..96656c3 100644
--- a/pango/opentype/hb-ot-layout-open-private.h
+++ b/pango/opentype/hb-ot-layout-open-private.h
@@ -72,7 +72,7 @@
{ \
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]); \
}
@@ -145,7 +145,7 @@ template <typename Type>
struct Null
{
ASSERT_STATIC (sizeof (Type) <= sizeof (NullPool));
- static inline const Type &get () { return (const Type&) *NullPool; }
+ static inline const Type &get () { return *(const Type*)NullPool; }
};
/* Specializaiton for arbitrary-content arbitrary-sized Null objects. */
@@ -154,7 +154,7 @@ static const char _Null##Type[size] = data; \
template <> \
struct Null <Type> \
{ \
- static inline const Type &get () { return (const Type&) *_Null##Type; } \
+ static inline const Type &get () { return *(const Type*)_Null##Type; } \
}
/* Accessor macro. */
@@ -172,14 +172,14 @@ struct Null <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; \
}
/* Like get_for_data(), but checks major version first. */
#define STATIC_DEFINE_GET_FOR_DATA_CHECK_MAJOR_VERSION(Type, Major) \
static inline const Type& get_for_data (const char *data) \
{ \
if (HB_UNLIKELY (data == NULL)) return Null(Type); \
- const Type& t = (const Type&)*data; \
+ const Type& t = *(const Type*)data; \
if (HB_UNLIKELY (!t.version.major || t.version.major > Major)) return Null(Type); \
return t; \
}
@@ -228,10 +228,10 @@ DEFINE_INT_TYPE (LONG, , 32); /* 32-bit signed integer. */
* system, feature, or baseline */
struct Tag : ULONG
{
- inline Tag (const Tag &o) { (ULONG&) *this = (ULONG&) o; }
- inline Tag (uint32_t i) { (ULONG&) *this = i; }
- inline Tag (const char *c) { (ULONG&) *this = (ULONG&)*c; }
- inline bool operator== (const char *c) const { return (ULONG&) *this == (ULONG&) *c; }
+ inline Tag (const Tag &o) { *(ULONG*)this = (ULONG&) o; }
+ inline Tag (uint32_t i) { *(ULONG*)this = i; }
+ inline Tag (const char *c) { *(ULONG*)this = *(ULONG*)c; }
+ inline bool operator== (const char *c) const { return *(ULONG*)this == *(ULONG*)c; }
/* What the char* converters return is NOT nul-terminated. Print using "%.4s" */
inline operator const char* (void) const { return (const char *)this; }
inline operator char* (void) { return (char *)this; }
@@ -259,7 +259,7 @@ struct OffsetTo : Offset
{
unsigned int offset = *this;
if (HB_UNLIKELY (!offset)) return Null(Type);
- return (const Type&)*((const char *) base + offset);
+ return *(const Type*)((const char *) base + offset);
}
};
template <typename Base, typename Type>
@@ -272,7 +272,7 @@ struct LongOffsetTo : LongOffset
{
unsigned int offset = *this;
if (HB_UNLIKELY (!offset)) return Null(Type);
- return (const Type&)*((const char *) base + offset);
+ return *(const Type*)((const char *) base + offset);
}
};
template <typename Base, typename Type>
@@ -479,7 +479,7 @@ struct OpenTypeFontFile
if (HB_UNLIKELY (i >= get_face_count ())) return Null(OpenTypeFontFace);
switch (tag) {
default: /* Never happens because of the if above */
- case TrueTypeTag: case CFFTag: return (const OffsetTable&)*this;
+ case TrueTypeTag: case CFFTag: return *(const OffsetTable*)this;
case TTCTag: return this+TTCHeader::get_for_data ((const char *) this).table[i];
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]