Piotr Caban : ucrtbase: Support UTF8 codepage in wctomb.

Alexandre Julliard julliard at winehq.org
Mon Oct 19 15:54:06 CDT 2020


Module: wine
Branch: master
Commit: 5fcc3771681c0c8747f59d3ffe1a278b01f2a1df
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=5fcc3771681c0c8747f59d3ffe1a278b01f2a1df

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Mon Oct 19 19:35:50 2020 +0200

ucrtbase: Support UTF8 codepage in wctomb.

Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/msvcrt/wcs.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/dlls/msvcrt/wcs.c b/dlls/msvcrt/wcs.c
index ed843d6e58d..858ecbd7ed0 100644
--- a/dlls/msvcrt/wcs.c
+++ b/dlls/msvcrt/wcs.c
@@ -1996,15 +1996,18 @@ INT CDECL MSVCRT_wctomb( char *dst, MSVCRT_wchar_t ch )
 INT CDECL MSVCRT_wctob( MSVCRT_wint_t wchar )
 {
     char out;
-    BOOL error;
+    BOOL error = FALSE;
+    BOOL *perror;
     UINT codepage = get_locinfo()->lc_codepage;
 
+    perror = (codepage != CP_UTF8 ? &error : NULL);
+
     if(!codepage) {
         if (wchar < 0xff)
             return (signed char)wchar;
         else
             return MSVCRT_EOF;
-    } else if(WideCharToMultiByte( codepage, 0, &wchar, 1, &out, 1, NULL, &error ) && !error)
+    } else if(WideCharToMultiByte( codepage, 0, &wchar, 1, &out, 1, NULL, perror ) && !error)
         return (INT)out;
     return MSVCRT_EOF;
 }




More information about the wine-cvs mailing list