Commit d1fa8b64 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

msvcrt: Use per thread locale in many functions.

parent 87dee43b
......@@ -62,7 +62,7 @@ WORD* MSVCRT__pctype;
*/
WORD** CDECL MSVCRT___pctype_func(void)
{
return &MSVCRT__pctype;
return &get_locale()->locinfo->pctype;
}
/*********************************************************************
......@@ -70,21 +70,23 @@ WORD** CDECL MSVCRT___pctype_func(void)
*/
int CDECL _isctype(int c, int type)
{
MSVCRT__locale_t locale = get_locale();
if (c >= -1 && c <= 255)
return MSVCRT__pctype[c] & type;
return locale->locinfo->pctype[c] & type;
if (MSVCRT___mb_cur_max != 1 && c > 0)
if (locale->locinfo->mb_cur_max != 1 && c > 0)
{
/* FIXME: Is there a faster way to do this? */
WORD typeInfo;
char convert[3], *pconv = convert;
if (MSVCRT__pctype[(UINT)c >> 8] & MSVCRT__LEADBYTE)
if (locale->locinfo->pctype[(UINT)c >> 8] & MSVCRT__LEADBYTE)
*pconv++ = (UINT)c >> 8;
*pconv++ = c & 0xff;
*pconv = 0;
/* FIXME: Use ctype LCID, not lc_all */
if (GetStringTypeExA(MSVCRT_locale->locinfo->lc_handle[MSVCRT_LC_CTYPE],
if (GetStringTypeExA(get_locale()->locinfo->lc_handle[MSVCRT_LC_CTYPE],
CT_CTYPE1, convert, convert[1] ? 2 : 1, &typeInfo))
return typeInfo & type;
}
......
......@@ -2467,7 +2467,7 @@ MSVCRT_wint_t CDECL MSVCRT_fgetwc(MSVCRT_FILE* file)
}
c = MSVCRT_fgetc(file);
if ((MSVCRT___mb_cur_max > 1) && MSVCRT_isleadbyte(c))
if ((get_locale()->locinfo->mb_cur_max > 1) && MSVCRT_isleadbyte(c))
{
FIXME("Treat Multibyte characters\n");
}
......
......@@ -526,7 +526,7 @@ int CDECL ___lc_codepage_func(void)
*/
int CDECL ___lc_collate_cp_func(void)
{
return MSVCRT___lc_collate_cp;
return get_locale()->locinfo->lc_collate_cp;
}
/* _free_locale - not exported in native msvcrt */
......
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