diff --git a/src/hb-buffer.hh b/src/hb-buffer.hh index 3e38fe1de..bcaf066c7 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 689941601..62f490721 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 struct hb_dispatch_context_t { - static const unsigned int max_debug_depth = MaxDebugDepth; + enum { max_debug_depth = MaxDebugDepth }; typedef Return return_t; template 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 847f9b060..d3b748602 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 29afa9451..ef18163fa 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 ca3d7d5d1..dd65f3384 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 345078917..a1220f4dd 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 4cd7c3ff8..0f9329f62 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 a179ad13d..353403e92 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 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]; }