提交 7ff7401c 编写于 作者: B Behdad Esfahbod

Make hb_tag_from_string(NULL) return HB_TAG_NONE

上级 02f6e62d
......@@ -35,6 +35,9 @@ hb_tag_from_string (const char *s)
char tag[4];
unsigned int i;
if (!s)
return HB_TAG_NONE;
for (i = 0; i < 4 && s[i]; i++)
tag[i] = s[i];
for (; i < 4; i++)
......
......@@ -83,6 +83,7 @@ static void
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_CHAR4 ("aBcD"), ==, 0x61426344);
......@@ -93,6 +94,8 @@ test_types_tag (void)
g_assert_cmphex (hb_tag_from_string ("aB"), ==, 0x61422020);
g_assert_cmphex (hb_tag_from_string ("a"), ==, 0x61202020);
g_assert_cmphex (hb_tag_from_string (""), ==, 0x20202020);
g_assert_cmphex (hb_tag_from_string (NULL), ==, HB_TAG_NONE);
}
int
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册