Alexandre Julliard : libwine: Pass flags to wine_utf8_wcstombs to allow supporting WC_ERR_INVALID_CHARS.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Mar 15 08:19:16 CDT 2007


Module: wine
Branch: master
Commit: a79b26284aa318c691582878fac39295c1412f0f
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=a79b26284aa318c691582878fac39295c1412f0f

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Mar 14 15:57:50 2007 +0100

libwine: Pass flags to wine_utf8_wcstombs to allow supporting WC_ERR_INVALID_CHARS.

---

 dlls/kernel32/locale.c |    2 +-
 dlls/ntdll/rtlstr.c    |    2 +-
 include/wine/unicode.h |    2 +-
 libs/wine/utf8.c       |    4 ++--
 tools/wrc/utils.c      |    4 ++--
 5 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/dlls/kernel32/locale.c b/dlls/kernel32/locale.c
index 1c6e537..5b09793 100644
--- a/dlls/kernel32/locale.c
+++ b/dlls/kernel32/locale.c
@@ -1892,7 +1892,7 @@ INT WINAPI WideCharToMultiByte( UINT page, DWORD flags, LPCWSTR src, INT srclen,
         /* fall through */
     case CP_UTF8:
         if (used) *used = FALSE;  /* all chars are valid for UTF-8 */
-        ret = wine_utf8_wcstombs( src, srclen, dst, dstlen );
+        ret = wine_utf8_wcstombs( flags, src, srclen, dst, dstlen );
         break;
     default:
         if (!(table = get_codepage_table( page )))
diff --git a/dlls/ntdll/rtlstr.c b/dlls/ntdll/rtlstr.c
index 34336fd..2a54223 100644
--- a/dlls/ntdll/rtlstr.c
+++ b/dlls/ntdll/rtlstr.c
@@ -76,7 +76,7 @@ int ntdll_wcstoumbs(DWORD flags, const WCHAR* src, int srclen, char* dst, int ds
     if (unix_table)
         return wine_cp_wcstombs( unix_table, flags, src, srclen, dst, dstlen, defchar, used );
     if (used) *used = 0;  /* all chars are valid for UTF-8 */
-    return wine_utf8_wcstombs( src, srclen, dst, dstlen );
+    return wine_utf8_wcstombs( flags, src, srclen, dst, dstlen );
 }
 
 /**************************************************************************
diff --git a/include/wine/unicode.h b/include/wine/unicode.h
index 83a7d52..198b00b 100644
--- a/include/wine/unicode.h
+++ b/include/wine/unicode.h
@@ -86,7 +86,7 @@ extern int wine_cp_wcstombs( const union cptable *table, int flags,
 extern int wine_cpsymbol_mbstowcs( const char *src, int srclen, WCHAR *dst, int dstlen );
 extern int wine_cpsymbol_wcstombs( const WCHAR *src, int srclen, char *dst, int dstlen );
 extern int wine_utf8_mbstowcs( int flags, const char *src, int srclen, WCHAR *dst, int dstlen );
-extern int wine_utf8_wcstombs( const WCHAR *src, int srclen, char *dst, int dstlen );
+extern int wine_utf8_wcstombs( int flags, const WCHAR *src, int srclen, char *dst, int dstlen );
 
 extern int wine_compare_string( int flags, const WCHAR *str1, int len1, const WCHAR *str2, int len2 );
 extern int wine_get_sortkey( int flags, const WCHAR *src, int srclen, char *dst, int dstlen );
diff --git a/libs/wine/utf8.c b/libs/wine/utf8.c
index 334d7fc..be1c672 100644
--- a/libs/wine/utf8.c
+++ b/libs/wine/utf8.c
@@ -58,8 +58,8 @@ inline static int get_length_wcs_utf8( const WCHAR *src, unsigned int srclen )
 }
 
 /* wide char to UTF-8 string conversion */
-/* return -1 on dst buffer overflow */
-int wine_utf8_wcstombs( const WCHAR *src, int srclen, char *dst, int dstlen )
+/* return -1 on dst buffer overflow, -2 on invalid input char */
+int wine_utf8_wcstombs( int flags, const WCHAR *src, int srclen, char *dst, int dstlen )
 {
     int len;
 
diff --git a/tools/wrc/utils.c b/tools/wrc/utils.c
index 9e736d4..39d1764 100644
--- a/tools/wrc/utils.c
+++ b/tools/wrc/utils.c
@@ -270,12 +270,12 @@ string_t *convert_string(const string_t *str, enum str_e type, int codepage)
     {
         ret->type = str_char;
         ret->size = cptable ? wine_cp_wcstombs( cptable, 0, str->str.wstr, str->size, NULL, 0, NULL, NULL )
-                            : wine_utf8_wcstombs( str->str.wstr, str->size, NULL, 0 );
+                            : wine_utf8_wcstombs( 0, str->str.wstr, str->size, NULL, 0 );
         ret->str.cstr = xmalloc( ret->size + 1 );
         if (cptable)
             wine_cp_wcstombs( cptable, 0, str->str.wstr, str->size, ret->str.cstr, ret->size, NULL, NULL );
         else
-            wine_utf8_wcstombs( str->str.wstr, str->size, ret->str.cstr, ret->size );
+            wine_utf8_wcstombs( 0, str->str.wstr, str->size, ret->str.cstr, ret->size );
         ret->str.cstr[ret->size] = 0;
     }
     else if(str->type == str_unicode)




More information about the wine-cvs mailing list