Add HB_TAG_MAX_SIGNED / _HB_SCRIPT_MAX_VALUE_SIGNED

To make C language police happy.
This commit is contained in:
Behdad Esfahbod 2014-07-20 01:17:40 -04:00
parent df99976398
commit 1132a7dd0e
1 changed files with 11 additions and 4 deletions

View File

@ -95,6 +95,7 @@ typedef uint32_t hb_tag_t;
#define HB_TAG_NONE HB_TAG(0,0,0,0) #define HB_TAG_NONE HB_TAG(0,0,0,0)
#define HB_TAG_MAX HB_TAG(0xff,0xff,0xff,0xff) #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. */ /* len=-1 means str is NUL-terminated. */
hb_tag_t hb_tag_t
@ -295,11 +296,17 @@ typedef enum
/*7.0*/ HB_SCRIPT_WARANG_CITI = HB_TAG ('W','a','r','a'), /*7.0*/ HB_SCRIPT_WARANG_CITI = HB_TAG ('W','a','r','a'),
/* No script set. */ /* 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 /* Dummy values to ensure any hb_tag_t value can be passed/stored as hb_script_t
* without risking undefined behavior. */ * without risking undefined behavior. Include both a signed and unsigned max,
/*---*/ _HB_SCRIPT_MAX_VALUE = HB_TAG_MAX /*< skip >*/ * 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; } hb_script_t;