diff --git a/dlls/kernel32/locale.c b/dlls/kernel32/locale.c index 1c6e537b744..5b09793ba03 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 34336fdac08..2a5422333b0 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 83a7d52bff6..198b00b2fd0 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 334d7fc3b3e..be1c672a176 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 9e736d47abb..39d17641896 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)