msvcrt: Fix C locale handling in wcstombs.

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:20 +02:00 committed by Alexandre Julliard
parent f091d9edf6
commit c4ab42d88c
1 changed files with 18 additions and 0 deletions

View File

@ -477,6 +477,24 @@ static MSVCRT_size_t MSVCRT_wcsrtombs_l(char *mbstr, const MSVCRT_wchar_t **wcst
else
locinfo = locale->locinfo;
if(!locinfo->lc_codepage) {
MSVCRT_size_t i;
if(!mbstr)
return strlenW(*wcstr);
for(i=0; i<count; i++) {
if((*wcstr)[i] > 255) {
*MSVCRT__errno() = MSVCRT_EILSEQ;
return -1;
}
mbstr[i] = (*wcstr)[i];
if(!(*wcstr)[i]) break;
}
return i;
}
if(!mbstr) {
tmp = WideCharToMultiByte(locinfo->lc_codepage, WC_NO_BEST_FIT_CHARS,
*wcstr, -1, NULL, 0, NULL, &used_default)-1;