msvcrt: Fix mbcs initialization for UTF-8 codepage.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
29fe143544
commit
83a3a5c75b
|
@ -220,7 +220,7 @@ threadmbcinfo* create_mbcinfo(int cp, LCID lcid, threadmbcinfo *old_mbcinfo)
|
||||||
WORD chartypes[256];
|
WORD chartypes[256];
|
||||||
char bufA[256];
|
char bufA[256];
|
||||||
WCHAR bufW[256], lowW[256], upW[256];
|
WCHAR bufW[256], lowW[256], upW[256];
|
||||||
int charcount;
|
int charcount, maxchar;
|
||||||
int ret;
|
int ret;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -288,7 +288,7 @@ threadmbcinfo* create_mbcinfo(int cp, LCID lcid, threadmbcinfo *old_mbcinfo)
|
||||||
bytes += 2;
|
bytes += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cpi.MaxCharSize > 1)
|
if (cpi.MaxCharSize == 2)
|
||||||
{
|
{
|
||||||
/* trail bytes not available through kernel32 but stored in a structure in msvcrt */
|
/* trail bytes not available through kernel32 but stored in a structure in msvcrt */
|
||||||
struct cp_extra_info_t *cpextra = g_cpextrainfo;
|
struct cp_extra_info_t *cpextra = g_cpextrainfo;
|
||||||
|
@ -316,10 +316,12 @@ threadmbcinfo* create_mbcinfo(int cp, LCID lcid, threadmbcinfo *old_mbcinfo)
|
||||||
else
|
else
|
||||||
mbcinfo->ismbcodepage = 0;
|
mbcinfo->ismbcodepage = 0;
|
||||||
|
|
||||||
|
maxchar = (newcp == CP_UTF8) ? 128 : 256;
|
||||||
|
|
||||||
/* we can't use GetStringTypeA directly because we don't have a locale - only a code page
|
/* we can't use GetStringTypeA directly because we don't have a locale - only a code page
|
||||||
*/
|
*/
|
||||||
charcount = 0;
|
charcount = 0;
|
||||||
for (i = 0; i < 256; i++)
|
for (i = 0; i < maxchar; i++)
|
||||||
if (!(mbcinfo->mbctype[i + 1] & _M1))
|
if (!(mbcinfo->mbctype[i + 1] & _M1))
|
||||||
bufA[charcount++] = i;
|
bufA[charcount++] = i;
|
||||||
|
|
||||||
|
@ -335,7 +337,7 @@ threadmbcinfo* create_mbcinfo(int cp, LCID lcid, threadmbcinfo *old_mbcinfo)
|
||||||
LCMapStringW(lcid, LCMAP_UPPERCASE, bufW, charcount, upW, charcount);
|
LCMapStringW(lcid, LCMAP_UPPERCASE, bufW, charcount, upW, charcount);
|
||||||
|
|
||||||
charcount = 0;
|
charcount = 0;
|
||||||
for (i = 0; i < 256; i++)
|
for (i = 0; i < maxchar; i++)
|
||||||
if (!(mbcinfo->mbctype[i + 1] & _M1))
|
if (!(mbcinfo->mbctype[i + 1] & _M1))
|
||||||
{
|
{
|
||||||
if (chartypes[charcount] & C1_UPPER)
|
if (chartypes[charcount] & C1_UPPER)
|
||||||
|
@ -359,7 +361,7 @@ threadmbcinfo* create_mbcinfo(int cp, LCID lcid, threadmbcinfo *old_mbcinfo)
|
||||||
}
|
}
|
||||||
|
|
||||||
charcount = 0;
|
charcount = 0;
|
||||||
for (i = 0; i < 256; i++)
|
for (i = 0; i < maxchar; i++)
|
||||||
{
|
{
|
||||||
if(!(mbcinfo->mbctype[i + 1] & _M1))
|
if(!(mbcinfo->mbctype[i + 1] & _M1))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue