Commit db55e070 authored by Charles Davis's avatar Charles Davis Committed by Alexandre Julliard

msvcrt: Make locale name string refcounted for C locale.

parent f71f1631
......@@ -2036,15 +2036,11 @@ static void test__get_current_locale(void)
"same locale name pointers for LC_COLLATE\n");
ok(l->locinfo->lc_category[LC_COLLATE].refcount != l2->locinfo->lc_category[LC_COLLATE].refcount,
"same refcount pointers for LC_COLLATE\n");
ok(!!l->locinfo->lc_category[LC_COLLATE].refcount, "null refcount pointer for LC_COLLATE\n");
if(l->locinfo->lc_category[LC_COLLATE].refcount)
ok(*l->locinfo->lc_category[LC_COLLATE].refcount == 1, "refcount = %d\n",
*l->locinfo->lc_category[LC_COLLATE].refcount);
ok(!!l2->locinfo->lc_category[LC_COLLATE].refcount, "null refcount pointer for LC_COLLATE\n");
if(l2->locinfo->lc_category[LC_COLLATE].refcount)
ok(*l2->locinfo->lc_category[LC_COLLATE].refcount == 2, "refcount = %d\n",
*l2->locinfo->lc_category[LC_COLLATE].refcount);
ok(*l2->locinfo->lc_category[LC_COLLATE].refcount == 2, "refcount = %d\n",
*l2->locinfo->lc_category[LC_COLLATE].refcount);
}
ok(*l->locinfo->lc_category[LC_COLLATE].refcount == 1, "refcount = %d\n",
*l->locinfo->lc_category[LC_COLLATE].refcount);
for(i = LC_CTYPE; i <= LC_MAX; i++) {
ok(l->locinfo->lc_category[i].locale == l2->locinfo->lc_category[i].locale,
"different locale name pointers for category %d\n", i);
......@@ -2107,15 +2103,11 @@ static void test__get_current_locale(void)
"same locale name pointers for category %d\n", i);
ok(l->locinfo->lc_category[i].refcount != l2->locinfo->lc_category[i].refcount,
"same refcount pointers for category %d\n", i);
ok(!!l->locinfo->lc_category[i].refcount, "null refcount pointer for category %d\n", i);
if(l->locinfo->lc_category[i].refcount)
ok(*l->locinfo->lc_category[i].refcount == 1, "refcount = %d for category %d\n",
*l->locinfo->lc_category[i].refcount, i);
ok(!!l2->locinfo->lc_category[i].refcount, "null refcount pointer for category %d\n", i);
if(l2->locinfo->lc_category[i].refcount)
ok(*l2->locinfo->lc_category[i].refcount == 2, "refcount = %d for category %d\n",
*l2->locinfo->lc_category[i].refcount, i);
ok(*l2->locinfo->lc_category[i].refcount == 2, "refcount = %d for category %d\n",
*l2->locinfo->lc_category[i].refcount, i);
}
ok(*l->locinfo->lc_category[i].refcount == 1, "refcount = %d for category %d\n",
*l->locinfo->lc_category[i].refcount, i);
}
for(i = LC_MONETARY; i <= LC_MAX; i++) {
ok(l->locinfo->lc_category[i].locale == l2->locinfo->lc_category[i].locale,
......@@ -2186,15 +2178,11 @@ static void test__get_current_locale(void)
"same locale name pointers for category %d\n", i);
ok(l->locinfo->lc_category[i].refcount != l2->locinfo->lc_category[i].refcount,
"same refcount pointers for category %d\n", i);
ok(!!l->locinfo->lc_category[i].refcount, "null refcount pointer for category %d\n", i);
if(l->locinfo->lc_category[i].refcount)
ok(*l->locinfo->lc_category[i].refcount == 1, "refcount = %d for category %d\n",
*l->locinfo->lc_category[i].refcount, i);
ok(!!l2->locinfo->lc_category[i].refcount, "null refcount pointer for category %d\n", i);
if(l2->locinfo->lc_category[i].refcount)
ok(*l2->locinfo->lc_category[i].refcount == 2, "refcount = %d for category %d\n",
*l2->locinfo->lc_category[i].refcount, i);
ok(*l2->locinfo->lc_category[i].refcount == 2, "refcount = %d for category %d\n",
*l2->locinfo->lc_category[i].refcount, i);
}
ok(*l->locinfo->lc_category[i].refcount == 1, "refcount = %d for category %d\n",
*l->locinfo->lc_category[i].refcount, i);
}
for(i = LC_NUMERIC; i <= LC_MAX; i++) {
ok(l->locinfo->lc_category[i].locale == l2->locinfo->lc_category[i].locale,
......@@ -2273,15 +2261,11 @@ static void test__get_current_locale(void)
"same locale name pointers for category %d\n", i);
ok(l->locinfo->lc_category[i].refcount != l2->locinfo->lc_category[i].refcount,
"same refcount pointers for category %d\n", i);
ok(!!l->locinfo->lc_category[i].refcount, "null refcount pointer for category %d\n", i);
if(l->locinfo->lc_category[i].refcount)
ok(*l->locinfo->lc_category[i].refcount == 1, "refcount = %d for category %d\n",
*l->locinfo->lc_category[i].refcount, i);
ok(!!l2->locinfo->lc_category[i].refcount, "null refcount pointer for category %d\n", i);
if(l2->locinfo->lc_category[i].refcount)
ok(*l2->locinfo->lc_category[i].refcount == 2, "refcount = %d for category %d\n",
*l2->locinfo->lc_category[i].refcount, i);
ok(*l2->locinfo->lc_category[i].refcount == 2, "refcount = %d for category %d\n",
*l2->locinfo->lc_category[i].refcount, i);
}
ok(*l->locinfo->lc_category[i].refcount == 1, "refcount = %d for category %d\n",
*l->locinfo->lc_category[i].refcount, i);
}
ok(l->locinfo->lc_category[LC_TIME].locale == l2->locinfo->lc_category[LC_TIME].locale,
"different locale name pointers for LC_TIME\n");
......@@ -2353,21 +2337,17 @@ static void test__get_current_locale(void)
ok(l2->locinfo->refcount == 2, "refcount = %d\n", l2->locinfo->refcount);
}
todo_wine {
for(i = LC_MIN+1; i <= LC_MAX; i++) {
for(i = LC_MIN+1; i <= LC_MAX; i++) {
todo_wine {
ok(l->locinfo->lc_category[i].locale != l2->locinfo->lc_category[i].locale,
"same locale name pointers for category %d\n", i);
ok(l->locinfo->lc_category[i].refcount != l2->locinfo->lc_category[i].refcount,
"same refcount pointers for category %d\n", i);
ok(!!l->locinfo->lc_category[i].refcount, "null refcount pointer for category %d\n", i);
if(l->locinfo->lc_category[i].refcount)
ok(*l->locinfo->lc_category[i].refcount == 1, "refcount = %d for category %d\n",
*l->locinfo->lc_category[i].refcount, i);
ok(!!l2->locinfo->lc_category[i].refcount, "null refcount pointer for category %d\n", i);
if(l2->locinfo->lc_category[i].refcount)
ok(*l2->locinfo->lc_category[i].refcount == 2, "refcount = %d for category %d\n",
*l2->locinfo->lc_category[i].refcount, i);
ok(*l2->locinfo->lc_category[i].refcount == 2, "refcount = %d for category %d\n",
*l2->locinfo->lc_category[i].refcount, i);
}
ok(*l->locinfo->lc_category[i].refcount == 1, "refcount = %d for category %d\n",
*l->locinfo->lc_category[i].refcount, i);
}
todo_wine {
......
......@@ -1247,8 +1247,12 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category,
free_locinfo(locinfo);
return NULL;
}
} else
locinfo->lc_category[MSVCRT_LC_COLLATE].locale = MSVCRT__strdup("C");
} else {
if(!init_category_name("C", 1, locinfo, MSVCRT_LC_COLLATE)) {
free_locinfo(locinfo);
return NULL;
}
}
if(locale_name[MSVCRT_LC_CTYPE] &&
!init_category_name(locale_name[MSVCRT_LC_CTYPE],
......@@ -1325,7 +1329,10 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category,
locinfo->lc_clike = 1;
locinfo->mb_cur_max = 1;
locinfo->pctype = MSVCRT__ctype+1;
locinfo->lc_category[MSVCRT_LC_CTYPE].locale = MSVCRT__strdup("C");
if(!init_category_name("C", 1, locinfo, MSVCRT_LC_CTYPE)) {
free_locinfo(locinfo);
return NULL;
}
for(i=0; i<256; i++) {
if(locinfo->pctype[i] & MSVCRT__LEADBYTE)
......@@ -1617,7 +1624,10 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category,
locinfo->lconv->_W_negative_sign[0] = '\0';
#endif
locinfo->lc_category[MSVCRT_LC_MONETARY].locale = MSVCRT__strdup("C");
if(!init_category_name("C", 1, locinfo, MSVCRT_LC_MONETARY)) {
free_locinfo(locinfo);
return NULL;
}
}
if(locale_name[MSVCRT_LC_NUMERIC] &&
......@@ -1735,7 +1745,10 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category,
locinfo->lconv->_W_thousands_sep[0] = '\0';
#endif
locinfo->lc_category[MSVCRT_LC_NUMERIC].locale = MSVCRT__strdup("C");
if (!init_category_name("C", 1, locinfo, MSVCRT_LC_NUMERIC)) {
free_locinfo(locinfo);
return NULL;
}
}
if(locale_name[MSVCRT_LC_TIME] &&
......@@ -1767,7 +1780,10 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category,
return NULL;
}
} else {
locinfo->lc_category[MSVCRT_LC_TIME].locale = MSVCRT__strdup("C");
if(!init_category_name("C", 1, locinfo, MSVCRT_LC_TIME)) {
free_locinfo(locinfo);
return NULL;
}
locinfo->lc_time_curr = &cloc_time_data;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment