From: Behdad Esfahbod Date: Mon, 11 Apr 2011 17:12:37 +0000 (-0400) Subject: Rename HB_TAG_STR() to HB_TAG_CHAR4() X-Git-Tag: submit/2.0alpha-wayland/20121130.004132~9^2~391 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=07233581c9d953708d3c020907c42b8b89472b89;p=profile%2Fivi%2Forg.tizen.video-player.git Rename HB_TAG_STR() to HB_TAG_CHAR4() The problem with HB_TAG_STR() was that it expected a string of size 4 exactly, and unlike hb_tag_from_string() it doesn't pad the tag with space characters. So, the new name is more appropriate. --- diff --git a/src/hb-common.c b/src/hb-common.c index 74f8933..3dfdbe8 100644 --- a/src/hb-common.c +++ b/src/hb-common.c @@ -40,7 +40,7 @@ hb_tag_from_string (const char *s) for (; i < 4; i++) tag[i] = ' '; - return HB_TAG_STR (tag); + return HB_TAG_CHAR4 (tag); } diff --git a/src/hb-common.h b/src/hb-common.h index ba65ec1..d46c4a8 100644 --- a/src/hb-common.h +++ b/src/hb-common.h @@ -55,10 +55,10 @@ typedef int hb_bool_t; typedef uint32_t hb_tag_t; #define HB_TAG(a,b,c,d) ((hb_tag_t)((((uint8_t)(a))<<24)|(((uint8_t)(b))<<16)|(((uint8_t)(c))<<8)|((uint8_t)(d)))) -#define HB_TAG_STR(s) (HB_TAG(((const char *) s)[0], \ - ((const char *) s)[1], \ - ((const char *) s)[2], \ - ((const char *) s)[3])) +#define HB_TAG_CHAR4(s) (HB_TAG(((const char *) s)[0], \ + ((const char *) s)[1], \ + ((const char *) s)[2], \ + ((const char *) s)[3])) #define HB_TAG_NONE HB_TAG(0,0,0,0) hb_tag_t hb_tag_from_string (const char *s); diff --git a/src/hb-ot-tag.c b/src/hb-ot-tag.c index df86bd4..4017c88 100644 --- a/src/hb-ot-tag.c +++ b/src/hb-ot-tag.c @@ -645,7 +645,7 @@ hb_ot_tag_from_language (hb_language_t language) tag[i] = TO_UPPER (lang_str[i]); for (; i < 4; i++) tag[i] = ' '; - return HB_TAG_STR (tag); + return HB_TAG_CHAR4 (tag); } /* find a language matching in the first component */ diff --git a/test/test-types.c b/test/test-types.c index 1c72673..0f32e42 100644 --- a/test/test-types.c +++ b/test/test-types.c @@ -85,7 +85,7 @@ test_types_tag (void) g_assert_cmphex (HB_TAG_NONE, ==, 0); g_assert_cmphex (HB_TAG ('a','B','c','D'), ==, 0x61426344); - g_assert_cmphex (HB_TAG_STR ("aBcD"), ==, 0x61426344); + g_assert_cmphex (HB_TAG_CHAR4 ("aBcD"), ==, 0x61426344); g_assert_cmphex (hb_tag_from_string ("aBcDe"), ==, 0x61426344); g_assert_cmphex (hb_tag_from_string ("aBcD"), ==, 0x61426344);