ucrtbase: Support UTF8 codepage in _wcstombs_l.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50025
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Piotr Caban 2020-10-19 19:35:31 +02:00 committed by Alexandre Julliard
parent ab2a0d7f63
commit 6180c2fc83
1 changed files with 6 additions and 3 deletions

View File

@ -545,7 +545,8 @@ static MSVCRT_size_t MSVCRT_wcsrtombs_l(char *mbstr, const MSVCRT_wchar_t **wcst
{
MSVCRT_pthreadlocinfo locinfo;
MSVCRT_size_t tmp = 0;
BOOL used_default;
BOOL used_default = FALSE;
BOOL *pused_default;
if(!locale)
locinfo = get_locinfo();
@ -570,9 +571,11 @@ static MSVCRT_size_t MSVCRT_wcsrtombs_l(char *mbstr, const MSVCRT_wchar_t **wcst
return i;
}
pused_default = (locinfo->lc_codepage != CP_UTF8 ? &used_default : NULL);
if(!mbstr) {
tmp = WideCharToMultiByte(locinfo->lc_codepage, WC_NO_BEST_FIT_CHARS,
*wcstr, -1, NULL, 0, NULL, &used_default);
*wcstr, -1, NULL, 0, NULL, pused_default);
if(!tmp || used_default) {
*MSVCRT__errno() = MSVCRT_EILSEQ;
return -1;
@ -585,7 +588,7 @@ static MSVCRT_size_t MSVCRT_wcsrtombs_l(char *mbstr, const MSVCRT_wchar_t **wcst
MSVCRT_size_t i, size;
size = WideCharToMultiByte(locinfo->lc_codepage, WC_NO_BEST_FIT_CHARS,
*wcstr, 1, buf, 3, NULL, &used_default);
*wcstr, 1, buf, 3, NULL, pused_default);
if(!size || used_default) {
*MSVCRT__errno() = MSVCRT_EILSEQ;
return -1;