msvcrt: Don't overwrite mbcinfo inside setlocale.

This commit is contained in:
Piotr Caban 2011-10-12 11:54:53 +02:00 committed by Alexandre Julliard
parent e24438c1d1
commit cf27cb4927
3 changed files with 3 additions and 4 deletions

View file

@ -364,7 +364,7 @@ MSVCRT_pthreadlocinfo get_locinfo(void) {
}
/* INTERNAL: returns pthreadlocinfo struct */
static MSVCRT_pthreadmbcinfo get_mbcinfo(void) {
MSVCRT_pthreadmbcinfo get_mbcinfo(void) {
thread_data_t *data = msvcrt_get_thread_data();
if(!data || !data->have_locale)
@ -1172,8 +1172,6 @@ char* CDECL MSVCRT_setlocale(int category, const char* locale)
swap_pointers((void**)&locinfo->pclmap, (void**)&loc->locinfo->pclmap);
swap_pointers((void**)&locinfo->pcumap, (void**)&loc->locinfo->pcumap);
memcpy(get_mbcinfo(), loc->mbcinfo, sizeof(MSVCRT_threadmbcinfo));
if(category != MSVCRT_LC_ALL)
break;
/* fall through */
@ -1323,5 +1321,6 @@ BOOL msvcrt_init_locale(void)
MSVCRT__pctype = MSVCRT_locale->locinfo->pctype;
for(i=MSVCRT_LC_MIN; i<=MSVCRT_LC_MAX; i++)
MSVCRT___lc_handle[i] = MSVCRT_locale->locinfo->lc_handle[i];
_setmbcp(_MB_CP_ANSI);
return TRUE;
}

View file

@ -110,7 +110,6 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
msvcrt_init_console();
msvcrt_init_args();
msvcrt_init_signals();
_setmbcp(_MB_CP_LOCALE);
/* don't allow unloading msvcrt, we can't setup file handles twice */
LdrAddRefDll( 0, hinstDLL );
TRACE("finished process init\n");

View file

@ -883,6 +883,7 @@ int __cdecl MSVCRT_raise(int sig);
extern MSVCRT__locale_t MSVCRT_locale;
MSVCRT_pthreadlocinfo get_locinfo(void);
MSVCRT_pthreadmbcinfo get_mbcinfo(void);
void __cdecl MSVCRT__free_locale(MSVCRT__locale_t);
void free_locinfo(MSVCRT_pthreadlocinfo);
void free_mbcinfo(MSVCRT_pthreadmbcinfo);