msvcrt: Don't search for LCID in _setmbcp_l if it was already done.

This commit is contained in:
Piotr Caban 2011-10-26 14:10:22 +02:00 committed by Alexandre Julliard
parent df5d3e348a
commit 698afdca98
3 changed files with 11 additions and 6 deletions

View File

@ -842,7 +842,7 @@ MSVCRT__locale_t CDECL MSVCRT__create_locale(int category, const char *locale)
}
}
_setmbcp_l(loc->locinfo->lc_id[MSVCRT_LC_CTYPE].wCodePage, loc->mbcinfo);
_setmbcp_l(loc->locinfo->lc_id[MSVCRT_LC_CTYPE].wCodePage, lcid[MSVCRT_LC_CTYPE], loc->mbcinfo);
if(lcid[MSVCRT_LC_MONETARY] && (category==MSVCRT_LC_ALL || category==MSVCRT_LC_MONETARY)) {
if(update_threadlocinfo_category(lcid[MSVCRT_LC_MONETARY], loc, MSVCRT_LC_MONETARY)) {

View File

@ -184,7 +184,7 @@ int* CDECL ___mb_cur_max_l_func(MSVCRT__locale_t locale)
/*********************************************************************
* INTERNAL: _setmbcp_l
*/
int _setmbcp_l(int cp, MSVCRT_pthreadmbcinfo mbcinfo)
int _setmbcp_l(int cp, LCID lcid, MSVCRT_pthreadmbcinfo mbcinfo)
{
const char format[] = ".%d";
@ -222,8 +222,13 @@ int _setmbcp_l(int cp, MSVCRT_pthreadmbcinfo mbcinfo)
break;
}
sprintf(bufA, format, newcp);
mbcinfo->mblcid = MSVCRT_locale_to_LCID(bufA);
if(lcid == -1) {
sprintf(bufA, format, newcp);
mbcinfo->mblcid = MSVCRT_locale_to_LCID(bufA);
} else {
mbcinfo->mblcid = lcid;
}
if(mbcinfo->mblcid == -1)
{
WARN("Can't assign LCID to codepage (%d)\n", mbcinfo->mblcid);
@ -347,7 +352,7 @@ int _setmbcp_l(int cp, MSVCRT_pthreadmbcinfo mbcinfo)
*/
int CDECL _setmbcp(int cp)
{
return _setmbcp_l(cp, NULL);
return _setmbcp_l(cp, -1, NULL);
}
/*********************************************************************

View File

@ -888,7 +888,7 @@ MSVCRT_pthreadmbcinfo get_mbcinfo(void);
void __cdecl MSVCRT__free_locale(MSVCRT__locale_t);
void free_locinfo(MSVCRT_pthreadlocinfo);
void free_mbcinfo(MSVCRT_pthreadmbcinfo);
int _setmbcp_l(int, MSVCRT_pthreadmbcinfo);
int _setmbcp_l(int, LCID, MSVCRT_pthreadmbcinfo);
#ifndef __WINE_MSVCRT_TEST
int __cdecl MSVCRT__write(int,const void*,unsigned int);