Simplify Tag struct
authorBehdad Esfahbod <behdad@behdad.org>
Wed, 21 Apr 2010 04:14:12 +0000 (00:14 -0400)
committerBehdad Esfahbod <behdad@behdad.org>
Wed, 21 Apr 2010 05:55:09 +0000 (01:55 -0400)
src/hb-open-file-private.hh
src/hb-open-type-private.hh
src/hb-ot-layout-common-private.hh

index e72a098..ce5140f 100644 (file)
@@ -84,7 +84,8 @@ typedef struct OffsetTable
   }
   inline bool find_table_index (hb_tag_t tag, unsigned int *table_index) const
   {
-    const Tag t = tag;
+    Tag t;
+    t.set (tag);
     // TODO bsearch
     unsigned int count = numTables;
     for (unsigned int i = 0; i < count; i++)
index 0df9e8c..9c88f25 100644 (file)
@@ -360,7 +360,7 @@ struct Sanitizer
   struct NAME \
   { \
     static inline unsigned int get_size () { return BYTES; } \
-    inline NAME& set (TYPE i) { BIG_ENDIAN##_put_unaligned(v, i); return *this; } \
+    inline void set (TYPE i) { BIG_ENDIAN##_put_unaligned(v, i); } \
     inline operator TYPE(void) const { return BIG_ENDIAN##_get_unaligned (v); } \
     inline bool operator == (const NAME &o) const { return BIG_ENDIAN##_cmp_unaligned (v, o.v); } \
     inline bool sanitize (SANITIZE_ARG_DEF) { \
@@ -384,10 +384,6 @@ 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).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" */
   inline operator const char* (void) const { return CONST_CHARP(this); }
   inline operator char* (void) { return CHARP(this); }
index ad5e5c5..6c6d7ac 100644 (file)
@@ -85,7 +85,8 @@ struct RecordArrayOf : ArrayOf<Record<Type> > {
   }
   inline bool find_index (hb_tag_t tag, unsigned int *index) const
   {
-    const Tag t = tag;
+    Tag t;
+    t.set (tag);
     // TODO bsearch
     const Record<Type> *a = this->const_array();
     unsigned int count = this->len;