mirror of
https://github.com/reactos/wine.git
synced 2024-11-28 22:20:26 +00:00
msvcrt: Cache locale string to LCID conversion results.
This commit is contained in:
parent
b9557e9227
commit
e9eec98d5c
@ -217,10 +217,17 @@ extern int atoi(const char *);
|
||||
/* Internal: Find the LCID for a locale specification */
|
||||
LCID MSVCRT_locale_to_LCID(const char *locale, unsigned short *codepage)
|
||||
{
|
||||
thread_data_t *data = msvcrt_get_thread_data();
|
||||
LCID lcid;
|
||||
locale_search_t search;
|
||||
const char *cp, *region;
|
||||
|
||||
if (!strcmp(locale, data->cached_locale)) {
|
||||
if (codepage)
|
||||
*codepage = data->cached_cp;
|
||||
return data->cached_lcid;
|
||||
}
|
||||
|
||||
memset(&search, 0, sizeof(locale_search_t));
|
||||
|
||||
cp = strchr(locale, '.');
|
||||
@ -292,6 +299,12 @@ LCID MSVCRT_locale_to_LCID(const char *locale, unsigned short *codepage)
|
||||
if (codepage)
|
||||
*codepage = atoi(search.found_codepage);
|
||||
|
||||
if (strlen(locale) < sizeof(data->cached_locale)) {
|
||||
strcpy(data->cached_locale, locale);
|
||||
data->cached_lcid = lcid;
|
||||
data->cached_cp = codepage ? *codepage : atoi(search.found_codepage);
|
||||
}
|
||||
|
||||
return lcid;
|
||||
}
|
||||
|
||||
|
@ -237,7 +237,12 @@ struct __thread_data {
|
||||
void *unk6[3];
|
||||
int unk7;
|
||||
EXCEPTION_RECORD *exc_record;
|
||||
void *unk8[100];
|
||||
void *unk8[7];
|
||||
LCID cached_lcid;
|
||||
int unk9[3];
|
||||
DWORD cached_cp;
|
||||
char cached_locale[131];
|
||||
void *unk10[100];
|
||||
};
|
||||
|
||||
typedef struct __thread_data thread_data_t;
|
||||
|
Loading…
Reference in New Issue
Block a user