Commit 18c3c2c7 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

ntdll: Return -1 from Unix code page conversion functions if an error was encountered.

If 0 is returned, the caller has no way of determining this. This fixes a test failure in kernel32:change introduced by f46fa9c9. Signed-off-by: 's avatarZebediah Figura <z.figura12@gmail.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent ce7e1086
...@@ -643,7 +643,7 @@ int ntdll_umbstowcs( DWORD flags, const char *src, int srclen, WCHAR *dst, int d ...@@ -643,7 +643,7 @@ int ntdll_umbstowcs( DWORD flags, const char *src, int srclen, WCHAR *dst, int d
if (!dstlen) dst = NULL; if (!dstlen) dst = NULL;
status = RtlUTF8ToUnicodeN( dst, dstlen * sizeof(WCHAR), &reslen, src, srclen ); status = RtlUTF8ToUnicodeN( dst, dstlen * sizeof(WCHAR), &reslen, src, srclen );
if (status && status != STATUS_SOME_NOT_MAPPED) return 0; if (status && status != STATUS_SOME_NOT_MAPPED) return -1;
reslen /= sizeof(WCHAR); reslen /= sizeof(WCHAR);
#ifdef __APPLE__ /* work around broken Mac OS X filesystem that enforces decomposed Unicode */ #ifdef __APPLE__ /* work around broken Mac OS X filesystem that enforces decomposed Unicode */
if (reslen && dst) RtlNormalizeString( NormalizationC, dst, reslen, dst, (int *)&reslen ); if (reslen && dst) RtlNormalizeString( NormalizationC, dst, reslen, dst, (int *)&reslen );
...@@ -666,7 +666,7 @@ int ntdll_wcstoumbs( DWORD flags, const WCHAR *src, int srclen, char *dst, int d ...@@ -666,7 +666,7 @@ int ntdll_wcstoumbs( DWORD flags, const WCHAR *src, int srclen, char *dst, int d
if (used) *used = 0; /* all chars are valid for UTF-8 */ if (used) *used = 0; /* all chars are valid for UTF-8 */
if (!dstlen) dst = NULL; if (!dstlen) dst = NULL;
status = RtlUnicodeToUTF8N( dst, dstlen, &reslen, src, srclen * sizeof(WCHAR) ); status = RtlUnicodeToUTF8N( dst, dstlen, &reslen, src, srclen * sizeof(WCHAR) );
if (status && status != STATUS_SOME_NOT_MAPPED) return 0; if (status && status != STATUS_SOME_NOT_MAPPED) return -1;
return reslen; return reslen;
} }
......
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