diff --git a/src/hb-common.h b/src/hb-common.h index e7ab4ae22..32a62e552 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, + 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 >*/ + /* 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;