summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2014-07-20 01:17:40 -0400
committerBehdad Esfahbod <behdad@behdad.org>2014-07-20 01:17:40 -0400
commit1132a7dd0ecf1c425078e39e5471330bace42659 (patch)
tree2cad8193107c4261dc7c08a888811421cdd22ecf
parentdf99976398a53521e0228541055dcaee8f5ba87f (diff)
Add HB_TAG_MAX_SIGNED / _HB_SCRIPT_MAX_VALUE_SIGNED
To make C language police happy.
-rw-r--r--src/hb-common.h17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/hb-common.h b/src/hb-common.h
index e7ab4ae2..32a62e55 100644
--- a/src/hb-common.h
+++ b/src/hb-common.h
@@ -95,6 +95,7 @@ typedef uint32_t hb_tag_t;
#define HB_TAG_NONE HB_TAG(0,0,0,0)
#define HB_TAG_MAX HB_TAG(0xff,0xff,0xff,0xff)
+#define HB_TAG_MAX_SIGNED HB_TAG(0x7f,0xff,0xff,0xff)
/* len=-1 means str is NUL-terminated. */
hb_tag_t
@@ -295,11 +296,17 @@ typedef enum
/*7.0*/ HB_SCRIPT_WARANG_CITI = HB_TAG ('W','a','r','a'),
/* No script set. */
- /*---*/ HB_SCRIPT_INVALID = HB_TAG_NONE,
-
- /* Dummy value to ensure any hb_tag_t value can be passed/stored as hb_script_t
- * without risking undefined behavior. */
- /*---*/ _HB_SCRIPT_MAX_VALUE = HB_TAG_MAX /*< skip >*/
+ HB_SCRIPT_INVALID = HB_TAG_NONE,
+
+ /* Dummy values to ensure any hb_tag_t value can be passed/stored as hb_script_t
+ * without risking undefined behavior. Include both a signed and unsigned max,
+ * since technically enums are int, and indeed, hb_script_t ends up being signed.
+ * See this thread for technicalities:
+ *
+ * http://lists.freedesktop.org/archives/harfbuzz/2014-March/004150.html
+ */
+ _HB_SCRIPT_MAX_VALUE = HB_TAG_MAX, /*< skip >*/
+ _HB_SCRIPT_MAX_VALUE_SIGNED = HB_TAG_MAX_SIGNED /*< skip >*/
} hb_script_t;