Commit 6180c2fc authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

ucrtbase: Support UTF8 codepage in _wcstombs_l.

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