Merge "call uselocale() before freelocale() to make sure that g_local_key has a valid locale." into lmp-dev
This commit is contained in:
commit
6cc4e3b6ce
2 changed files with 4 additions and 2 deletions
|
@ -114,11 +114,12 @@ TEST(locale, mb_cur_max) {
|
|||
locale_t cloc = newlocale(LC_ALL, "C", 0);
|
||||
locale_t cloc_utf8 = newlocale(LC_ALL, "C.UTF-8", 0);
|
||||
|
||||
uselocale(cloc);
|
||||
locale_t old_locale = uselocale(cloc);
|
||||
ASSERT_EQ(1U, MB_CUR_MAX);
|
||||
uselocale(cloc_utf8);
|
||||
ASSERT_EQ(4U, MB_CUR_MAX);
|
||||
|
||||
uselocale(old_locale);
|
||||
freelocale(cloc);
|
||||
freelocale(cloc_utf8);
|
||||
}
|
||||
|
|
|
@ -428,7 +428,7 @@ TEST(stdio, snprintf_negative_zero_5084292) {
|
|||
|
||||
TEST(stdio, snprintf_utf8_15439554) {
|
||||
locale_t cloc = newlocale(LC_ALL, "C.UTF-8", 0);
|
||||
uselocale(cloc);
|
||||
locale_t old_locale = uselocale(cloc);
|
||||
|
||||
// http://b/15439554
|
||||
char buf[BUFSIZ];
|
||||
|
@ -446,6 +446,7 @@ TEST(stdio, snprintf_utf8_15439554) {
|
|||
snprintf(buf, sizeof(buf), "%d\xf0\xa4\xad\xa2%d", 1, 2);
|
||||
EXPECT_STREQ("1𤭢2", buf);
|
||||
|
||||
uselocale(old_locale);
|
||||
freelocale(cloc);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue