ntdll: Use the Rtl UTF8 conversion functions.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
27f0426b6f
commit
f46fa9c92d
|
@ -2834,20 +2834,15 @@ static NTSTATUS parse_manifest( struct actctx_loader* acl, struct assembly_ident
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* let's assume utf-8 for now */
|
DWORD len;
|
||||||
int len = wine_utf8_mbstowcs( 0, buffer, size, NULL, 0 );
|
|
||||||
WCHAR *new_buff;
|
WCHAR *new_buff;
|
||||||
|
|
||||||
if (len == -1)
|
/* let's assume utf-8 for now */
|
||||||
{
|
RtlUTF8ToUnicodeN( NULL, 0, &len, buffer, size );
|
||||||
FIXME( "utf-8 conversion failed\n" );
|
if (!(new_buff = RtlAllocateHeap( GetProcessHeap(), 0, len ))) return STATUS_NO_MEMORY;
|
||||||
return STATUS_SXS_CANT_GEN_ACTCTX;
|
RtlUTF8ToUnicodeN( new_buff, len, &len, buffer, size );
|
||||||
}
|
|
||||||
if (!(new_buff = RtlAllocateHeap( GetProcessHeap(), 0, len * sizeof(WCHAR) )))
|
|
||||||
return STATUS_NO_MEMORY;
|
|
||||||
wine_utf8_mbstowcs( 0, buffer, size, new_buff, len );
|
|
||||||
xmlbuf.ptr = new_buff;
|
xmlbuf.ptr = new_buff;
|
||||||
xmlbuf.end = xmlbuf.ptr + len;
|
xmlbuf.end = xmlbuf.ptr + len / sizeof(WCHAR);
|
||||||
status = parse_manifest_buffer( acl, assembly, ai, &xmlbuf );
|
status = parse_manifest_buffer( acl, assembly, ai, &xmlbuf );
|
||||||
RtlFreeHeap( GetProcessHeap(), 0, new_buff );
|
RtlFreeHeap( GetProcessHeap(), 0, new_buff );
|
||||||
}
|
}
|
||||||
|
|
|
@ -636,13 +636,19 @@ void init_locale( HMODULE module )
|
||||||
*/
|
*/
|
||||||
int ntdll_umbstowcs( DWORD flags, const char *src, int srclen, WCHAR *dst, int dstlen )
|
int ntdll_umbstowcs( DWORD flags, const char *src, int srclen, WCHAR *dst, int dstlen )
|
||||||
{
|
{
|
||||||
#ifdef __APPLE__
|
DWORD reslen;
|
||||||
/* work around broken Mac OS X filesystem that enforces decomposed Unicode */
|
NTSTATUS status;
|
||||||
flags |= MB_COMPOSITE;
|
|
||||||
|
if (unix_table) return wine_cp_mbstowcs( unix_table, flags, src, srclen, dst, dstlen );
|
||||||
|
|
||||||
|
if (!dstlen) dst = NULL;
|
||||||
|
status = RtlUTF8ToUnicodeN( dst, dstlen * sizeof(WCHAR), &reslen, src, srclen );
|
||||||
|
if (status && status != STATUS_SOME_NOT_MAPPED) return 0;
|
||||||
|
reslen /= sizeof(WCHAR);
|
||||||
|
#ifdef __APPLE__ /* work around broken Mac OS X filesystem that enforces decomposed Unicode */
|
||||||
|
if (reslen && dst) RtlNormalizeString( NormalizationC, dst, reslen, dst, (int *)&reslen );
|
||||||
#endif
|
#endif
|
||||||
return unix_table ?
|
return reslen;
|
||||||
wine_cp_mbstowcs( unix_table, flags, src, srclen, dst, dstlen ) :
|
|
||||||
wine_utf8_mbstowcs( flags, src, srclen, dst, dstlen );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -652,10 +658,16 @@ int ntdll_umbstowcs( DWORD flags, const char *src, int srclen, WCHAR *dst, int d
|
||||||
int ntdll_wcstoumbs( DWORD flags, const WCHAR *src, int srclen, char *dst, int dstlen,
|
int ntdll_wcstoumbs( DWORD flags, const WCHAR *src, int srclen, char *dst, int dstlen,
|
||||||
const char *defchar, int *used )
|
const char *defchar, int *used )
|
||||||
{
|
{
|
||||||
if (unix_table)
|
DWORD reslen;
|
||||||
return wine_cp_wcstombs( unix_table, flags, src, srclen, dst, dstlen, defchar, used );
|
NTSTATUS status;
|
||||||
|
|
||||||
|
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 */
|
if (used) *used = 0; /* all chars are valid for UTF-8 */
|
||||||
return wine_utf8_wcstombs( flags, src, srclen, dst, dstlen );
|
if (!dstlen) dst = NULL;
|
||||||
|
status = RtlUnicodeToUTF8N( dst, dstlen, &reslen, src, srclen * sizeof(WCHAR) );
|
||||||
|
if (status && status != STATUS_SOME_NOT_MAPPED) return 0;
|
||||||
|
return reslen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue