msvcrt: Fix C locale handling in mbstowcs.

Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Piotr Caban 2016-06-14 11:57:16 +02:00 committed by Alexandre Julliard
parent 7efd0c2c79
commit f091d9edf6
1 changed files with 11 additions and 0 deletions

View File

@ -2253,6 +2253,17 @@ MSVCRT_size_t CDECL MSVCRT__mbstowcs_l(MSVCRT_wchar_t *wcstr, const char *mbstr,
else else
locinfo = locale->locinfo; locinfo = locale->locinfo;
if(!locinfo->lc_codepage) {
if(!wcstr)
return strlen(mbstr);
for(i=0; i<count; i++) {
wcstr[i] = (unsigned char)mbstr[i];
if(!wcstr[i]) break;
}
return i;
}
/* Ignore count parameter */ /* Ignore count parameter */
if(!wcstr) if(!wcstr)
return MultiByteToWideChar(locinfo->lc_codepage, 0, mbstr, -1, NULL, 0)-1; return MultiByteToWideChar(locinfo->lc_codepage, 0, mbstr, -1, NULL, 0)-1;