[PATCH 2/2] kernel32/locale: Don't fail with non-NULL args when the Unix codepage falls back to UTF-8.

Gabriel Ivăncescu gabrielopcode at gmail.com
Wed Sep 4 09:27:24 CDT 2019


Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
---

In my opinion, when using CP_UNIXCP, the caller shouldn't care whether it
fell back to UTF-8 or not, and it should not fail if the last two parameters
are non-NULL.

This should simplify caller code that uses CP_UNIXCP with a non-NULL 'used'
parameter.

 dlls/kernel32/locale.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/dlls/kernel32/locale.c b/dlls/kernel32/locale.c
index 2698b3d..1770319 100644
--- a/dlls/kernel32/locale.c
+++ b/dlls/kernel32/locale.c
@@ -2729,6 +2729,9 @@ INT WINAPI WideCharToMultiByte( UINT page, DWORD flags, LPCWSTR src, INT srclen,
             if (used) *used = used_tmp;
             break;
         }
+        if (used) *used = FALSE;
+        defchar = NULL;
+        used = NULL;
         /* fall through */
     case CP_UTF8:
         if (defchar || used)
-- 
2.21.0




More information about the wine-devel mailing list