msvcrt: Don't set error in wcstombs_s_l if no characters to convert.

Signed-off-by: Daniel Lehman <dlehman@esri.com>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
feature/deterministic
Daniel Lehman 2020-02-03 12:06:10 -08:00 committed by Alexandre Julliard
parent 51b75e9a53
commit 4178972487
2 changed files with 3 additions and 3 deletions

View File

@ -2300,7 +2300,7 @@ static void test__wcstombs_s_l(void)
{ L"text", _TRUNCATE, "", 1, 1, STRUNCATE, NULL, FALSE, TRUE },
{ L"text", 5, "", 3, 0, ERANGE, NULL, TRUE },
{ L"", 0, NULL, 0, 1, 0, "English_United States.1252", TRUE, TRUE },
{ L"", 0, NULL, 0, 1, 0, "English_United States.1252" },
{ L"\xfffd", 1, NULL, 0, 0, EILSEQ, "English_United States.1252", TRUE },
{ L"\xfffd", 1, "", 1, 0, EILSEQ, "English_United States.1252", TRUE },
{ L"\xfffd", 1, "", 6, 0, EILSEQ, "English_United States.1252", TRUE },

View File

@ -459,12 +459,12 @@ static MSVCRT_size_t MSVCRT_wcsrtombs_l(char *mbstr, const MSVCRT_wchar_t **wcst
if(!mbstr) {
tmp = WideCharToMultiByte(locinfo->lc_codepage, WC_NO_BEST_FIT_CHARS,
*wcstr, -1, NULL, 0, NULL, &used_default)-1;
*wcstr, -1, NULL, 0, NULL, &used_default);
if(!tmp || used_default) {
*MSVCRT__errno() = MSVCRT_EILSEQ;
return -1;
}
return tmp;
return tmp-1;
}
while(**wcstr) {