[HarfBuzz] harfbuzz: Branch 'master'

Behdad Esfahbod behdad at kemper.freedesktop.org
Fri Sep 7 19:04:04 UTC 2018


 src/hb-buffer.hh           |    2 +-
 src/hb-machinery.hh        |    8 ++++----
 src/hb-open-file.hh        |    2 +-
 src/hb-open-type.hh        |    2 +-
 src/hb-ot-layout-common.hh |    2 +-
 src/hb-ot-layout.cc        |    4 ++--
 src/hb-set-digest.hh       |    4 ++--
 src/hb-set.hh              |   12 ++++++------
 8 files changed, 18 insertions(+), 18 deletions(-)

New commits:
commit fda994e1d45c4d34601af7272f37ea257f92a3d8
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri Sep 7 15:02:57 2018 -0400

    Use enum instead of "static const" in class scope
    
    Technically, static const needs an out-of-class definition.  Eg:
    
      CXXLD    libharfbuzz-subset.la
    Undefined symbols for architecture x86_64:
      "OT::FeatureVariationRecord::min_size", referenced from:
          bool OT::GSUBGPOS::subset<OT::PosLookup>(hb_subset_context_t*) constin libharfbuzz_subset_la-hb-subset.o
          bool OT::GSUBGPOS::subset<OT::SubstLookup>(hb_subset_context_t*) constin libharfbuzz_subset_la-hb-subset.o
      "OT::Record<OT::LangSys>::min_size", referenced from:
          OT::Script::subset(hb_subset_context_t*) constin libharfbuzz_subset_la-hb-subset.o
      "OT::IntType<unsigned short, 2u>::min_size", referenced from:
          OT::Script::subset(hb_subset_context_t*) constin libharfbuzz_subset_la-hb-subset.o
          OT::RecordListOf<OT::Feature>::subset(hb_subset_context_t*) const  in libharfbuzz_subset_la-hb-subset.o
    ld: symbol(s) not found for architecture x86_64
    collect2: ld returned 1 exit status
    make[4]: *** [libharfbuzz-subset.la] Error 1
    make[3]: *** [all-recursive] Error 1
    make[2]: *** [all] Error 2
    make[1]: *** [all-recursive] Error 1
    make: *** [all] Error 2
    Exited with code 2

diff --git a/src/hb-buffer.hh b/src/hb-buffer.hh
index 3e38fe1d..bcaf066c 100644
--- a/src/hb-buffer.hh
+++ b/src/hb-buffer.hh
@@ -119,7 +119,7 @@ struct hb_buffer_t
   /* Text before / after the main buffer contents.
    * Always in Unicode, and ordered outward.
    * Index 0 is for "pre-context", 1 for "post-context". */
-  static const unsigned int CONTEXT_LENGTH = 5;
+  enum { CONTEXT_LENGTH = 5 };
   hb_codepoint_t context[2][CONTEXT_LENGTH];
   unsigned int context_len[2];
 
diff --git a/src/hb-machinery.hh b/src/hb-machinery.hh
index 68994160..62f49072 100644
--- a/src/hb-machinery.hh
+++ b/src/hb-machinery.hh
@@ -99,8 +99,8 @@ static inline Type& StructAfter(TObject &X)
 
 #define DEFINE_SIZE_STATIC(size) \
   DEFINE_INSTANCE_ASSERTION (sizeof (*this) == (size)); \
-  static const unsigned int static_size = (size); \
-  static const unsigned int min_size = (size); \
+  enum { static_size = (size) }; \
+  enum { min_size = (size) }; \
   inline unsigned int get_size (void) const { return (size); }
 
 #define DEFINE_SIZE_UNION(size, _member) \
@@ -114,7 +114,7 @@ static inline Type& StructAfter(TObject &X)
 #define DEFINE_SIZE_ARRAY(size, array) \
   DEFINE_INSTANCE_ASSERTION (sizeof (*this) == (size) + VAR * sizeof (array[0])); \
   DEFINE_COMPILES_ASSERTION ((void) array[0].static_size) \
-  static const unsigned int min_size = (size); \
+  enum { min_size = (size) }; \
 
 #define DEFINE_SIZE_ARRAY_SIZED(size, array) \
 	DEFINE_SIZE_ARRAY(size, array); \
@@ -133,7 +133,7 @@ static inline Type& StructAfter(TObject &X)
 template <typename Context, typename Return, unsigned int MaxDebugDepth>
 struct hb_dispatch_context_t
 {
-  static const unsigned int max_debug_depth = MaxDebugDepth;
+  enum { max_debug_depth = MaxDebugDepth };
   typedef Return return_t;
   template <typename T, typename F>
   inline bool may_dispatch (const T *obj, const F *format) { return true; }
diff --git a/src/hb-open-file.hh b/src/hb-open-file.hh
index 847f9b06..d3b74860 100644
--- a/src/hb-open-file.hh
+++ b/src/hb-open-file.hh
@@ -115,7 +115,7 @@ typedef struct OffsetTable
      * table list. */
     int i = tables.len < 64 ? tables.lsearch (t) : tables.bsearch (t);
     if (table_index)
-      *table_index = i == -1 ? Index::NOT_FOUND_INDEX : (unsigned int) i;
+      *table_index = i == -1 ? (unsigned) Index::NOT_FOUND_INDEX : (unsigned) i;
     return i != -1;
   }
   inline const TableRecord& get_table_by_tag (hb_tag_t tag) const
diff --git a/src/hb-open-type.hh b/src/hb-open-type.hh
index 29afa945..ef18163f 100644
--- a/src/hb-open-type.hh
+++ b/src/hb-open-type.hh
@@ -150,7 +150,7 @@ typedef HBUINT16 NameID;
 
 /* Script/language-system/feature index */
 struct Index : HBUINT16 {
-  static const unsigned int NOT_FOUND_INDEX = 0xFFFFu;
+  enum { NOT_FOUND_INDEX = 0xFFFFu };
 };
 DECLARE_NULL_NAMESPACE_BYTES (OT, Index);
 
diff --git a/src/hb-ot-layout-common.hh b/src/hb-ot-layout-common.hh
index ca3d7d5d..dd65f338 100644
--- a/src/hb-ot-layout-common.hh
+++ b/src/hb-ot-layout-common.hh
@@ -1743,7 +1743,7 @@ struct FeatureVariationRecord
 
 struct FeatureVariations
 {
-  static const unsigned int NOT_FOUND_INDEX = 0xFFFFFFFFu;
+  enum { NOT_FOUND_INDEX = 0xFFFFFFFFu };
 
   inline bool find_index (const int *coords, unsigned int coord_len,
 			  unsigned int *index) const
diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc
index 34507891..a1220f4d 100644
--- a/src/hb-ot-layout.cc
+++ b/src/hb-ot-layout.cc
@@ -1068,7 +1068,7 @@ hb_ot_layout_get_size_params (hb_face_t    *face,
 
 struct GSUBProxy
 {
-  static const unsigned int table_index = 0;
+  enum { table_index = 0 };
   static const bool inplace = false;
   typedef OT::SubstLookup Lookup;
 
@@ -1082,7 +1082,7 @@ struct GSUBProxy
 
 struct GPOSProxy
 {
-  static const unsigned int table_index = 1;
+  enum { table_index = 1 };
   static const bool inplace = true;
   typedef OT::PosLookup Lookup;
 
diff --git a/src/hb-set-digest.hh b/src/hb-set-digest.hh
index 4cd7c3ff..0f9329f6 100644
--- a/src/hb-set-digest.hh
+++ b/src/hb-set-digest.hh
@@ -50,8 +50,8 @@ struct hb_set_digest_lowest_bits_t
 {
   ASSERT_POD ();
 
-  static const unsigned int mask_bytes = sizeof (mask_t);
-  static const unsigned int mask_bits = sizeof (mask_t) * 8;
+  enum { mask_bytes = sizeof (mask_t) };
+  enum { mask_bits = sizeof (mask_t) * 8 };
   static const unsigned int num_bits = 0
 				     + (mask_bytes >= 1 ? 3 : 0)
 				     + (mask_bytes >= 2 ? 1 : 0)
diff --git a/src/hb-set.hh b/src/hb-set.hh
index a179ad13..353403e9 100644
--- a/src/hb-set.hh
+++ b/src/hb-set.hh
@@ -157,7 +157,7 @@ struct hb_set_t
     }
 
     typedef unsigned long long elt_t;
-    static const unsigned int PAGE_BITS = 512;
+    enum { PAGE_BITS = 512 };
     static_assert ((PAGE_BITS & ((PAGE_BITS) - 1)) == 0, "");
 
     static inline unsigned int elt_get_min (const elt_t &elt) { return hb_ctz (elt); }
@@ -165,11 +165,11 @@ struct hb_set_t
 
     typedef hb_vector_size_t<elt_t, PAGE_BITS / 8> vector_t;
 
-    static const unsigned int ELT_BITS = sizeof (elt_t) * 8;
-    static const unsigned int ELT_MASK = ELT_BITS - 1;
-    static const unsigned int BITS = sizeof (vector_t) * 8;
-    static const unsigned int MASK = BITS - 1;
-    static_assert (PAGE_BITS == BITS, "");
+    enum { ELT_BITS = sizeof (elt_t) * 8 };
+    enum { ELT_MASK = ELT_BITS - 1 };
+    enum { BITS = sizeof (vector_t) * 8 };
+    enum { MASK = BITS - 1 };
+    static_assert ((unsigned) PAGE_BITS == (unsigned) BITS, "");
 
     elt_t &elt (hb_codepoint_t g) { return v[(g & MASK) / ELT_BITS]; }
     elt_t const &elt (hb_codepoint_t g) const { return v[(g & MASK) / ELT_BITS]; }


More information about the HarfBuzz mailing list