summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2009-11-19 20:35:07 -0500
committerBehdad Esfahbod <behdad@behdad.org>2009-11-19 20:35:07 -0500
commit27b2a4a4d504d6ba06b8acd91eab17796bc3b3c8 (patch)
treeb1380dcea7df2cecbb4417ef3f2b4b7a9dbe4d15
parent640404de481360206d0c08f7528ff14cf9166814 (diff)
downloadpango-27b2a4a4d504d6ba06b8acd91eab17796bc3b3c8.tar.gz
Another C++ strictness fix
Pango Bug 602408 - Invalid C++ code breaks compile with Sun C++ Compiler (Error: A union member cannot have a user-defined assignment operator) According to the bug: C++ Programming Language by Bjarne Stroustrup: Chapter 10.4.12 forbids explicitly using of union members with constructors, destructors or assignment operations. So we use a set() method instead of the assignment operator. Ugly, but hey, that's life. Cherry-pick from harfbuzz-ng repo.
-rw-r--r--pango/opentype/hb-open-type-private.hh8
-rw-r--r--pango/opentype/hb-ot-layout-common-private.hh2
2 files changed, 5 insertions, 5 deletions
diff --git a/pango/opentype/hb-open-type-private.hh b/pango/opentype/hb-open-type-private.hh
index 4061cfe8..df8d217e 100644
--- a/pango/opentype/hb-open-type-private.hh
+++ b/pango/opentype/hb-open-type-private.hh
@@ -258,7 +258,7 @@ _hb_sanitize_edit (SANITIZE_ARG_DEF,
#define NEUTER(Var, Val) \
(SANITIZE_OBJ (Var) && \
_hb_sanitize_edit (SANITIZE_ARG, CONST_CHARP(&(Var)), sizeof (Var)) && \
- ((Var) = (Val), true))
+ ((Var).set (Val), true))
/* Template to sanitize an object. */
@@ -345,7 +345,7 @@ struct Sanitizer
#define _DEFINE_INT_TYPE1_UNALIGNED(NAME, TYPE, BIG_ENDIAN, BYTES) \
struct NAME \
{ \
- inline NAME& operator = (TYPE i) { (TYPE&) v = BIG_ENDIAN (i); return *this; } \
+ inline NAME& set (TYPE i) { (TYPE&) v = BIG_ENDIAN (i); return *this; } \
inline operator TYPE(void) const { return BIG_ENDIAN ((TYPE&) v); } \
inline bool operator== (NAME o) const { return (TYPE&) v == (TYPE&) o.v; } \
inline bool sanitize (SANITIZE_ARG_DEF) { \
@@ -359,7 +359,7 @@ struct Sanitizer
#define DEFINE_INT_TYPE1(NAME, TYPE, BIG_ENDIAN, BYTES) \
struct NAME \
{ \
- inline NAME& operator = (TYPE i) { BIG_ENDIAN##_put_unaligned(v, i); return *this; } \
+ inline NAME& set (TYPE i) { BIG_ENDIAN##_put_unaligned(v, i); return *this; } \
inline operator TYPE(void) const { return BIG_ENDIAN##_get_unaligned (v); } \
inline bool operator== (NAME o) const { return BIG_ENDIAN##_cmp_unaligned (v, o.v); } \
inline bool sanitize (SANITIZE_ARG_DEF) { \
@@ -384,7 +384,7 @@ DEFINE_INT_TYPE (LONG, , 32); /* 32-bit signed integer. */
struct Tag : ULONG
{
inline Tag (const Tag &o) { *(ULONG*)this = (ULONG&) o; }
- inline Tag (uint32_t i) { *(ULONG*)this = i; }
+ inline Tag (uint32_t i) { (*(ULONG*)this).set (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" */
diff --git a/pango/opentype/hb-ot-layout-common-private.hh b/pango/opentype/hb-ot-layout-common-private.hh
index a1e625d9..bb85928c 100644
--- a/pango/opentype/hb-ot-layout-common-private.hh
+++ b/pango/opentype/hb-ot-layout-common-private.hh
@@ -320,7 +320,7 @@ struct CoverageFormat1
if (HB_UNLIKELY (glyph_id > 0xFFFF))
return NOT_COVERED;
GlyphID gid;
- gid = glyph_id;
+ gid.set (glyph_id);
// TODO: bsearch
unsigned int num_glyphs = glyphArray.len;
for (unsigned int i = 0; i < num_glyphs; i++)