Module: wine Branch: master Commit: 417897248735cfaabb2e440147bdc0f7816fb97c URL: https://source.winehq.org/git/wine.git/?a=commit;h=417897248735cfaabb2e44014...
Author: Daniel Lehman dlehman@esri.com Date: Mon Feb 3 12:06:10 2020 -0800
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
---
dlls/msvcrt/tests/string.c | 2 +- dlls/msvcrt/wcs.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/msvcrt/tests/string.c b/dlls/msvcrt/tests/string.c index 32e264908a..7d9b46b3e6 100644 --- a/dlls/msvcrt/tests/string.c +++ b/dlls/msvcrt/tests/string.c @@ -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 }, diff --git a/dlls/msvcrt/wcs.c b/dlls/msvcrt/wcs.c index 8411048204..64bc1f83d4 100644 --- a/dlls/msvcrt/wcs.c +++ b/dlls/msvcrt/wcs.c @@ -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) {