Commit a79b2628 authored by Alexandre Julliard's avatar Alexandre Julliard

libwine: Pass flags to wine_utf8_wcstombs to allow supporting WC_ERR_INVALID_CHARS.

parent e13c9cd6
......@@ -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 )))
......
......@@ -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 );
}
/**************************************************************************
......
......@@ -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 );
......
......@@ -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;
......
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment