Wine-Devel
By thread
wine-devel@list.winehq.org
By month
Messages by month
- ----- 2026 -----
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
January 2020
- 75 participants
- 1522 messages
[PATCH 5/8] msvcrt: Copy LC_COLLATE codepage between threadlocinfo instances.
by Chip Davis
Signed-off-by: Chip Davis <cdavis(a)codeweavers.com>
---
dlls/msvcrt/locale.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/dlls/msvcrt/locale.c b/dlls/msvcrt/locale.c
index 747beadc365b..8263f0ba1f83 100644
--- a/dlls/msvcrt/locale.c
+++ b/dlls/msvcrt/locale.c
@@ -1249,6 +1249,7 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category,
free_locinfo(locinfo);
return NULL;
}
+ locinfo->lc_collate_cp = old_locinfo->lc_collate_cp;
} else if(lcid[MSVCRT_LC_COLLATE] && (category==MSVCRT_LC_ALL || category==MSVCRT_LC_COLLATE)) {
if(!update_threadlocinfo_category(lcid[MSVCRT_LC_COLLATE],
cp[MSVCRT_LC_COLLATE], locinfo, MSVCRT_LC_COLLATE)) {
--
2.24.0
Jan. 31, 2020
[PATCH v2 4/8] msvcrt: Share lconv data between threadlocinfo instances.
by Chip Davis
Signed-off-by: Chip Davis <cdavis(a)codeweavers.com>
---
v2: Keep the locale tests passing.
---
dlls/msvcrt/locale.c | 432 +++++++++++++++++++++++++------------------
1 file changed, 251 insertions(+), 181 deletions(-)
diff --git a/dlls/msvcrt/locale.c b/dlls/msvcrt/locale.c
index e43673c1fa40..747beadc365b 100644
--- a/dlls/msvcrt/locale.c
+++ b/dlls/msvcrt/locale.c
@@ -58,6 +58,21 @@ BOOL initial_locale = TRUE;
static char cloc_clmap[256];
static char cloc_cumap[256];
+#if _MSVCR_VER >= 100
+static const MSVCRT_wchar_t emptyW[] = {0};
+static const MSVCRT_wchar_t cloc_dec_point[] = {'.', 0};
+#endif
+static struct MSVCRT_lconv cloc_lconv =
+{
+ ".", "", "",
+ "", "", "", "", "", "", "", CHAR_MAX, CHAR_MAX, CHAR_MAX, CHAR_MAX, CHAR_MAX, CHAR_MAX, CHAR_MAX, CHAR_MAX
+#if _MSVCR_VER >= 100
+ ,
+ cloc_dec_point, emptyW,
+ emptyW, emptyW, emptyW, emptyW, emptyW, emptyW
+#endif
+};
+
static const MSVCRT_wchar_t sun[] = {'S','u','n',0};
static const MSVCRT_wchar_t mon[] = {'M','o','n',0};
static const MSVCRT_wchar_t tue[] = {'T','u','e',0};
@@ -850,6 +865,14 @@ int CDECL __lconv_init(void)
{
/* this is used to make chars unsigned */
charmax = 255;
+ cloc_lconv.int_frac_digits = charmax;
+ cloc_lconv.frac_digits = charmax;
+ cloc_lconv.p_cs_precedes = charmax;
+ cloc_lconv.p_sep_by_space = charmax;
+ cloc_lconv.n_cs_precedes = charmax;
+ cloc_lconv.n_sep_by_space = charmax;
+ cloc_lconv.p_sign_posn = charmax;
+ cloc_lconv.n_sign_posn = charmax;
return 0;
}
@@ -910,31 +933,42 @@ void free_locinfo(MSVCRT_pthreadlocinfo locinfo)
}
if(locinfo->lconv) {
- MSVCRT_free(locinfo->lconv->decimal_point);
- MSVCRT_free(locinfo->lconv->thousands_sep);
- MSVCRT_free(locinfo->lconv->grouping);
- MSVCRT_free(locinfo->lconv->int_curr_symbol);
- MSVCRT_free(locinfo->lconv->currency_symbol);
- MSVCRT_free(locinfo->lconv->mon_decimal_point);
- MSVCRT_free(locinfo->lconv->mon_thousands_sep);
- MSVCRT_free(locinfo->lconv->mon_grouping);
- MSVCRT_free(locinfo->lconv->positive_sign);
- MSVCRT_free(locinfo->lconv->negative_sign);
+ if(locinfo->lconv_num_refcount
+ && !InterlockedDecrement(locinfo->lconv_num_refcount)) {
+ MSVCRT_free(locinfo->lconv->decimal_point);
+ MSVCRT_free(locinfo->lconv->thousands_sep);
+ MSVCRT_free(locinfo->lconv->grouping);
+#if _MSVCR_VER >= 100
+ MSVCRT_free(locinfo->lconv->_W_decimal_point);
+ MSVCRT_free(locinfo->lconv->_W_thousands_sep);
+#endif
+ MSVCRT_free(locinfo->lconv_num_refcount);
+ }
+ if(locinfo->lconv_mon_refcount
+ && !InterlockedDecrement(locinfo->lconv_mon_refcount)) {
+ MSVCRT_free(locinfo->lconv->int_curr_symbol);
+ MSVCRT_free(locinfo->lconv->currency_symbol);
+ MSVCRT_free(locinfo->lconv->mon_decimal_point);
+ MSVCRT_free(locinfo->lconv->mon_thousands_sep);
+ MSVCRT_free(locinfo->lconv->mon_grouping);
+ MSVCRT_free(locinfo->lconv->positive_sign);
+ MSVCRT_free(locinfo->lconv->negative_sign);
#if _MSVCR_VER >= 100
- MSVCRT_free(locinfo->lconv->_W_decimal_point);
- MSVCRT_free(locinfo->lconv->_W_thousands_sep);
- MSVCRT_free(locinfo->lconv->_W_int_curr_symbol);
- MSVCRT_free(locinfo->lconv->_W_currency_symbol);
- MSVCRT_free(locinfo->lconv->_W_mon_decimal_point);
- MSVCRT_free(locinfo->lconv->_W_mon_thousands_sep);
- MSVCRT_free(locinfo->lconv->_W_positive_sign);
- MSVCRT_free(locinfo->lconv->_W_negative_sign);
+ MSVCRT_free(locinfo->lconv->_W_int_curr_symbol);
+ MSVCRT_free(locinfo->lconv->_W_currency_symbol);
+ MSVCRT_free(locinfo->lconv->_W_mon_decimal_point);
+ MSVCRT_free(locinfo->lconv->_W_mon_thousands_sep);
+ MSVCRT_free(locinfo->lconv->_W_positive_sign);
+ MSVCRT_free(locinfo->lconv->_W_negative_sign);
#endif
+ MSVCRT_free(locinfo->lconv_mon_refcount);
+ }
+ if(locinfo->lconv_intl_refcount
+ && !InterlockedDecrement(locinfo->lconv_intl_refcount)) {
+ MSVCRT_free(locinfo->lconv_intl_refcount);
+ MSVCRT_free(locinfo->lconv);
+ }
}
- MSVCRT_free(locinfo->lconv_intl_refcount);
- MSVCRT_free(locinfo->lconv_num_refcount);
- MSVCRT_free(locinfo->lconv_mon_refcount);
- MSVCRT_free(locinfo->lconv);
if(locinfo->ctype1_refcount
&& !InterlockedDecrement(locinfo->ctype1_refcount)) {
@@ -1201,13 +1235,6 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category,
memset(locinfo, 0, sizeof(MSVCRT_threadlocinfo));
locinfo->refcount = 1;
- locinfo->lconv = MSVCRT_malloc(sizeof(struct MSVCRT_lconv));
- if(!locinfo->lconv) {
- free_locinfo(locinfo);
- return NULL;
- }
- memset(locinfo->lconv, 0, sizeof(struct MSVCRT_lconv));
-
if(locale_name[MSVCRT_LC_COLLATE] &&
!init_category_name(locale_name[MSVCRT_LC_COLLATE],
locale_len[MSVCRT_LC_COLLATE], locinfo, MSVCRT_LC_COLLATE)) {
@@ -1342,6 +1369,38 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category,
locinfo->pcumap = cloc_cumap;
}
+ if(!category_needs_update(MSVCRT_LC_MONETARY, category, old_locinfo,
+ lcid[MSVCRT_LC_MONETARY], cp[MSVCRT_LC_MONETARY])
+ && !category_needs_update(MSVCRT_LC_NUMERIC, category, old_locinfo,
+ lcid[MSVCRT_LC_NUMERIC], cp[MSVCRT_LC_NUMERIC])) {
+ locinfo->lconv = old_locinfo->lconv;
+ locinfo->lconv_intl_refcount = old_locinfo->lconv_intl_refcount;
+ if(locinfo->lconv_intl_refcount)
+ InterlockedIncrement(locinfo->lconv_intl_refcount);
+ } else if((lcid[MSVCRT_LC_MONETARY] && (category==MSVCRT_LC_ALL || category==MSVCRT_LC_MONETARY))
+ || (lcid[MSVCRT_LC_NUMERIC] && (category==MSVCRT_LC_ALL || category==MSVCRT_LC_NUMERIC))
+ || (!category_needs_update(MSVCRT_LC_MONETARY, category, old_locinfo,
+ lcid[MSVCRT_LC_MONETARY], cp[MSVCRT_LC_MONETARY])
+ && old_locinfo->lc_handle[MSVCRT_LC_MONETARY])
+ || (!category_needs_update(MSVCRT_LC_NUMERIC, category, old_locinfo,
+ lcid[MSVCRT_LC_NUMERIC], cp[MSVCRT_LC_NUMERIC])
+ && old_locinfo->lc_handle[MSVCRT_LC_NUMERIC])) {
+ locinfo->lconv = MSVCRT_malloc(sizeof(struct MSVCRT_lconv));
+ locinfo->lconv_intl_refcount = MSVCRT_malloc(sizeof(int));
+ if(!locinfo->lconv || !locinfo->lconv_intl_refcount) {
+ MSVCRT_free(locinfo->lconv);
+ MSVCRT_free(locinfo->lconv_intl_refcount);
+ locinfo->lconv = NULL;
+ locinfo->lconv_intl_refcount = NULL;
+ free_locinfo(locinfo);
+ return NULL;
+ }
+ memset(locinfo->lconv, 0, sizeof(struct MSVCRT_lconv));
+ *locinfo->lconv_intl_refcount = 1;
+ } else {
+ locinfo->lconv = &cloc_lconv;
+ }
+
if(locale_name[MSVCRT_LC_MONETARY] &&
!init_category_name(locale_name[MSVCRT_LC_MONETARY],
locale_len[MSVCRT_LC_MONETARY], locinfo, MSVCRT_LC_MONETARY)) {
@@ -1356,6 +1415,35 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category,
free_locinfo(locinfo);
return NULL;
}
+ locinfo->lconv_mon_refcount = old_locinfo->lconv_mon_refcount;
+ if(locinfo->lconv_mon_refcount)
+ InterlockedIncrement(locinfo->lconv_mon_refcount);
+ if(category_needs_update(MSVCRT_LC_NUMERIC, category, old_locinfo,
+ lcid[MSVCRT_LC_NUMERIC], cp[MSVCRT_LC_NUMERIC])) {
+ locinfo->lconv->int_curr_symbol = old_locinfo->lconv->int_curr_symbol;
+ locinfo->lconv->currency_symbol = old_locinfo->lconv->currency_symbol;
+ locinfo->lconv->mon_decimal_point = old_locinfo->lconv->mon_decimal_point;
+ locinfo->lconv->mon_thousands_sep = old_locinfo->lconv->mon_thousands_sep;
+ locinfo->lconv->mon_grouping = old_locinfo->lconv->mon_grouping;
+ locinfo->lconv->positive_sign = old_locinfo->lconv->positive_sign;
+ locinfo->lconv->negative_sign = old_locinfo->lconv->negative_sign;
+ locinfo->lconv->int_frac_digits = old_locinfo->lconv->int_frac_digits;
+ locinfo->lconv->frac_digits = old_locinfo->lconv->frac_digits;
+ locinfo->lconv->p_cs_precedes = old_locinfo->lconv->p_cs_precedes;
+ locinfo->lconv->p_sep_by_space = old_locinfo->lconv->p_sep_by_space;
+ locinfo->lconv->n_cs_precedes = old_locinfo->lconv->n_cs_precedes;
+ locinfo->lconv->n_sep_by_space = old_locinfo->lconv->n_sep_by_space;
+ locinfo->lconv->p_sign_posn = old_locinfo->lconv->p_sign_posn;
+ locinfo->lconv->n_sign_posn = old_locinfo->lconv->n_sign_posn;
+#if _MSVCR_VER >= 100
+ locinfo->lconv->_W_int_curr_symbol = old_locinfo->lconv->_W_int_curr_symbol;
+ locinfo->lconv->_W_currency_symbol = old_locinfo->lconv->_W_currency_symbol;
+ locinfo->lconv->_W_mon_decimal_point = old_locinfo->lconv->_W_mon_decimal_point;
+ locinfo->lconv->_W_mon_thousands_sep = old_locinfo->lconv->_W_mon_thousands_sep;
+ locinfo->lconv->_W_positive_sign = old_locinfo->lconv->_W_positive_sign;
+ locinfo->lconv->_W_negative_sign = old_locinfo->lconv->_W_negative_sign;
+#endif
+ }
} else if(lcid[MSVCRT_LC_MONETARY] && (category==MSVCRT_LC_ALL || category==MSVCRT_LC_MONETARY)) {
if(!update_threadlocinfo_category(lcid[MSVCRT_LC_MONETARY],
cp[MSVCRT_LC_MONETARY], locinfo, MSVCRT_LC_MONETARY)) {
@@ -1363,14 +1451,12 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category,
return NULL;
}
- locinfo->lconv_intl_refcount = MSVCRT_malloc(sizeof(int));
locinfo->lconv_mon_refcount = MSVCRT_malloc(sizeof(int));
- if(!locinfo->lconv_intl_refcount || !locinfo->lconv_mon_refcount) {
+ if(!locinfo->lconv_mon_refcount) {
free_locinfo(locinfo);
return NULL;
}
- *locinfo->lconv_intl_refcount = 1;
*locinfo->lconv_mon_refcount = 1;
i = GetLocaleInfoA(lcid[MSVCRT_LC_MONETARY], LOCALE_SINTLSYMBOL
@@ -1567,60 +1653,33 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category,
return NULL;
}
} else {
- locinfo->lconv->int_curr_symbol = MSVCRT_malloc(sizeof(char));
- locinfo->lconv->currency_symbol = MSVCRT_malloc(sizeof(char));
- locinfo->lconv->mon_decimal_point = MSVCRT_malloc(sizeof(char));
- locinfo->lconv->mon_thousands_sep = MSVCRT_malloc(sizeof(char));
- locinfo->lconv->mon_grouping = MSVCRT_malloc(sizeof(char));
- locinfo->lconv->positive_sign = MSVCRT_malloc(sizeof(char));
- locinfo->lconv->negative_sign = MSVCRT_malloc(sizeof(char));
-
- if(!locinfo->lconv->int_curr_symbol || !locinfo->lconv->currency_symbol
- || !locinfo->lconv->mon_decimal_point || !locinfo->lconv->mon_thousands_sep
- || !locinfo->lconv->mon_grouping || !locinfo->lconv->positive_sign
- || !locinfo->lconv->negative_sign) {
- free_locinfo(locinfo);
- return NULL;
- }
-
- locinfo->lconv->int_curr_symbol[0] = '\0';
- locinfo->lconv->currency_symbol[0] = '\0';
- locinfo->lconv->mon_decimal_point[0] = '\0';
- locinfo->lconv->mon_thousands_sep[0] = '\0';
- locinfo->lconv->mon_grouping[0] = '\0';
- locinfo->lconv->positive_sign[0] = '\0';
- locinfo->lconv->negative_sign[0] = '\0';
- locinfo->lconv->int_frac_digits = charmax;
- locinfo->lconv->frac_digits = charmax;
- locinfo->lconv->p_cs_precedes = charmax;
- locinfo->lconv->p_sep_by_space = charmax;
- locinfo->lconv->n_cs_precedes = charmax;
- locinfo->lconv->n_sep_by_space = charmax;
- locinfo->lconv->p_sign_posn = charmax;
- locinfo->lconv->n_sign_posn = charmax;
+ if(!category_needs_update(MSVCRT_LC_NUMERIC, category, old_locinfo,
+ lcid[MSVCRT_LC_NUMERIC], cp[MSVCRT_LC_NUMERIC])) {
+ locinfo->lconv->int_curr_symbol = "";
+ locinfo->lconv->currency_symbol = "";
+ locinfo->lconv->mon_decimal_point = "";
+ locinfo->lconv->mon_thousands_sep = "";
+ locinfo->lconv->mon_grouping = "";
+ locinfo->lconv->positive_sign = "";
+ locinfo->lconv->negative_sign = "";
+ locinfo->lconv->int_frac_digits = charmax;
+ locinfo->lconv->frac_digits = charmax;
+ locinfo->lconv->p_cs_precedes = charmax;
+ locinfo->lconv->p_sep_by_space = charmax;
+ locinfo->lconv->n_cs_precedes = charmax;
+ locinfo->lconv->n_sep_by_space = charmax;
+ locinfo->lconv->p_sign_posn = charmax;
+ locinfo->lconv->n_sign_posn = charmax;
#if _MSVCR_VER >= 100
- locinfo->lconv->_W_int_curr_symbol = MSVCRT_malloc(sizeof(MSVCRT_wchar_t));
- locinfo->lconv->_W_currency_symbol = MSVCRT_malloc(sizeof(MSVCRT_wchar_t));
- locinfo->lconv->_W_mon_decimal_point = MSVCRT_malloc(sizeof(MSVCRT_wchar_t));
- locinfo->lconv->_W_mon_thousands_sep = MSVCRT_malloc(sizeof(MSVCRT_wchar_t));
- locinfo->lconv->_W_positive_sign = MSVCRT_malloc(sizeof(MSVCRT_wchar_t));
- locinfo->lconv->_W_negative_sign = MSVCRT_malloc(sizeof(MSVCRT_wchar_t));
-
- if(!locinfo->lconv->_W_int_curr_symbol || !locinfo->lconv->_W_currency_symbol
- || !locinfo->lconv->_W_mon_decimal_point || !locinfo->lconv->_W_mon_thousands_sep
- || !locinfo->lconv->positive_sign || !locinfo->lconv->negative_sign) {
- free_locinfo(locinfo);
- return NULL;
- }
-
- locinfo->lconv->_W_int_curr_symbol[0] = '\0';
- locinfo->lconv->_W_currency_symbol[0] = '\0';
- locinfo->lconv->_W_mon_decimal_point[0] = '\0';
- locinfo->lconv->_W_mon_thousands_sep[0] = '\0';
- locinfo->lconv->_W_positive_sign[0] = '\0';
- locinfo->lconv->_W_negative_sign[0] = '\0';
+ locinfo->lconv->_W_int_curr_symbol = emptyW;
+ locinfo->lconv->_W_currency_symbol = emptyW;
+ locinfo->lconv->_W_mon_decimal_point = emptyW;
+ locinfo->lconv->_W_mon_thousands_sep = emptyW;
+ locinfo->lconv->_W_positive_sign = emptyW;
+ locinfo->lconv->_W_negative_sign = emptyW;
#endif
+ }
if(!init_category_name("C", 1, locinfo, MSVCRT_LC_MONETARY)) {
free_locinfo(locinfo);
@@ -1642,6 +1701,19 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category,
free_locinfo(locinfo);
return NULL;
}
+ locinfo->lconv_num_refcount = old_locinfo->lconv_num_refcount;
+ if(locinfo->lconv_num_refcount)
+ InterlockedIncrement(locinfo->lconv_num_refcount);
+ if(category_needs_update(MSVCRT_LC_MONETARY, category, old_locinfo,
+ lcid[MSVCRT_LC_MONETARY], cp[MSVCRT_LC_MONETARY])) {
+ locinfo->lconv->decimal_point = old_locinfo->lconv->decimal_point;
+ locinfo->lconv->thousands_sep = old_locinfo->lconv->thousands_sep;
+ locinfo->lconv->grouping = old_locinfo->lconv->grouping;
+#if _MSVCR_VER >= 100
+ locinfo->lconv->_W_decimal_point = old_locinfo->lconv->_W_decimal_point;
+ locinfo->lconv->_W_thousands_sep = old_locinfo->lconv->_W_thousands_sep;
+#endif
+ }
} else if(lcid[MSVCRT_LC_NUMERIC] && (category==MSVCRT_LC_ALL || category==MSVCRT_LC_NUMERIC)) {
if(!update_threadlocinfo_category(lcid[MSVCRT_LC_NUMERIC],
cp[MSVCRT_LC_NUMERIC], locinfo, MSVCRT_LC_NUMERIC)) {
@@ -1649,15 +1721,12 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category,
return NULL;
}
- if(!locinfo->lconv_intl_refcount)
- locinfo->lconv_intl_refcount = MSVCRT_malloc(sizeof(int));
locinfo->lconv_num_refcount = MSVCRT_malloc(sizeof(int));
- if(!locinfo->lconv_intl_refcount || !locinfo->lconv_num_refcount) {
+ if(!locinfo->lconv_num_refcount) {
free_locinfo(locinfo);
return NULL;
}
- *locinfo->lconv_intl_refcount = 1;
*locinfo->lconv_num_refcount = 1;
i = GetLocaleInfoA(lcid[MSVCRT_LC_NUMERIC], LOCALE_SDECIMAL
@@ -1718,33 +1787,17 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category,
return NULL;
}
} else {
- locinfo->lconv->decimal_point = MSVCRT_malloc(sizeof(char[2]));
- locinfo->lconv->thousands_sep = MSVCRT_malloc(sizeof(char));
- locinfo->lconv->grouping = MSVCRT_malloc(sizeof(char));
- if(!locinfo->lconv->decimal_point || !locinfo->lconv->thousands_sep
- || !locinfo->lconv->grouping) {
- free_locinfo(locinfo);
- return NULL;
- }
-
- locinfo->lconv->decimal_point[0] = '.';
- locinfo->lconv->decimal_point[1] = '\0';
- locinfo->lconv->thousands_sep[0] = '\0';
- locinfo->lconv->grouping[0] = '\0';
+ if(!category_needs_update(MSVCRT_LC_MONETARY, category, old_locinfo,
+ lcid[MSVCRT_LC_MONETARY], cp[MSVCRT_LC_MONETARY])) {
+ locinfo->lconv->decimal_point = ".";
+ locinfo->lconv->thousands_sep = "";
+ locinfo->lconv->grouping = "";
#if _MSVCR_VER >= 100
- locinfo->lconv->_W_decimal_point = MSVCRT_malloc(sizeof(MSVCRT_wchar_t[2]));
- locinfo->lconv->_W_thousands_sep = MSVCRT_malloc(sizeof(MSVCRT_wchar_t));
-
- if(!locinfo->lconv->_W_decimal_point || !locinfo->lconv->_W_thousands_sep) {
- free_locinfo(locinfo);
- return NULL;
- }
-
- locinfo->lconv->_W_decimal_point[0] = '.';
- locinfo->lconv->_W_decimal_point[1] = '\0';
- locinfo->lconv->_W_thousands_sep[0] = '\0';
+ locinfo->lconv->_W_decimal_point = cloc_dec_point;
+ locinfo->lconv->_W_thousands_sep = emptyW;
#endif
+ }
if (!init_category_name("C", 1, locinfo, MSVCRT_LC_NUMERIC)) {
free_locinfo(locinfo);
@@ -1946,95 +1999,112 @@ char* CDECL MSVCRT_setlocale(int category, const char* locale)
(void**)&newlocinfo->lc_category[MSVCRT_LC_CTYPE].refcount);
}
- if(locinfo->lc_handle[MSVCRT_LC_MONETARY]!=newlocinfo->lc_handle[MSVCRT_LC_MONETARY]
- || locinfo->lc_id[MSVCRT_LC_MONETARY].wCodePage!=newlocinfo->lc_id[MSVCRT_LC_MONETARY].wCodePage) {
+ if(newlocinfo->lc_category[MSVCRT_LC_MONETARY].locale) {
+ swap_pointers((void**)&locinfo->lc_category[MSVCRT_LC_MONETARY].locale,
+ (void**)&newlocinfo->lc_category[MSVCRT_LC_MONETARY].locale);
+ swap_pointers((void**)&locinfo->lc_category[MSVCRT_LC_MONETARY].refcount,
+ (void**)&newlocinfo->lc_category[MSVCRT_LC_MONETARY].refcount);
+ }
+
+ if(newlocinfo->lc_category[MSVCRT_LC_NUMERIC].locale) {
+ swap_pointers((void**)&locinfo->lc_category[MSVCRT_LC_NUMERIC].locale,
+ (void**)&newlocinfo->lc_category[MSVCRT_LC_NUMERIC].locale);
+ swap_pointers((void**)&locinfo->lc_category[MSVCRT_LC_NUMERIC].refcount,
+ (void**)&newlocinfo->lc_category[MSVCRT_LC_NUMERIC].refcount);
+ }
+
+ if((locinfo->lc_handle[MSVCRT_LC_MONETARY]!=newlocinfo->lc_handle[MSVCRT_LC_MONETARY]
+ || locinfo->lc_id[MSVCRT_LC_MONETARY].wCodePage!=newlocinfo->lc_id[MSVCRT_LC_MONETARY].wCodePage)
+ && (locinfo->lc_handle[MSVCRT_LC_NUMERIC]!=newlocinfo->lc_handle[MSVCRT_LC_NUMERIC]
+ || locinfo->lc_id[MSVCRT_LC_NUMERIC].wCodePage!=newlocinfo->lc_id[MSVCRT_LC_NUMERIC].wCodePage)) {
locinfo->lc_handle[MSVCRT_LC_MONETARY] =
newlocinfo->lc_handle[MSVCRT_LC_MONETARY];
locinfo->lc_id[MSVCRT_LC_MONETARY] =
newlocinfo->lc_id[MSVCRT_LC_MONETARY];
-
- swap_pointers((void**)&locinfo->lconv->int_curr_symbol,
- (void**)&newlocinfo->lconv->int_curr_symbol);
- swap_pointers((void**)&locinfo->lconv->currency_symbol,
- (void**)&newlocinfo->lconv->currency_symbol);
- swap_pointers((void**)&locinfo->lconv->mon_decimal_point,
- (void**)&newlocinfo->lconv->mon_decimal_point);
- swap_pointers((void**)&locinfo->lconv->mon_thousands_sep,
- (void**)&newlocinfo->lconv->mon_thousands_sep);
- swap_pointers((void**)&locinfo->lconv->mon_grouping,
- (void**)&newlocinfo->lconv->mon_grouping);
- swap_pointers((void**)&locinfo->lconv->positive_sign,
- (void**)&newlocinfo->lconv->positive_sign);
- swap_pointers((void**)&locinfo->lconv->negative_sign,
- (void**)&newlocinfo->lconv->negative_sign);
+ locinfo->lc_handle[MSVCRT_LC_NUMERIC] =
+ newlocinfo->lc_handle[MSVCRT_LC_NUMERIC];
+ locinfo->lc_id[MSVCRT_LC_NUMERIC] =
+ newlocinfo->lc_id[MSVCRT_LC_NUMERIC];
+ swap_pointers((void**)&locinfo->lconv, (void**)&newlocinfo->lconv);
+ } else {
+ if(locinfo->lc_handle[MSVCRT_LC_MONETARY]!=newlocinfo->lc_handle[MSVCRT_LC_MONETARY]
+ || locinfo->lc_id[MSVCRT_LC_MONETARY].wCodePage!=newlocinfo->lc_id[MSVCRT_LC_MONETARY].wCodePage) {
+ locinfo->lc_handle[MSVCRT_LC_MONETARY] =
+ newlocinfo->lc_handle[MSVCRT_LC_MONETARY];
+ locinfo->lc_id[MSVCRT_LC_MONETARY] =
+ newlocinfo->lc_id[MSVCRT_LC_MONETARY];
+
+ swap_pointers((void**)&locinfo->lconv->int_curr_symbol,
+ (void**)&newlocinfo->lconv->int_curr_symbol);
+ swap_pointers((void**)&locinfo->lconv->currency_symbol,
+ (void**)&newlocinfo->lconv->currency_symbol);
+ swap_pointers((void**)&locinfo->lconv->mon_decimal_point,
+ (void**)&newlocinfo->lconv->mon_decimal_point);
+ swap_pointers((void**)&locinfo->lconv->mon_thousands_sep,
+ (void**)&newlocinfo->lconv->mon_thousands_sep);
+ swap_pointers((void**)&locinfo->lconv->mon_grouping,
+ (void**)&newlocinfo->lconv->mon_grouping);
+ swap_pointers((void**)&locinfo->lconv->positive_sign,
+ (void**)&newlocinfo->lconv->positive_sign);
+ swap_pointers((void**)&locinfo->lconv->negative_sign,
+ (void**)&newlocinfo->lconv->negative_sign);
#if _MSVCR_VER >= 100
- swap_pointers((void**)&locinfo->lconv->_W_int_curr_symbol,
- (void**)&newlocinfo->lconv->_W_int_curr_symbol);
- swap_pointers((void**)&locinfo->lconv->_W_currency_symbol,
- (void**)&newlocinfo->lconv->_W_currency_symbol);
- swap_pointers((void**)&locinfo->lconv->_W_mon_decimal_point,
- (void**)&newlocinfo->lconv->_W_mon_decimal_point);
- swap_pointers((void**)&locinfo->lconv->_W_mon_thousands_sep,
- (void**)&newlocinfo->lconv->_W_mon_thousands_sep);
- swap_pointers((void**)&locinfo->lconv->_W_positive_sign,
- (void**)&newlocinfo->lconv->_W_positive_sign);
- swap_pointers((void**)&locinfo->lconv->_W_negative_sign,
- (void**)&newlocinfo->lconv->_W_negative_sign);
+ swap_pointers((void**)&locinfo->lconv->_W_int_curr_symbol,
+ (void**)&newlocinfo->lconv->_W_int_curr_symbol);
+ swap_pointers((void**)&locinfo->lconv->_W_currency_symbol,
+ (void**)&newlocinfo->lconv->_W_currency_symbol);
+ swap_pointers((void**)&locinfo->lconv->_W_mon_decimal_point,
+ (void**)&newlocinfo->lconv->_W_mon_decimal_point);
+ swap_pointers((void**)&locinfo->lconv->_W_mon_thousands_sep,
+ (void**)&newlocinfo->lconv->_W_mon_thousands_sep);
+ swap_pointers((void**)&locinfo->lconv->_W_positive_sign,
+ (void**)&newlocinfo->lconv->_W_positive_sign);
+ swap_pointers((void**)&locinfo->lconv->_W_negative_sign,
+ (void**)&newlocinfo->lconv->_W_negative_sign);
#endif
- locinfo->lconv->int_frac_digits = newlocinfo->lconv->int_frac_digits;
- locinfo->lconv->frac_digits = newlocinfo->lconv->frac_digits;
- locinfo->lconv->p_cs_precedes = newlocinfo->lconv->p_cs_precedes;
- locinfo->lconv->p_sep_by_space = newlocinfo->lconv->p_sep_by_space;
- locinfo->lconv->n_cs_precedes = newlocinfo->lconv->n_cs_precedes;
- locinfo->lconv->n_sep_by_space = newlocinfo->lconv->n_sep_by_space;
- locinfo->lconv->p_sign_posn = newlocinfo->lconv->p_sign_posn;
- locinfo->lconv->n_sign_posn = newlocinfo->lconv->n_sign_posn;
+ locinfo->lconv->int_frac_digits = newlocinfo->lconv->int_frac_digits;
+ locinfo->lconv->frac_digits = newlocinfo->lconv->frac_digits;
+ locinfo->lconv->p_cs_precedes = newlocinfo->lconv->p_cs_precedes;
+ locinfo->lconv->p_sep_by_space = newlocinfo->lconv->p_sep_by_space;
+ locinfo->lconv->n_cs_precedes = newlocinfo->lconv->n_cs_precedes;
+ locinfo->lconv->n_sep_by_space = newlocinfo->lconv->n_sep_by_space;
+ locinfo->lconv->p_sign_posn = newlocinfo->lconv->p_sign_posn;
+ locinfo->lconv->n_sign_posn = newlocinfo->lconv->n_sign_posn;
#if _MSVCR_VER >= 110
- swap_pointers((void**)&locinfo->lc_name[MSVCRT_LC_MONETARY],
- (void**)&newlocinfo->lc_name[MSVCRT_LC_MONETARY]);
+ swap_pointers((void**)&locinfo->lc_name[MSVCRT_LC_MONETARY],
+ (void**)&newlocinfo->lc_name[MSVCRT_LC_MONETARY]);
#endif
- }
- if(newlocinfo->lc_category[MSVCRT_LC_MONETARY].locale) {
- swap_pointers((void**)&locinfo->lc_category[MSVCRT_LC_MONETARY].locale,
- (void**)&newlocinfo->lc_category[MSVCRT_LC_MONETARY].locale);
- swap_pointers((void**)&locinfo->lc_category[MSVCRT_LC_MONETARY].refcount,
- (void**)&newlocinfo->lc_category[MSVCRT_LC_MONETARY].refcount);
- }
+ }
- if(locinfo->lc_handle[MSVCRT_LC_NUMERIC]!=newlocinfo->lc_handle[MSVCRT_LC_NUMERIC]
- || locinfo->lc_id[MSVCRT_LC_NUMERIC].wCodePage!=newlocinfo->lc_id[MSVCRT_LC_NUMERIC].wCodePage) {
- locinfo->lc_handle[MSVCRT_LC_NUMERIC] =
- newlocinfo->lc_handle[MSVCRT_LC_NUMERIC];
- locinfo->lc_id[MSVCRT_LC_NUMERIC] =
- newlocinfo->lc_id[MSVCRT_LC_NUMERIC];
+ if(locinfo->lc_handle[MSVCRT_LC_NUMERIC]!=newlocinfo->lc_handle[MSVCRT_LC_NUMERIC]
+ || locinfo->lc_id[MSVCRT_LC_NUMERIC].wCodePage!=newlocinfo->lc_id[MSVCRT_LC_NUMERIC].wCodePage) {
+ locinfo->lc_handle[MSVCRT_LC_NUMERIC] =
+ newlocinfo->lc_handle[MSVCRT_LC_NUMERIC];
+ locinfo->lc_id[MSVCRT_LC_NUMERIC] =
+ newlocinfo->lc_id[MSVCRT_LC_NUMERIC];
- swap_pointers((void**)&locinfo->lconv->decimal_point,
- (void**)&newlocinfo->lconv->decimal_point);
- swap_pointers((void**)&locinfo->lconv->thousands_sep,
- (void**)&newlocinfo->lconv->thousands_sep);
- swap_pointers((void**)&locinfo->lconv->grouping,
- (void**)&newlocinfo->lconv->grouping);
+ swap_pointers((void**)&locinfo->lconv->decimal_point,
+ (void**)&newlocinfo->lconv->decimal_point);
+ swap_pointers((void**)&locinfo->lconv->thousands_sep,
+ (void**)&newlocinfo->lconv->thousands_sep);
+ swap_pointers((void**)&locinfo->lconv->grouping,
+ (void**)&newlocinfo->lconv->grouping);
#if _MSVCR_VER >= 100
- swap_pointers((void**)&locinfo->lconv->_W_decimal_point,
- (void**)&newlocinfo->lconv->_W_decimal_point);
- swap_pointers((void**)&locinfo->lconv->_W_thousands_sep,
- (void**)&newlocinfo->lconv->_W_thousands_sep);
+ swap_pointers((void**)&locinfo->lconv->_W_decimal_point,
+ (void**)&newlocinfo->lconv->_W_decimal_point);
+ swap_pointers((void**)&locinfo->lconv->_W_thousands_sep,
+ (void**)&newlocinfo->lconv->_W_thousands_sep);
#endif
#if _MSVCR_VER >= 110
- swap_pointers((void**)&locinfo->lc_name[MSVCRT_LC_NUMERIC],
- (void**)&newlocinfo->lc_name[MSVCRT_LC_NUMERIC]);
+ swap_pointers((void**)&locinfo->lc_name[MSVCRT_LC_NUMERIC],
+ (void**)&newlocinfo->lc_name[MSVCRT_LC_NUMERIC]);
#endif
- }
- if(newlocinfo->lc_category[MSVCRT_LC_NUMERIC].locale) {
- swap_pointers((void**)&locinfo->lc_category[MSVCRT_LC_NUMERIC].locale,
- (void**)&newlocinfo->lc_category[MSVCRT_LC_NUMERIC].locale);
- swap_pointers((void**)&locinfo->lc_category[MSVCRT_LC_NUMERIC].refcount,
- (void**)&newlocinfo->lc_category[MSVCRT_LC_NUMERIC].refcount);
+ }
}
if(locinfo->lc_handle[MSVCRT_LC_TIME]!=newlocinfo->lc_handle[MSVCRT_LC_TIME]
--
2.24.0
Jan. 31, 2020
[PATCH 3/8] msvcrt: Share ctype tables between threadlocinfo instances.
by Chip Davis
Signed-off-by: Chip Davis <cdavis(a)codeweavers.com>
---
dlls/msvcr90/tests/msvcr90.c | 16 +++++-----
dlls/msvcrt/locale.c | 59 +++++++++++++++++++++---------------
2 files changed, 42 insertions(+), 33 deletions(-)
diff --git a/dlls/msvcr90/tests/msvcr90.c b/dlls/msvcr90/tests/msvcr90.c
index b030c113853f..4e28cafea0d8 100644
--- a/dlls/msvcr90/tests/msvcr90.c
+++ b/dlls/msvcr90/tests/msvcr90.c
@@ -2114,10 +2114,10 @@ static void test__get_current_locale(void)
l->locinfo->lc_codepage, l2->locinfo->lc_codepage);
ok(l->locinfo->lc_clike != l2->locinfo->lc_clike, "same lc_clike values %d, %d\n",
l->locinfo->lc_clike, l2->locinfo->lc_clike);
+ ok(l->locinfo->lc_clike, "non-C locale is C-like\n");
}
- ok(l->locinfo->lc_clike, "non-C locale is C-like\n");
+ ok(!l2->locinfo->lc_clike, "C locale is not C-like\n");
todo_wine {
- ok(!l2->locinfo->lc_clike, "C locale is not C-like\n");
ok(l->locinfo->ctype1 != l2->locinfo->ctype1, "same ctype1 pointers\n");
ok(l->locinfo->pclmap != l2->locinfo->pclmap, "same clmap pointers\n");
ok(l->locinfo->pcumap != l2->locinfo->pcumap, "same cumap pointers\n");
@@ -2189,10 +2189,10 @@ static void test__get_current_locale(void)
l->locinfo->lc_codepage, l2->locinfo->lc_codepage);
ok(l->locinfo->lc_clike != l2->locinfo->lc_clike, "same lc_clike values %d, %d\n",
l->locinfo->lc_clike, l2->locinfo->lc_clike);
+ ok(l->locinfo->lc_clike, "non-C locale is C-like\n");
}
- ok(l->locinfo->lc_clike, "non-C locale is C-like\n");
+ ok(!l2->locinfo->lc_clike, "C locale is not C-like\n");
todo_wine {
- ok(!l2->locinfo->lc_clike, "C locale is not C-like\n");
ok(l->locinfo->ctype1 != l2->locinfo->ctype1, "same ctype1 pointers\n");
ok(l->locinfo->pclmap != l2->locinfo->pclmap, "same clmap pointers\n");
ok(l->locinfo->pcumap != l2->locinfo->pcumap, "same cumap pointers\n");
@@ -2270,10 +2270,10 @@ static void test__get_current_locale(void)
l->locinfo->lc_codepage, l2->locinfo->lc_codepage);
ok(l->locinfo->lc_clike != l2->locinfo->lc_clike, "same lc_clike values %d, %d\n",
l->locinfo->lc_clike, l2->locinfo->lc_clike);
+ ok(l->locinfo->lc_clike, "non-C locale is C-like\n");
}
- ok(l->locinfo->lc_clike, "non-C locale is C-like\n");
+ ok(!l2->locinfo->lc_clike, "C locale is not C-like\n");
todo_wine {
- ok(!l2->locinfo->lc_clike, "C locale is not C-like\n");
ok(l->locinfo->ctype1 != l2->locinfo->ctype1, "same ctype1 pointers\n");
ok(l->locinfo->pclmap != l2->locinfo->pclmap, "same clmap pointers\n");
ok(l->locinfo->pcumap != l2->locinfo->pcumap, "same cumap pointers\n");
@@ -2346,10 +2346,10 @@ static void test__get_current_locale(void)
l->locinfo->lc_codepage, l2->locinfo->lc_codepage);
ok(l->locinfo->lc_clike != l2->locinfo->lc_clike, "same lc_clike values %d, %d\n",
l->locinfo->lc_clike, l2->locinfo->lc_clike);
+ ok(l->locinfo->lc_clike, "non-C locale is C-like\n");
}
- ok(l->locinfo->lc_clike, "non-C locale is C-like\n");
+ ok(!l2->locinfo->lc_clike, "C locale is not C-like\n");
todo_wine {
- ok(!l2->locinfo->lc_clike, "C locale is not C-like\n");
ok(l->locinfo->ctype1 != l2->locinfo->ctype1, "same ctype1 pointers\n");
ok(l->locinfo->pclmap != l2->locinfo->pclmap, "same clmap pointers\n");
ok(l->locinfo->pcumap != l2->locinfo->pcumap, "same cumap pointers\n");
diff --git a/dlls/msvcrt/locale.c b/dlls/msvcrt/locale.c
index df19326586bf..e43673c1fa40 100644
--- a/dlls/msvcrt/locale.c
+++ b/dlls/msvcrt/locale.c
@@ -55,6 +55,9 @@ BOOL initial_locale = TRUE;
#define MSVCRT_LEADBYTE 0x8000
#define MSVCRT_C1_DEFINED 0x200
+static char cloc_clmap[256];
+static char cloc_cumap[256];
+
static const MSVCRT_wchar_t sun[] = {'S','u','n',0};
static const MSVCRT_wchar_t mon[] = {'M','o','n',0};
static const MSVCRT_wchar_t tue[] = {'T','u','e',0};
@@ -163,6 +166,15 @@ static const char * const _country_synonyms[] =
"spanish-modern", "esn"
};
+static BOOL WINAPI init_cloc_casemap(PINIT_ONCE once, void *param, void **context)
+{
+ int i;
+ for(i=0; i<256; i++) {
+ cloc_clmap[i] = (i>='A' && i<='Z' ? i-'A'+'a' : i);
+ cloc_cumap[i] = (i>='a' && i<='z' ? i-'a'+'A' : i);
+ }
+}
+
/* INTERNAL: Map a synonym to an ISO code */
static void remap_synonym(char *name)
{
@@ -924,11 +936,11 @@ void free_locinfo(MSVCRT_pthreadlocinfo locinfo)
MSVCRT_free(locinfo->lconv_mon_refcount);
MSVCRT_free(locinfo->lconv);
- MSVCRT_free(locinfo->ctype1_refcount);
- MSVCRT_free(locinfo->ctype1);
-
- MSVCRT_free(locinfo->pclmap);
- MSVCRT_free(locinfo->pcumap);
+ if(locinfo->ctype1_refcount
+ && !InterlockedDecrement(locinfo->ctype1_refcount)) {
+ MSVCRT_free(locinfo->ctype1_refcount);
+ MSVCRT_free(locinfo->ctype1);
+ }
if(locinfo->lc_time_curr != &cloc_time_data)
MSVCRT_free(locinfo->lc_time_curr);
@@ -1196,13 +1208,6 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category,
}
memset(locinfo->lconv, 0, sizeof(struct MSVCRT_lconv));
- locinfo->pclmap = MSVCRT_malloc(sizeof(char[256]));
- locinfo->pcumap = MSVCRT_malloc(sizeof(char[256]));
- if(!locinfo->pclmap || !locinfo->pcumap) {
- free_locinfo(locinfo);
- return NULL;
- }
-
if(locale_name[MSVCRT_LC_COLLATE] &&
!init_category_name(locale_name[MSVCRT_LC_COLLATE],
locale_len[MSVCRT_LC_COLLATE], locinfo, MSVCRT_LC_COLLATE)) {
@@ -1251,6 +1256,16 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category,
free_locinfo(locinfo);
return NULL;
}
+ locinfo->lc_codepage = old_locinfo->lc_codepage;
+ locinfo->lc_clike = old_locinfo->lc_clike;
+ locinfo->mb_cur_max = old_locinfo->mb_cur_max;
+ locinfo->ctype1 = old_locinfo->ctype1;
+ locinfo->ctype1_refcount = old_locinfo->ctype1_refcount;
+ locinfo->pctype = old_locinfo->pctype;
+ locinfo->pclmap = old_locinfo->pclmap;
+ locinfo->pcumap = old_locinfo->pcumap;
+ if(locinfo->ctype1_refcount)
+ InterlockedIncrement(locinfo->ctype1_refcount);
} else if(lcid[MSVCRT_LC_CTYPE] && (category==MSVCRT_LC_ALL || category==MSVCRT_LC_CTYPE)) {
CPINFO cp_info;
int j;
@@ -1271,7 +1286,9 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category,
locinfo->ctype1_refcount = MSVCRT_malloc(sizeof(int));
locinfo->ctype1 = MSVCRT_malloc(sizeof(short[257]));
- if(!locinfo->ctype1_refcount || !locinfo->ctype1) {
+ locinfo->pclmap = MSVCRT_malloc(sizeof(char[256]));
+ locinfo->pcumap = MSVCRT_malloc(sizeof(char[256]));
+ if(!locinfo->ctype1_refcount || !locinfo->ctype1 || !locinfo->pclmap || !locinfo->pcumap) {
free_locinfo(locinfo);
return NULL;
}
@@ -1312,7 +1329,7 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category,
LCMapStringA(lcid[MSVCRT_LC_CTYPE], LCMAP_UPPERCASE, buf, 256,
(char*)locinfo->pcumap, 256);
} else {
- locinfo->lc_clike = 1;
+ static INIT_ONCE once = INIT_ONCE_STATIC_INIT;
locinfo->mb_cur_max = 1;
locinfo->pctype = MSVCRT__ctype+1;
if(!init_category_name("C", 1, locinfo, MSVCRT_LC_CTYPE)) {
@@ -1320,17 +1337,9 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category,
return NULL;
}
- for(i=0; i<256; i++) {
- if(locinfo->pctype[i] & MSVCRT__LEADBYTE)
- buf[i] = ' ';
- else
- buf[i] = i;
- }
-
- for(i=0; i<256; i++) {
- locinfo->pclmap[i] = (i>='A' && i<='Z' ? i-'A'+'a' : i);
- locinfo->pcumap[i] = (i>='a' && i<='z' ? i-'a'+'A' : i);
- }
+ InitOnceExecuteOnce(&once, init_cloc_casemap, NULL, NULL);
+ locinfo->pclmap = cloc_clmap;
+ locinfo->pcumap = cloc_cumap;
}
if(locale_name[MSVCRT_LC_MONETARY] &&
--
2.24.0
Jan. 31, 2020
[PATCH v2 2/8] msvcrt: Share locale names between threadlocinfo instances.
by Chip Davis
Signed-off-by: Chip Davis <cdavis(a)codeweavers.com>
---
v2: Don't share VC11 locale names.
---
dlls/msvcr90/tests/msvcr90.c | 64 ++++++++++-------------------
dlls/msvcrt/locale.c | 79 ++++++++++++++++++++++++++++--------
2 files changed, 83 insertions(+), 60 deletions(-)
diff --git a/dlls/msvcr90/tests/msvcr90.c b/dlls/msvcr90/tests/msvcr90.c
index f8e68ed2f630..b030c113853f 100644
--- a/dlls/msvcr90/tests/msvcr90.c
+++ b/dlls/msvcr90/tests/msvcr90.c
@@ -2024,15 +2024,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(*l->locinfo->lc_category[LC_COLLATE].refcount == 1, "refcount = %d\n",
+ *l->locinfo->lc_category[LC_COLLATE].refcount);
+ todo_wine ok(*l2->locinfo->lc_category[LC_COLLATE].refcount == 2, "refcount = %d\n",
+ *l2->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);
@@ -2095,15 +2091,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(*l->locinfo->lc_category[i].refcount == 1, "refcount = %d for category %d\n",
+ *l->locinfo->lc_category[i].refcount, i);
+ todo_wine ok(*l2->locinfo->lc_category[i].refcount == 2, "refcount = %d for category %d\n",
+ *l2->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,
@@ -2174,15 +2166,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(*l->locinfo->lc_category[i].refcount == 1, "refcount = %d for category %d\n",
+ *l->locinfo->lc_category[i].refcount, i);
+ todo_wine ok(*l2->locinfo->lc_category[i].refcount == 2, "refcount = %d for category %d\n",
+ *l2->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,
@@ -2261,15 +2249,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(*l->locinfo->lc_category[i].refcount == 1, "refcount = %d for category %d\n",
+ *l->locinfo->lc_category[i].refcount, i);
+ todo_wine 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[LC_TIME].locale == l2->locinfo->lc_category[LC_TIME].locale,
"different locale name pointers for LC_TIME\n");
@@ -2341,21 +2325,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(*l->locinfo->lc_category[i].refcount == 1, "refcount = %d for category %d\n",
+ *l->locinfo->lc_category[i].refcount, i);
+ todo_wine ok(*l2->locinfo->lc_category[i].refcount == 2, "refcount = %d for category %d\n",
+ *l2->locinfo->lc_category[i].refcount, i);
}
todo_wine {
diff --git a/dlls/msvcrt/locale.c b/dlls/msvcrt/locale.c
index f6e7631b4f50..df19326586bf 100644
--- a/dlls/msvcrt/locale.c
+++ b/dlls/msvcrt/locale.c
@@ -418,6 +418,15 @@ static BOOL init_category_name(const char *name, int len,
return TRUE;
}
+/* INTERNAL: Copy lc_handle, lc_id, and lc_category from one threadlocinfo to another */
+static void copy_threadlocinfo_category(MSVCRT_pthreadlocinfo locinfo, MSVCRT_pthreadlocinfo old_locinfo, int category)
+{
+ locinfo->lc_handle[category] = old_locinfo->lc_handle[category];
+ locinfo->lc_id[category] = old_locinfo->lc_id[category];
+ locinfo->lc_category[category] = old_locinfo->lc_category[category];
+ InterlockedIncrement(locinfo->lc_category[category].refcount);
+}
+
/* INTERNAL: Set lc_handle, lc_id and lc_category in threadlocinfo struct */
static BOOL update_threadlocinfo_category(LCID lcid, unsigned short cp,
MSVCRT_pthreadlocinfo locinfo, int category)
@@ -878,11 +887,14 @@ void free_locinfo(MSVCRT_pthreadlocinfo locinfo)
return;
for(i=MSVCRT_LC_MIN+1; i<=MSVCRT_LC_MAX; i++) {
- MSVCRT_free(locinfo->lc_category[i].locale);
- MSVCRT_free(locinfo->lc_category[i].refcount);
#if _MSVCR_VER >= 110
MSVCRT_free(locinfo->lc_name[i]);
#endif
+ if(!locinfo->lc_category[i].refcount
+ || InterlockedDecrement(locinfo->lc_category[i].refcount))
+ continue;
+ MSVCRT_free(locinfo->lc_category[i].locale);
+ MSVCRT_free(locinfo->lc_category[i].refcount);
}
if(locinfo->lconv) {
@@ -1200,8 +1212,11 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category,
if(!category_needs_update(MSVCRT_LC_COLLATE, category, old_locinfo,
lcid[MSVCRT_LC_COLLATE], cp[MSVCRT_LC_COLLATE])) {
- locinfo->lc_handle[MSVCRT_LC_COLLATE] = old_locinfo->lc_handle[MSVCRT_LC_COLLATE];
- locinfo->lc_id[MSVCRT_LC_COLLATE].wCodePage = old_locinfo->lc_id[MSVCRT_LC_COLLATE].wCodePage;
+ copy_threadlocinfo_category(locinfo, old_locinfo, MSVCRT_LC_COLLATE);
+ if(!set_lc_locale_name(locinfo, MSVCRT_LC_COLLATE)) {
+ free_locinfo(locinfo);
+ return NULL;
+ }
} else if(lcid[MSVCRT_LC_COLLATE] && (category==MSVCRT_LC_ALL || category==MSVCRT_LC_COLLATE)) {
if(!update_threadlocinfo_category(lcid[MSVCRT_LC_COLLATE],
cp[MSVCRT_LC_COLLATE], locinfo, MSVCRT_LC_COLLATE)) {
@@ -1215,8 +1230,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],
@@ -1227,8 +1246,11 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category,
if(!category_needs_update(MSVCRT_LC_CTYPE, category, old_locinfo,
lcid[MSVCRT_LC_CTYPE], cp[MSVCRT_LC_CTYPE])) {
- locinfo->lc_handle[MSVCRT_LC_CTYPE] = old_locinfo->lc_handle[MSVCRT_LC_CTYPE];
- locinfo->lc_id[MSVCRT_LC_CTYPE].wCodePage = old_locinfo->lc_id[MSVCRT_LC_CTYPE].wCodePage;
+ copy_threadlocinfo_category(locinfo, old_locinfo, MSVCRT_LC_CTYPE);
+ if(!set_lc_locale_name(locinfo, MSVCRT_LC_CTYPE)) {
+ free_locinfo(locinfo);
+ return NULL;
+ }
} else if(lcid[MSVCRT_LC_CTYPE] && (category==MSVCRT_LC_ALL || category==MSVCRT_LC_CTYPE)) {
CPINFO cp_info;
int j;
@@ -1293,7 +1315,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)
@@ -1317,8 +1342,11 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category,
if(!category_needs_update(MSVCRT_LC_MONETARY, category, old_locinfo,
lcid[MSVCRT_LC_MONETARY], cp[MSVCRT_LC_MONETARY])) {
- locinfo->lc_handle[MSVCRT_LC_MONETARY] = old_locinfo->lc_handle[MSVCRT_LC_MONETARY];
- locinfo->lc_id[MSVCRT_LC_MONETARY].wCodePage = old_locinfo->lc_id[MSVCRT_LC_MONETARY].wCodePage;
+ copy_threadlocinfo_category(locinfo, old_locinfo, MSVCRT_LC_MONETARY);
+ if(!set_lc_locale_name(locinfo, MSVCRT_LC_MONETARY)) {
+ free_locinfo(locinfo);
+ return NULL;
+ }
} else if(lcid[MSVCRT_LC_MONETARY] && (category==MSVCRT_LC_ALL || category==MSVCRT_LC_MONETARY)) {
if(!update_threadlocinfo_category(lcid[MSVCRT_LC_MONETARY],
cp[MSVCRT_LC_MONETARY], locinfo, MSVCRT_LC_MONETARY)) {
@@ -1585,7 +1613,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] &&
@@ -1597,8 +1628,11 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category,
if(!category_needs_update(MSVCRT_LC_NUMERIC, category, old_locinfo,
lcid[MSVCRT_LC_NUMERIC], cp[MSVCRT_LC_NUMERIC])) {
- locinfo->lc_handle[MSVCRT_LC_NUMERIC] = old_locinfo->lc_handle[MSVCRT_LC_NUMERIC];
- locinfo->lc_id[MSVCRT_LC_NUMERIC].wCodePage = old_locinfo->lc_id[MSVCRT_LC_NUMERIC].wCodePage;
+ copy_threadlocinfo_category(locinfo, old_locinfo, MSVCRT_LC_NUMERIC);
+ if(!set_lc_locale_name(locinfo, MSVCRT_LC_NUMERIC)) {
+ free_locinfo(locinfo);
+ return NULL;
+ }
} else if(lcid[MSVCRT_LC_NUMERIC] && (category==MSVCRT_LC_ALL || category==MSVCRT_LC_NUMERIC)) {
if(!update_threadlocinfo_category(lcid[MSVCRT_LC_NUMERIC],
cp[MSVCRT_LC_NUMERIC], locinfo, MSVCRT_LC_NUMERIC)) {
@@ -1703,7 +1737,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] &&
@@ -1715,8 +1752,11 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category,
if(!category_needs_update(MSVCRT_LC_TIME, category, old_locinfo,
lcid[MSVCRT_LC_TIME], cp[MSVCRT_LC_TIME])) {
- locinfo->lc_handle[MSVCRT_LC_TIME] = old_locinfo->lc_handle[MSVCRT_LC_TIME];
- locinfo->lc_id[MSVCRT_LC_TIME].wCodePage = old_locinfo->lc_id[MSVCRT_LC_TIME].wCodePage;
+ copy_threadlocinfo_category(locinfo, old_locinfo, MSVCRT_LC_TIME);
+ if(!set_lc_locale_name(locinfo, MSVCRT_LC_TIME)) {
+ free_locinfo(locinfo);
+ return NULL;
+ }
} else if(lcid[MSVCRT_LC_TIME] && (category==MSVCRT_LC_ALL || category==MSVCRT_LC_TIME)) {
if(!update_threadlocinfo_category(lcid[MSVCRT_LC_TIME],
cp[MSVCRT_LC_TIME], locinfo, MSVCRT_LC_TIME)) {
@@ -1735,7 +1775,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;
}
--
2.24.0
Jan. 31, 2020
[PATCH 1/8] msvcr90/tests: Test _get_current_locale()/setlocale() interaction.
by Chip Davis
Signed-off-by: Chip Davis <cdavis(a)codeweavers.com>
---
dlls/msvcr90/tests/msvcr90.c | 460 +++++++++++++++++++++++++++++++++++
1 file changed, 460 insertions(+)
diff --git a/dlls/msvcr90/tests/msvcr90.c b/dlls/msvcr90/tests/msvcr90.c
index c8a49f25492d..f8e68ed2f630 100644
--- a/dlls/msvcr90/tests/msvcr90.c
+++ b/dlls/msvcr90/tests/msvcr90.c
@@ -139,6 +139,22 @@ static int (__cdecl *p_swscanf)(const wchar_t *str, const wchar_t* format, ...);
static int (__cdecl *p____mb_cur_max_l_func)(_locale_t locale);
static _locale_t (__cdecl *p__create_locale)(int, const char*);
static void (__cdecl *p__free_locale)(_locale_t);
+static _locale_t (__cdecl *p__get_current_locale)(void);
+
+struct __lc_time_data {
+ const char *short_wday[7];
+ const char *wday[7];
+ const char *short_mon[12];
+ const char *mon[12];
+ const char *am;
+ const char *pm;
+ const char *short_date;
+ const char *date;
+ const char *time;
+ LCID lcid;
+ int unk;
+ int refcount;
+};
/* make sure we use the correct errno */
#undef errno
@@ -408,6 +424,7 @@ static BOOL init(void)
SET(p____mb_cur_max_l_func, "___mb_cur_max_l_func");
SET(p__create_locale, "_create_locale");
SET(p__free_locale, "_free_locale");
+ SET(p__get_current_locale, "_get_current_locale");
if (sizeof(void *) == 8)
{
@@ -1961,6 +1978,448 @@ static void test____mb_cur_max_l_func(void)
p__free_locale(l);
}
+static void test__get_current_locale(void)
+{
+ _locale_t l = p__get_current_locale(), l2 = p__get_current_locale();
+ int i;
+#define lc_str(lc, s) \
+ ok(!strcmp(l->locinfo->lc_category[lc].locale, s), #lc " = \"%s\"\n", \
+ l->locinfo->lc_category[lc].locale)
+ lc_str(LC_COLLATE, "C");
+ lc_str(LC_CTYPE, "C");
+ lc_str(LC_MONETARY, "C");
+ lc_str(LC_NUMERIC, "C");
+ lc_str(LC_TIME, "C");
+
+ ok(l->locinfo->refcount == 3, "refcount = %d\n", l->locinfo->refcount);
+
+ p_setlocale(LC_ALL, "english");
+ todo_wine {
+ lc_str(LC_COLLATE, "C");
+ lc_str(LC_CTYPE, "C");
+ lc_str(LC_MONETARY, "C");
+ lc_str(LC_NUMERIC, "C");
+ lc_str(LC_TIME, "C");
+ }
+#undef lc_str
+
+ todo_wine ok(l->locinfo->refcount == 2, "refcount = %d\n", l->locinfo->refcount);
+ ok(l->locinfo == l2->locinfo, "different locinfo pointers\n");
+ ok(l->mbcinfo == l2->mbcinfo, "different mbcinfo pointers\n");
+
+ p__free_locale(l);
+ p__free_locale(l2);
+
+ l = p__get_current_locale();
+ p_setlocale(LC_COLLATE, "C");
+ l2 = p__get_current_locale();
+
+ todo_wine {
+ ok(l->locinfo->refcount == 1, "refcount = %d\n", l->locinfo->refcount);
+ ok(l2->locinfo->refcount == 2, "refcount = %d\n", l2->locinfo->refcount);
+ }
+
+ todo_wine {
+ ok(l->locinfo->lc_category[LC_COLLATE].locale != l2->locinfo->lc_category[LC_COLLATE].locale,
+ "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);
+ }
+ 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);
+ ok(l->locinfo->lc_category[i].refcount == l2->locinfo->lc_category[i].refcount,
+ "different refcount pointers for category %d\n", i);
+ todo_wine ok(*l->locinfo->lc_category[i].refcount == 3, "refcount = %d for category %d\n",
+ *l->locinfo->lc_category[i].refcount, i);
+ }
+
+ todo_wine ok(l->locinfo->lc_collate_cp != l2->locinfo->lc_collate_cp, "same lc_collate_cp %u, %u\n",
+ l->locinfo->lc_collate_cp, l2->locinfo->lc_collate_cp);
+
+ ok(l->locinfo->lc_codepage == l2->locinfo->lc_codepage, "different lc_codepages %u, %u\n",
+ l->locinfo->lc_codepage, l2->locinfo->lc_codepage);
+ ok(l->locinfo->lc_clike == l2->locinfo->lc_clike, "different lc_clike values %d, %d\n",
+ l->locinfo->lc_clike, l2->locinfo->lc_clike);
+ /* The meaning of this member seems to be reversed--go figure */
+ ok(l->locinfo->lc_clike, "non-C locale is C-like\n");
+ ok(l->locinfo->ctype1 == l2->locinfo->ctype1, "different ctype1 pointers\n");
+ ok(l->locinfo->pclmap == l2->locinfo->pclmap, "different clmap pointers\n");
+ ok(l->locinfo->pcumap == l2->locinfo->pcumap, "different cumap pointers\n");
+ ok(l->locinfo->ctype1_refcount == l2->locinfo->ctype1_refcount, "different ctype1_refcount pointers\n");
+ todo_wine ok(*l->locinfo->ctype1_refcount == 3, "refcount = %d\n", *l->locinfo->ctype1_refcount);
+
+ ok(l->locinfo->lconv == l2->locinfo->lconv, "different lconv pointers\n");
+ ok(l->locinfo->lconv_intl_refcount == l2->locinfo->lconv_intl_refcount, "different lconv_intl_refcount pointers\n");
+ todo_wine ok(l->locinfo->lconv_intl_refcount, "null refcount pointer in non-C locale\n");
+ if(l->locinfo->lconv_intl_refcount)
+ todo_wine ok(*l->locinfo->lconv_intl_refcount == 3, "refcount = %d\n", *l->locinfo->lconv_intl_refcount);
+
+ ok(l->locinfo->lconv->decimal_point == l2->locinfo->lconv->decimal_point, "different LC_NUMERIC pointers\n");
+ ok(l->locinfo->lconv_num_refcount == l2->locinfo->lconv_num_refcount, "different lconv_num_refcount pointers\n");
+ todo_wine ok(l->locinfo->lconv_num_refcount, "null refcount pointer in non-C locale\n");
+ if(l->locinfo->lconv_num_refcount)
+ todo_wine ok(*l->locinfo->lconv_num_refcount == 3, "refcount = %d\n", *l->locinfo->lconv_num_refcount);
+
+ ok(l->locinfo->lconv->currency_symbol == l2->locinfo->lconv->currency_symbol, "different LC_MONETARY pointers\n");
+ ok(l->locinfo->lconv_mon_refcount == l2->locinfo->lconv_mon_refcount, "different lconv_mon_refcount pointers\n");
+ todo_wine ok(l->locinfo->lconv_mon_refcount, "null refcount pointer in non-C locale\n");
+ if(l->locinfo->lconv_mon_refcount)
+ todo_wine ok(*l->locinfo->lconv_mon_refcount == 3, "refcount = %d\n", *l->locinfo->lconv_mon_refcount);
+
+ ok(l->locinfo->lc_time_curr == l2->locinfo->lc_time_curr, "different lc_time_curr pointers\n");
+ todo_wine ok(l->locinfo->lc_time_curr->unk == 1, "unk = %d\n", l->locinfo->lc_time_curr->unk);
+ todo_wine ok(l->locinfo->lc_time_curr->refcount == 3, "refcount = %d\n", l->locinfo->lc_time_curr->refcount);
+
+ p__free_locale(l2);
+
+ p_setlocale(LC_CTYPE, "C");
+ l2 = p__get_current_locale();
+
+ todo_wine {
+ ok(l->locinfo->refcount == 1, "refcount = %d\n", l->locinfo->refcount);
+ ok(l2->locinfo->refcount == 2, "refcount = %d\n", l2->locinfo->refcount);
+ }
+
+ for(i = LC_COLLATE; i < LC_MONETARY; 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);
+ }
+ }
+ for(i = LC_MONETARY; 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);
+ ok(l->locinfo->lc_category[i].refcount == l2->locinfo->lc_category[i].refcount,
+ "different refcount pointers for category %d\n", i);
+ todo_wine ok(*l->locinfo->lc_category[i].refcount == 3, "refcount = %d for category %d\n",
+ *l->locinfo->lc_category[i].refcount, i);
+ }
+
+ todo_wine {
+ ok(l->locinfo->lc_collate_cp != l2->locinfo->lc_collate_cp, "same lc_collate_cp %u, %u\n",
+ l->locinfo->lc_collate_cp, l2->locinfo->lc_collate_cp);
+
+ ok(l->locinfo->lc_codepage != l2->locinfo->lc_codepage, "same lc_codepages %u, %u\n",
+ l->locinfo->lc_codepage, l2->locinfo->lc_codepage);
+ ok(l->locinfo->lc_clike != l2->locinfo->lc_clike, "same lc_clike values %d, %d\n",
+ l->locinfo->lc_clike, l2->locinfo->lc_clike);
+ }
+ ok(l->locinfo->lc_clike, "non-C locale is C-like\n");
+ todo_wine {
+ ok(!l2->locinfo->lc_clike, "C locale is not C-like\n");
+ ok(l->locinfo->ctype1 != l2->locinfo->ctype1, "same ctype1 pointers\n");
+ ok(l->locinfo->pclmap != l2->locinfo->pclmap, "same clmap pointers\n");
+ ok(l->locinfo->pcumap != l2->locinfo->pcumap, "same cumap pointers\n");
+ ok(l->locinfo->ctype1_refcount != l2->locinfo->ctype1_refcount, "same ctype1_refcount pointers\n");
+ ok(l->locinfo->ctype1_refcount, "null refcount pointer for non-C locale\n");
+ if(l->locinfo->ctype1_refcount)
+ ok(*l->locinfo->ctype1_refcount == 1, "refcount = %d\n", *l->locinfo->ctype1_refcount);
+ }
+ ok(!l2->locinfo->ctype1_refcount, "nonnull refcount pointer for C locale\n");
+
+ ok(l->locinfo->lconv == l2->locinfo->lconv, "different lconv pointers\n");
+ ok(l->locinfo->lconv_intl_refcount == l2->locinfo->lconv_intl_refcount, "different lconv_intl_refcount pointers\n");
+ todo_wine ok(l->locinfo->lconv_intl_refcount, "null refcount pointer in non-C locale\n");
+ if(l->locinfo->lconv_intl_refcount)
+ todo_wine ok(*l->locinfo->lconv_intl_refcount == 3, "refcount = %d\n", *l->locinfo->lconv_intl_refcount);
+
+ ok(l->locinfo->lconv->decimal_point == l2->locinfo->lconv->decimal_point, "different LC_NUMERIC pointers\n");
+ ok(l->locinfo->lconv_num_refcount == l2->locinfo->lconv_num_refcount, "different lconv_num_refcount pointers\n");
+ todo_wine ok(l->locinfo->lconv_num_refcount, "null refcount pointer in non-C locale\n");
+ if(l->locinfo->lconv_num_refcount)
+ todo_wine ok(*l->locinfo->lconv_num_refcount == 3, "refcount = %d\n", *l->locinfo->lconv_num_refcount);
+
+ ok(l->locinfo->lconv->currency_symbol == l2->locinfo->lconv->currency_symbol, "different LC_MONETARY pointers\n");
+ ok(l->locinfo->lconv_mon_refcount == l2->locinfo->lconv_mon_refcount, "different lconv_mon_refcount pointers\n");
+ todo_wine ok(l->locinfo->lconv_mon_refcount, "null refcount pointer in non-C locale\n");
+ if(l->locinfo->lconv_mon_refcount)
+ todo_wine ok(*l->locinfo->lconv_mon_refcount == 3, "refcount = %d\n", *l->locinfo->lconv_mon_refcount);
+
+ ok(l->locinfo->lc_time_curr == l2->locinfo->lc_time_curr, "different lc_time_curr pointers\n");
+ todo_wine ok(l->locinfo->lc_time_curr->unk == 1, "unk = %d\n", l->locinfo->lc_time_curr->unk);
+ todo_wine ok(l->locinfo->lc_time_curr->refcount == 3, "refcount = %d\n", l->locinfo->lc_time_curr->refcount);
+
+ p__free_locale(l2);
+
+ p_setlocale(LC_MONETARY, "C");
+ l2 = p__get_current_locale();
+
+ todo_wine {
+ ok(l->locinfo->refcount == 1, "refcount = %d\n", l->locinfo->refcount);
+ ok(l2->locinfo->refcount == 2, "refcount = %d\n", l2->locinfo->refcount);
+ }
+
+ for(i = LC_COLLATE; i <= LC_MONETARY; 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);
+ }
+ }
+ for(i = LC_NUMERIC; 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);
+ ok(l->locinfo->lc_category[i].refcount == l2->locinfo->lc_category[i].refcount,
+ "different refcount pointers for category %d\n", i);
+ todo_wine ok(*l->locinfo->lc_category[i].refcount == 3, "refcount = %d for category %d\n",
+ *l->locinfo->lc_category[i].refcount, i);
+ }
+
+ todo_wine {
+ ok(l->locinfo->lc_collate_cp != l2->locinfo->lc_collate_cp, "same lc_collate_cp %u, %u\n",
+ l->locinfo->lc_collate_cp, l2->locinfo->lc_collate_cp);
+
+ ok(l->locinfo->lc_codepage != l2->locinfo->lc_codepage, "same lc_codepages %u, %u\n",
+ l->locinfo->lc_codepage, l2->locinfo->lc_codepage);
+ ok(l->locinfo->lc_clike != l2->locinfo->lc_clike, "same lc_clike values %d, %d\n",
+ l->locinfo->lc_clike, l2->locinfo->lc_clike);
+ }
+ ok(l->locinfo->lc_clike, "non-C locale is C-like\n");
+ todo_wine {
+ ok(!l2->locinfo->lc_clike, "C locale is not C-like\n");
+ ok(l->locinfo->ctype1 != l2->locinfo->ctype1, "same ctype1 pointers\n");
+ ok(l->locinfo->pclmap != l2->locinfo->pclmap, "same clmap pointers\n");
+ ok(l->locinfo->pcumap != l2->locinfo->pcumap, "same cumap pointers\n");
+ ok(l->locinfo->ctype1_refcount != l2->locinfo->ctype1_refcount, "same ctype1_refcount pointers\n");
+ ok(l->locinfo->ctype1_refcount, "null refcount pointer for non-C locale\n");
+ if(l->locinfo->ctype1_refcount)
+ ok(*l->locinfo->ctype1_refcount == 1, "refcount = %d\n", *l->locinfo->ctype1_refcount);
+ }
+ ok(!l2->locinfo->ctype1_refcount, "nonnull refcount pointer for C locale\n");
+
+ todo_wine {
+ ok(l->locinfo->lconv != l2->locinfo->lconv, "same lconv pointers\n");
+ ok(l->locinfo->lconv_intl_refcount != l2->locinfo->lconv_intl_refcount, "same lconv_intl_refcount pointers\n");
+ ok(l->locinfo->lconv_intl_refcount, "null refcount pointer in non-C locale\n");
+ if(l->locinfo->lconv_intl_refcount)
+ ok(*l->locinfo->lconv_intl_refcount == 1, "refcount = %d\n", *l->locinfo->lconv_intl_refcount);
+ ok(l2->locinfo->lconv_intl_refcount, "null refcount pointer for C locale\n");
+ if(l2->locinfo->lconv_intl_refcount)
+ ok(*l2->locinfo->lconv_intl_refcount == 2, "refcount = %d\n", *l2->locinfo->lconv_intl_refcount);
+ }
+
+ ok(l->locinfo->lconv->decimal_point == l2->locinfo->lconv->decimal_point, "different LC_NUMERIC pointers\n");
+ ok(l->locinfo->lconv_num_refcount == l2->locinfo->lconv_num_refcount, "different lconv_num_refcount pointers\n");
+ todo_wine ok(l->locinfo->lconv_num_refcount, "null refcount pointer in non-C locale\n");
+ if(l->locinfo->lconv_num_refcount)
+ todo_wine ok(*l->locinfo->lconv_num_refcount == 3, "refcount = %d\n", *l->locinfo->lconv_num_refcount);
+
+ todo_wine {
+ ok(l->locinfo->lconv->currency_symbol != l2->locinfo->lconv->currency_symbol, "same LC_MONETARY pointers\n");
+ ok(l->locinfo->lconv_mon_refcount != l2->locinfo->lconv_mon_refcount, "same lconv_mon_refcount pointers\n");
+ ok(l->locinfo->lconv_mon_refcount, "null refcount pointer in non-C locale\n");
+ if(l->locinfo->lconv_mon_refcount)
+ ok(*l->locinfo->lconv_mon_refcount == 1, "refcount = %d\n", *l->locinfo->lconv_mon_refcount);
+ }
+ ok(!l2->locinfo->lconv_mon_refcount, "nonnull refcount pointer for C locale\n");
+
+ ok(l->locinfo->lc_time_curr == l2->locinfo->lc_time_curr, "different lc_time_curr pointers\n");
+ todo_wine ok(l->locinfo->lc_time_curr->unk == 1, "unk = %d\n", l->locinfo->lc_time_curr->unk);
+ todo_wine ok(l->locinfo->lc_time_curr->refcount == 3, "refcount = %d\n", l->locinfo->lc_time_curr->refcount);
+
+ p__free_locale(l2);
+
+ p_setlocale(LC_NUMERIC, "C");
+ l2 = p__get_current_locale();
+
+ todo_wine {
+ ok(l->locinfo->refcount == 1, "refcount = %d\n", l->locinfo->refcount);
+ ok(l2->locinfo->refcount == 2, "refcount = %d\n", l2->locinfo->refcount);
+ }
+
+ for(i = LC_COLLATE; i <= LC_NUMERIC; 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(l->locinfo->lc_category[LC_TIME].locale == l2->locinfo->lc_category[LC_TIME].locale,
+ "different locale name pointers for LC_TIME\n");
+ ok(l->locinfo->lc_category[LC_TIME].refcount == l2->locinfo->lc_category[LC_TIME].refcount,
+ "different refcount pointers for LC_TIME\n");
+ todo_wine ok(*l->locinfo->lc_category[LC_TIME].refcount == 3, "refcount = %d\n",
+ *l->locinfo->lc_category[LC_TIME].refcount);
+
+ todo_wine {
+ ok(l->locinfo->lc_collate_cp != l2->locinfo->lc_collate_cp, "same lc_collate_cp %u, %u\n",
+ l->locinfo->lc_collate_cp, l2->locinfo->lc_collate_cp);
+
+ ok(l->locinfo->lc_codepage != l2->locinfo->lc_codepage, "same lc_codepages %u, %u\n",
+ l->locinfo->lc_codepage, l2->locinfo->lc_codepage);
+ ok(l->locinfo->lc_clike != l2->locinfo->lc_clike, "same lc_clike values %d, %d\n",
+ l->locinfo->lc_clike, l2->locinfo->lc_clike);
+ }
+ ok(l->locinfo->lc_clike, "non-C locale is C-like\n");
+ todo_wine {
+ ok(!l2->locinfo->lc_clike, "C locale is not C-like\n");
+ ok(l->locinfo->ctype1 != l2->locinfo->ctype1, "same ctype1 pointers\n");
+ ok(l->locinfo->pclmap != l2->locinfo->pclmap, "same clmap pointers\n");
+ ok(l->locinfo->pcumap != l2->locinfo->pcumap, "same cumap pointers\n");
+ ok(l->locinfo->ctype1_refcount != l2->locinfo->ctype1_refcount, "same ctype1_refcount pointers\n");
+ ok(l->locinfo->ctype1_refcount, "null refcount pointer for non-C locale\n");
+ if(l->locinfo->ctype1_refcount)
+ ok(*l->locinfo->ctype1_refcount == 1, "refcount = %d\n", *l->locinfo->ctype1_refcount);
+ }
+ ok(!l2->locinfo->ctype1_refcount, "nonnull refcount pointer for C locale\n");
+
+ todo_wine {
+ ok(l->locinfo->lconv != l2->locinfo->lconv, "same lconv pointers\n");
+ ok(l->locinfo->lconv_intl_refcount != l2->locinfo->lconv_intl_refcount, "same lconv_intl_refcount pointers\n");
+ ok(l->locinfo->lconv_intl_refcount, "null refcount pointer in non-C locale\n");
+ if(l->locinfo->lconv_intl_refcount)
+ ok(*l->locinfo->lconv_intl_refcount == 1, "refcount = %d\n", *l->locinfo->lconv_intl_refcount);
+ }
+ ok(!l2->locinfo->lconv_intl_refcount, "nonnull refcount pointer for C locale\n");
+
+ todo_wine {
+ ok(l->locinfo->lconv->decimal_point != l2->locinfo->lconv->decimal_point, "same LC_NUMERIC pointers\n");
+ ok(l->locinfo->lconv_num_refcount != l2->locinfo->lconv_num_refcount, "same lconv_num_refcount pointers\n");
+ ok(l->locinfo->lconv_num_refcount, "null refcount pointer in non-C locale\n");
+ if(l->locinfo->lconv_num_refcount)
+ ok(*l->locinfo->lconv_num_refcount == 1, "refcount = %d\n", *l->locinfo->lconv_num_refcount);
+ }
+ ok(!l2->locinfo->lconv_num_refcount, "nonnull refcount pointer for C locale\n");
+
+ todo_wine {
+ ok(l->locinfo->lconv->currency_symbol != l2->locinfo->lconv->currency_symbol, "same LC_MONETARY pointers\n");
+ ok(l->locinfo->lconv_mon_refcount != l2->locinfo->lconv_mon_refcount, "same lconv_mon_refcount pointers\n");
+ ok(l->locinfo->lconv_mon_refcount, "null refcount pointer in non-C locale\n");
+ if(l->locinfo->lconv_mon_refcount)
+ ok(*l->locinfo->lconv_mon_refcount == 1, "refcount = %d\n", *l->locinfo->lconv_mon_refcount);
+ }
+ ok(!l2->locinfo->lconv_mon_refcount, "nonnull refcount pointer for C locale\n");
+
+ ok(l->locinfo->lc_time_curr == l2->locinfo->lc_time_curr, "different lc_time_curr pointers\n");
+ todo_wine ok(l->locinfo->lc_time_curr->unk == 1, "unk = %d\n", l->locinfo->lc_time_curr->unk);
+ todo_wine ok(l->locinfo->lc_time_curr->refcount == 3, "refcount = %d\n", l->locinfo->lc_time_curr->refcount);
+
+ p__free_locale(l2);
+
+ p_setlocale(LC_TIME, "C");
+ l2 = p__get_current_locale();
+
+ todo_wine {
+ ok(l->locinfo->refcount == 1, "refcount = %d\n", l->locinfo->refcount);
+ ok(l2->locinfo->refcount == 2, "refcount = %d\n", l2->locinfo->refcount);
+ }
+
+ todo_wine {
+ for(i = LC_MIN+1; i <= LC_MAX; i++) {
+ 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);
+ }
+ }
+
+ todo_wine {
+ ok(l->locinfo->lc_collate_cp != l2->locinfo->lc_collate_cp, "same lc_collate_cp %u, %u\n",
+ l->locinfo->lc_collate_cp, l2->locinfo->lc_collate_cp);
+
+ ok(l->locinfo->lc_codepage != l2->locinfo->lc_codepage, "same lc_codepages %u, %u\n",
+ l->locinfo->lc_codepage, l2->locinfo->lc_codepage);
+ ok(l->locinfo->lc_clike != l2->locinfo->lc_clike, "same lc_clike values %d, %d\n",
+ l->locinfo->lc_clike, l2->locinfo->lc_clike);
+ }
+ ok(l->locinfo->lc_clike, "non-C locale is C-like\n");
+ todo_wine {
+ ok(!l2->locinfo->lc_clike, "C locale is not C-like\n");
+ ok(l->locinfo->ctype1 != l2->locinfo->ctype1, "same ctype1 pointers\n");
+ ok(l->locinfo->pclmap != l2->locinfo->pclmap, "same clmap pointers\n");
+ ok(l->locinfo->pcumap != l2->locinfo->pcumap, "same cumap pointers\n");
+ ok(l->locinfo->ctype1_refcount != l2->locinfo->ctype1_refcount, "same ctype1_refcount pointers\n");
+ ok(l->locinfo->ctype1_refcount, "null refcount pointer for non-C locale\n");
+ if(l->locinfo->ctype1_refcount)
+ ok(*l->locinfo->ctype1_refcount == 1, "refcount = %d\n", *l->locinfo->ctype1_refcount);
+ }
+ ok(!l2->locinfo->ctype1_refcount, "nonnull refcount pointer for C locale\n");
+
+ todo_wine {
+ ok(l->locinfo->lconv != l2->locinfo->lconv, "same lconv pointers\n");
+ ok(l->locinfo->lconv_intl_refcount != l2->locinfo->lconv_intl_refcount, "same lconv_intl_refcount pointers\n");
+ ok(l->locinfo->lconv_intl_refcount, "null refcount pointer in non-C locale\n");
+ if(l->locinfo->lconv_intl_refcount)
+ ok(*l->locinfo->lconv_intl_refcount == 1, "refcount = %d\n", *l->locinfo->lconv_intl_refcount);
+ }
+ ok(!l2->locinfo->lconv_intl_refcount, "nonnull refcount pointer for C locale\n");
+
+ todo_wine {
+ ok(l->locinfo->lconv->decimal_point != l2->locinfo->lconv->decimal_point, "same LC_NUMERIC pointers\n");
+ ok(l->locinfo->lconv_num_refcount != l2->locinfo->lconv_num_refcount, "same lconv_num_refcount pointers\n");
+ ok(l->locinfo->lconv_num_refcount, "null refcount pointer in non-C locale\n");
+ if(l->locinfo->lconv_num_refcount)
+ ok(*l->locinfo->lconv_num_refcount == 1, "refcount = %d\n", *l->locinfo->lconv_num_refcount);
+ }
+ ok(!l2->locinfo->lconv_num_refcount, "nonnull refcount pointer for C locale\n");
+
+ todo_wine {
+ ok(l->locinfo->lconv->currency_symbol != l2->locinfo->lconv->currency_symbol, "same LC_MONETARY pointers\n");
+ ok(l->locinfo->lconv_mon_refcount != l2->locinfo->lconv_mon_refcount, "same lconv_mon_refcount pointers\n");
+ ok(l->locinfo->lconv_mon_refcount, "null refcount pointer in non-C locale\n");
+ if(l->locinfo->lconv_mon_refcount)
+ ok(*l->locinfo->lconv_mon_refcount == 1, "refcount = %d\n", *l->locinfo->lconv_mon_refcount);
+ }
+ ok(!l2->locinfo->lconv_mon_refcount, "nonnull refcount pointer for C locale\n");
+
+ todo_wine ok(l->locinfo->lc_time_curr != l2->locinfo->lc_time_curr, "same lc_time_curr pointers\n");
+ ok(l->locinfo->lc_time_curr->unk == 1, "unk = %d\n", l->locinfo->lc_time_curr->unk);
+ todo_wine ok(l->locinfo->lc_time_curr->refcount == 1, "refcount = %d\n", l->locinfo->lc_time_curr->refcount);
+ ok(l2->locinfo->lc_time_curr->unk == 1, "unk = %d\n", l2->locinfo->lc_time_curr->unk);
+ todo_wine ok(l2->locinfo->lc_time_curr->refcount == 3 || l2->locinfo->lc_time_curr->refcount == 2,
+ "refcount = %d\n", l2->locinfo->lc_time_curr->refcount);
+
+ p__free_locale(l2);
+
+ p__free_locale(l);
+ p_setlocale(LC_ALL, "C");
+}
+
START_TEST(msvcr90)
{
if(!init())
@@ -2001,4 +2460,5 @@ START_TEST(msvcr90)
test___strncnt();
test_swscanf();
test____mb_cur_max_l_func();
+ test__get_current_locale();
}
--
2.24.0
Jan. 31, 2020
[PATCH 2/2] msvcrt: Use parent makefile variables to avoid dupliaction.
by Jacek Caban
Signed-off-by: Jacek Caban <jacek(a)codeweavers.com>
---
dlls/crtdll/Makefile.in | 34 +++-------------------------------
dlls/msvcr100/Makefile.in | 38 +++-----------------------------------
dlls/msvcr110/Makefile.in | 38 +++-----------------------------------
dlls/msvcr120/Makefile.in | 38 +++-----------------------------------
dlls/msvcr70/Makefile.in | 37 +++----------------------------------
dlls/msvcr71/Makefile.in | 37 +++----------------------------------
dlls/msvcr80/Makefile.in | 37 +++----------------------------------
dlls/msvcr90/Makefile.in | 37 +++----------------------------------
dlls/msvcrtd/Makefile.in | 35 +++--------------------------------
9 files changed, 27 insertions(+), 304 deletions(-)
Jan. 31, 2020
[PATCH 1/2] makedep: Add support for using parent makefile variables.
by Jacek Caban
Signed-off-by: Jacek Caban <jacek(a)codeweavers.com>
---
tools/makedep.c | 49 +++++++++++++++++++++++++++++++++++++++++++------
1 file changed, 43 insertions(+), 6 deletions(-)
Jan. 31, 2020
Re: [PATCH] mshtml/tests: Get rid of strcmp_wa from dom.c.
by Marvin
Hi,
While running your changed tests, I think I found new failures.
Being a bot and all I'm not very good at pattern recognition, so I might be
wrong, but could you please double-check?
Full results can be found at:
https://testbot.winehq.org/JobDetails.pl?Key=64285
Your paranoid android.
=== wxppro (32 bit report) ===
mshtml:
dom.c:4643: Test failed: got L"_blank"
=== wvistau64 (32 bit report) ===
mshtml:
dom.c:4643: Test failed: got L"_blank"
dom.c:4643: Test failed: got L"_blank"
=== w7u (32 bit report) ===
mshtml:
dom.c:4643: Test failed: got L"_blank"
dom.c:4643: Test failed: got L"_blank"
=== w8 (32 bit report) ===
mshtml:
dom.c:4643: Test failed: got L"_blank"
dom.c:4643: Test failed: got L"_blank"
=== w8adm (32 bit report) ===
mshtml:
dom.c:4643: Test failed: got L"_blank"
dom.c:4643: Test failed: got L"_blank"
=== w864 (32 bit report) ===
mshtml:
dom.c:4643: Test failed: got L"_blank"
dom.c:4643: Test failed: got L"_blank"
=== w1064v1507 (32 bit report) ===
mshtml:
dom.c:4643: Test failed: got L"_blank"
dom.c:4643: Test failed: got L"_blank"
=== w1064v1809 (32 bit report) ===
mshtml:
dom.c:4643: Test failed: got L"_blank"
dom.c:4643: Test failed: got L"_blank"
=== w1064v1809_2scr (32 bit report) ===
mshtml:
dom.c:4643: Test failed: got L"_blank"
dom.c:4643: Test failed: got L"_blank"
=== w1064v1809_ar (32 bit report) ===
mshtml:
dom.c:4643: Test failed: got L"_blank"
dom.c:4643: Test failed: got L"_blank"
=== w1064v1809_he (32 bit report) ===
mshtml:
dom.c:4643: Test failed: got L"_blank"
dom.c:4643: Test failed: got L"_blank"
=== w1064v1809_ja (32 bit report) ===
mshtml:
dom.c:4643: Test failed: got L"_blank"
dom.c:4643: Test failed: got L"_blank"
=== w1064v1809_zh_CN (32 bit report) ===
mshtml:
dom.c:4643: Test failed: got L"_blank"
dom.c:4643: Test failed: got L"_blank"
=== wvistau64 (64 bit report) ===
mshtml:
dom.c:4643: Test failed: got L"_blank"
dom.c:4643: Test failed: got L"_blank"
=== w864 (64 bit report) ===
mshtml:
dom.c:4643: Test failed: got L"_blank"
dom.c:4643: Test failed: got L"_blank"
=== w1064v1507 (64 bit report) ===
mshtml:
dom.c:4643: Test failed: got L"_blank"
dom.c:4643: Test failed: got L"_blank"
=== w1064v1809 (64 bit report) ===
mshtml:
dom.c:4643: Test failed: got L"_blank"
dom.c:4643: Test failed: got L"_blank"
=== debian10 (32 bit report) ===
mshtml:
dom.c:4643: Test failed: got L"_blank"
dom.c:4643: Test failed: got L"_blank"
=== debian10 (32 bit French report) ===
mshtml:
dom.c:4643: Test failed: got L"_blank"
dom.c:4643: Test failed: got L"_blank"
=== debian10 (32 bit Japanese:Japan report) ===
mshtml:
dom.c:4643: Test failed: got L"_blank"
dom.c:4643: Test failed: got L"_blank"
=== debian10 (32 bit Chinese:China report) ===
mshtml:
dom.c:4643: Test failed: got L"_blank"
dom.c:4643: Test failed: got L"_blank"
=== debian10 (32 bit WoW report) ===
mshtml:
dom.c:4643: Test failed: got L"_blank"
dom.c:4643: Test failed: got L"_blank"
=== debian10 (64 bit WoW report) ===
mshtml:
dom.c:4643: Test failed: got L"_blank"
dom.c:4643: Test failed: got L"_blank"
Jan. 31, 2020
[PATCH v2] mshtml/tests: Get rid of strcmp_wa from dom.c.
by Jacek Caban
Signed-off-by: Jacek Caban <jacek(a)codeweavers.com>
---
dlls/mshtml/tests/dom.c | 1329 +++++++++++++++++++--------------------
1 file changed, 660 insertions(+), 669 deletions(-)
Jan. 31, 2020
[PATCH] mshtml/tests: Get rid of strcmp_wa from dom.c.
by Jacek Caban
Signed-off-by: Jacek Caban <jacek(a)codeweavers.com>
---
dlls/mshtml/tests/dom.c | 1329 +++++++++++++++++++--------------------
1 file changed, 660 insertions(+), 669 deletions(-)
Jan. 31, 2020