Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- dlls/kernel32/tests/codepage.c | 187 ++++++++++++++++++++-------------------- 1 file changed, 94 insertions(+), 93 deletions(-)
diff --git a/dlls/kernel32/tests/codepage.c b/dlls/kernel32/tests/codepage.c index 42e49888e05..e8fc2a0891d 100644 --- a/dlls/kernel32/tests/codepage.c +++ b/dlls/kernel32/tests/codepage.c @@ -18,6 +18,7 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#undef WINE_NO_LONG_TYPES /* temporary for migration */
#include <stdarg.h> #include <stdio.h> @@ -40,7 +41,7 @@ static void test_destination_buffer(void)
SetLastError(0xdeadbeef); needed = WideCharToMultiByte(CP_ACP, 0, foobarW, -1, NULL, 0, NULL, NULL); - ok( (needed > 0), "returned %d with %u (expected '> 0')\n", + ok( (needed > 0), "returned %d with %lu (expected '> 0')\n", needed, GetLastError());
maxsize = needed*2; @@ -52,14 +53,14 @@ static void test_destination_buffer(void) buffer[maxsize] = '\0'; SetLastError(0xdeadbeef); len = WideCharToMultiByte(CP_ACP, 0, foobarW, -1, buffer, needed+1, NULL, NULL); - ok( (len > 0), "returned %d with %u and '%s' (expected '> 0')\n", + ok( (len > 0), "returned %d with %lu and '%s' (expected '> 0')\n", len, GetLastError(), buffer);
memset(buffer, 'x', maxsize); buffer[maxsize] = '\0'; SetLastError(0xdeadbeef); len = WideCharToMultiByte(CP_ACP, 0, foobarW, -1, buffer, needed, NULL, NULL); - ok( (len > 0), "returned %d with %u and '%s' (expected '> 0')\n", + ok( (len > 0), "returned %d with %lu and '%s' (expected '> 0')\n", len, GetLastError(), buffer);
memset(buffer, 'x', maxsize); @@ -67,7 +68,7 @@ static void test_destination_buffer(void) SetLastError(0xdeadbeef); len = WideCharToMultiByte(CP_ACP, 0, foobarW, -1, buffer, needed-1, NULL, NULL); ok( !len && (GetLastError() == ERROR_INSUFFICIENT_BUFFER), - "returned %d with %u and '%s' (expected '0' with " + "returned %d with %lu and '%s' (expected '0' with " "ERROR_INSUFFICIENT_BUFFER)\n", len, GetLastError(), buffer);
memset(buffer, 'x', maxsize); @@ -75,18 +76,18 @@ static void test_destination_buffer(void) SetLastError(0xdeadbeef); len = WideCharToMultiByte(CP_ACP, 0, foobarW, -1, buffer, 1, NULL, NULL); ok( !len && (GetLastError() == ERROR_INSUFFICIENT_BUFFER), - "returned %d with %u and '%s' (expected '0' with " + "returned %d with %lu and '%s' (expected '0' with " "ERROR_INSUFFICIENT_BUFFER)\n", len, GetLastError(), buffer);
SetLastError(0xdeadbeef); len = WideCharToMultiByte(CP_ACP, 0, foobarW, -1, buffer, 0, NULL, NULL); - ok( (len > 0), "returned %d with %u (expected '> 0')\n", + ok( (len > 0), "returned %d with %lu (expected '> 0')\n", len, GetLastError());
SetLastError(0xdeadbeef); len = WideCharToMultiByte(CP_ACP, 0, foobarW, -1, NULL, needed, NULL, NULL); ok( !len && (GetLastError() == ERROR_INVALID_PARAMETER), - "returned %d with %u (expected '0' with " + "returned %d with %lu (expected '0' with " "ERROR_INVALID_PARAMETER)\n", len, GetLastError());
HeapFree(GetProcessHeap(), 0, buffer); @@ -102,14 +103,14 @@ static void test_null_source(void) len = WideCharToMultiByte(CP_ACP, 0, NULL, 0, NULL, 0, NULL, NULL); GLE = GetLastError(); ok(!len && GLE == ERROR_INVALID_PARAMETER, - "WideCharToMultiByte returned %d with GLE=%u (expected 0 with ERROR_INVALID_PARAMETER)\n", + "WideCharToMultiByte returned %d with GLE=%lu (expected 0 with ERROR_INVALID_PARAMETER)\n", len, GLE);
SetLastError(0); len = WideCharToMultiByte(CP_ACP, 0, NULL, -1, NULL, 0, NULL, NULL); GLE = GetLastError(); ok(!len && GLE == ERROR_INVALID_PARAMETER, - "WideCharToMultiByte returned %d with GLE=%u (expected 0 with ERROR_INVALID_PARAMETER)\n", + "WideCharToMultiByte returned %d with GLE=%lu (expected 0 with ERROR_INVALID_PARAMETER)\n", len, GLE); }
@@ -124,7 +125,7 @@ static void test_negative_source_length(void) memset(buf,'x',sizeof(buf)); len = WideCharToMultiByte(CP_ACP, 0, foobarW, -2002, buf, 10, NULL, NULL); ok(len == 7 && GetLastError() == 0xdeadbeef, - "WideCharToMultiByte(-2002): len=%d error=%u\n", len, GetLastError()); + "WideCharToMultiByte(-2002): len=%d error=%lu\n", len, GetLastError()); ok(!lstrcmpA(buf, "foobar"), "WideCharToMultiByte(-2002): expected "foobar" got "%s"\n", buf);
@@ -132,13 +133,13 @@ static void test_negative_source_length(void) memset(bufW,'x',sizeof(bufW)); len = MultiByteToWideChar(CP_ACP, 0, "foobar", -2002, bufW, 10); ok(len == 7 && !lstrcmpW(bufW, foobarW) && GetLastError() == 0xdeadbeef, - "MultiByteToWideChar(-2002): len=%d error=%u\n", len, GetLastError()); + "MultiByteToWideChar(-2002): len=%d error=%lu\n", len, GetLastError());
SetLastError(0xdeadbeef); memset(bufW, 'x', sizeof(bufW)); len = MultiByteToWideChar(CP_ACP, 0, "foobar", -1, bufW, 6); ok(len == 0 && GetLastError() == ERROR_INSUFFICIENT_BUFFER, - "MultiByteToWideChar(-1): len=%d error=%u\n", len, GetLastError()); + "MultiByteToWideChar(-1): len=%d error=%lu\n", len, GetLastError()); }
#define LONGBUFLEN 100000 @@ -156,33 +157,33 @@ static void test_negative_dest_length(void) memset(bufA,'x',sizeof(bufA)); len = WideCharToMultiByte(CP_ACP, 0, foobarW, -1, bufA, -1, NULL, NULL); ok(len == 0 && GetLastError() == ERROR_INVALID_PARAMETER, - "WideCharToMultiByte(destlen -1): len=%d error=%x\n", len, GetLastError()); + "WideCharToMultiByte(destlen -1): len=%d error=%lx\n", len, GetLastError());
SetLastError( 0xdeadbeef ); memset(bufW,'x',sizeof(bufW)); len = MultiByteToWideChar(CP_ACP, 0, foobarA, -1, bufW, -1); ok(len == 0 && GetLastError() == ERROR_INVALID_PARAMETER, - "MultiByteToWideChar(destlen -1): len=%d error=%x\n", len, GetLastError()); + "MultiByteToWideChar(destlen -1): len=%d error=%lx\n", len, GetLastError());
/* Test return on -1000 dest length */ SetLastError( 0xdeadbeef ); memset(bufA,'x',sizeof(bufA)); len = WideCharToMultiByte(CP_ACP, 0, foobarW, -1, bufA, -1000, NULL, NULL); ok(len == 0 && GetLastError() == ERROR_INVALID_PARAMETER, - "WideCharToMultiByte(destlen -1000): len=%d error=%x\n", len, GetLastError()); + "WideCharToMultiByte(destlen -1000): len=%d error=%lx\n", len, GetLastError());
SetLastError( 0xdeadbeef ); memset(bufW,'x',sizeof(bufW)); len = MultiByteToWideChar(CP_ACP, 0, foobarA, -1000, bufW, -1); ok(len == 0 && GetLastError() == ERROR_INVALID_PARAMETER, - "MultiByteToWideChar(destlen -1000): len=%d error=%x\n", len, GetLastError()); + "MultiByteToWideChar(destlen -1000): len=%d error=%lx\n", len, GetLastError());
/* Test return on INT_MAX dest length */ SetLastError( 0xdeadbeef ); memset(bufA,'x',sizeof(bufA)); len = WideCharToMultiByte(CP_ACP, 0, foobarW, -1, bufA, INT_MAX, NULL, NULL); ok(len == 7 && !lstrcmpA(bufA, "foobar") && GetLastError() == 0xdeadbeef, - "WideCharToMultiByte(destlen INT_MAX): len=%d error=%x\n", len, GetLastError()); + "WideCharToMultiByte(destlen INT_MAX): len=%d error=%lx\n", len, GetLastError());
/* Test return on INT_MAX dest length and very long input */ SetLastError( 0xdeadbeef ); @@ -196,7 +197,7 @@ static void test_negative_dest_length(void) len = WideCharToMultiByte(CP_ACP, 0, originalW, -1, bufA, INT_MAX, NULL, NULL); theError = GetLastError(); ok(len == LONGBUFLEN && !lstrcmpA(bufA, originalA) && theError == 0xdeadbeef, - "WideCharToMultiByte(srclen %d, destlen INT_MAX): len %d error=%x\n", LONGBUFLEN, len, theError); + "WideCharToMultiByte(srclen %d, destlen INT_MAX): len %d error=%lx\n", LONGBUFLEN, len, theError);
}
@@ -212,87 +213,87 @@ static void test_other_invalid_parameters(void) /* Unrecognized flag => ERROR_INVALID_FLAGS */ SetLastError(0xdeadbeef); len = WideCharToMultiByte(CP_ACP, 0x100, w_string, -1, c_string, c_string_len, NULL, NULL); - ok(len == 0 && GetLastError() == ERROR_INVALID_FLAGS, "len=%d error=%x\n", len, GetLastError()); + ok(len == 0 && GetLastError() == ERROR_INVALID_FLAGS, "len=%d error=%lx\n", len, GetLastError());
SetLastError(0xdeadbeef); len = WideCharToMultiByte(CP_ACP, 0x800, w_string, -1, c_string, c_string_len, NULL, NULL); - ok(len == 0 && GetLastError() == ERROR_INVALID_FLAGS, "len=%d error=%x\n", len, GetLastError()); + ok(len == 0 && GetLastError() == ERROR_INVALID_FLAGS, "len=%d error=%lx\n", len, GetLastError());
SetLastError(0xdeadbeef); len = MultiByteToWideChar(CP_ACP, 0x10, c_string, -1, w_string, w_string_len); - ok(len == 0 && GetLastError() == ERROR_INVALID_FLAGS, "len=%d error=%x\n", len, GetLastError()); + ok(len == 0 && GetLastError() == ERROR_INVALID_FLAGS, "len=%d error=%lx\n", len, GetLastError());
/* Unrecognized flag and invalid codepage => ERROR_INVALID_PARAMETER */ SetLastError(0xdeadbeef); len = WideCharToMultiByte(0xdeadbeef, 0x100, w_string, w_string_len, c_string, c_string_len, NULL, NULL); - ok(len == 0 && GetLastError() == ERROR_INVALID_PARAMETER, "len=%d error=%x\n", len, GetLastError()); + ok(len == 0 && GetLastError() == ERROR_INVALID_PARAMETER, "len=%d error=%lx\n", len, GetLastError());
SetLastError(0xdeadbeef); len = MultiByteToWideChar(0xdeadbeef, 0x10, c_string, c_string_len, w_string, w_string_len); - ok(len == 0 && GetLastError() == ERROR_INVALID_PARAMETER, "len=%d error=%x\n", len, GetLastError()); + ok(len == 0 && GetLastError() == ERROR_INVALID_PARAMETER, "len=%d error=%lx\n", len, GetLastError());
/* Unrecognized flag and src is NULL => ERROR_INVALID_PARAMETER */ SetLastError(0xdeadbeef); len = WideCharToMultiByte(CP_ACP, 0x100, NULL, -1, c_string, c_string_len, NULL, NULL); - ok(len == 0 && GetLastError() == ERROR_INVALID_PARAMETER, "len=%d error=%x\n", len, GetLastError()); + ok(len == 0 && GetLastError() == ERROR_INVALID_PARAMETER, "len=%d error=%lx\n", len, GetLastError());
SetLastError(0xdeadbeef); len = MultiByteToWideChar(CP_ACP, 0x10, NULL, -1, w_string, w_string_len); - ok(len == 0 && GetLastError() == ERROR_INVALID_PARAMETER, "len=%d error=%x\n", len, GetLastError()); + ok(len == 0 && GetLastError() == ERROR_INVALID_PARAMETER, "len=%d error=%lx\n", len, GetLastError());
/* srclen=0 => ERROR_INVALID_PARAMETER */ SetLastError(0xdeadbeef); len = WideCharToMultiByte(CP_ACP, 0, w_string, 0, c_string, c_string_len, NULL, NULL); - ok(len == 0 && GetLastError() == ERROR_INVALID_PARAMETER, "len=%d error=%x\n", len, GetLastError()); + ok(len == 0 && GetLastError() == ERROR_INVALID_PARAMETER, "len=%d error=%lx\n", len, GetLastError());
SetLastError(0xdeadbeef); len = MultiByteToWideChar(CP_ACP, 0, c_string, 0, w_string, w_string_len); - ok(len == 0 && GetLastError() == ERROR_INVALID_PARAMETER, "len=%d error=%x\n", len, GetLastError()); + ok(len == 0 && GetLastError() == ERROR_INVALID_PARAMETER, "len=%d error=%lx\n", len, GetLastError());
/* dst=NULL but dstlen not 0 => ERROR_INVALID_PARAMETER */ SetLastError(0xdeadbeef); len = WideCharToMultiByte(CP_ACP, 0, w_string, w_string_len, NULL, c_string_len, NULL, NULL); - ok(len == 0 && GetLastError() == ERROR_INVALID_PARAMETER, "len=%d error=%x\n", len, GetLastError()); + ok(len == 0 && GetLastError() == ERROR_INVALID_PARAMETER, "len=%d error=%lx\n", len, GetLastError());
SetLastError(0xdeadbeef); len = MultiByteToWideChar(CP_ACP, 0, c_string, c_string_len, NULL, w_string_len); - ok(len == 0 && GetLastError() == ERROR_INVALID_PARAMETER, "len=%d error=%x\n", len, GetLastError()); + ok(len == 0 && GetLastError() == ERROR_INVALID_PARAMETER, "len=%d error=%lx\n", len, GetLastError());
/* CP_UTF7, CP_UTF8, or CP_SYMBOL and defchar not NULL => ERROR_INVALID_PARAMETER */ /* CP_SYMBOL's behavior here is undocumented */ SetLastError(0xdeadbeef); len = WideCharToMultiByte(CP_UTF7, 0, w_string, w_string_len, c_string, c_string_len, c_string, NULL); - ok(len == 0 && GetLastError() == ERROR_INVALID_PARAMETER, "len=%d error=%x\n", len, GetLastError()); + ok(len == 0 && GetLastError() == ERROR_INVALID_PARAMETER, "len=%d error=%lx\n", len, GetLastError());
SetLastError(0xdeadbeef); len = WideCharToMultiByte(CP_UTF8, 0, w_string, w_string_len, c_string, c_string_len, c_string, NULL); ok((len == 0 && GetLastError() == ERROR_INVALID_PARAMETER) - || broken(len == 12) /* Win10 1709+ */, "len=%d error=%x\n", len, GetLastError()); + || broken(len == 12) /* Win10 1709+ */, "len=%d error=%lx\n", len, GetLastError());
SetLastError(0xdeadbeef); len = WideCharToMultiByte(CP_SYMBOL, 0, w_string, w_string_len, c_string, c_string_len, c_string, NULL); - ok(len == 0 && GetLastError() == ERROR_INVALID_PARAMETER, "len=%d error=%x\n", len, GetLastError()); + ok(len == 0 && GetLastError() == ERROR_INVALID_PARAMETER, "len=%d error=%lx\n", len, GetLastError());
/* CP_UTF7, CP_UTF8, or CP_SYMBOL and used not NULL => ERROR_INVALID_PARAMETER */ /* CP_SYMBOL's behavior here is undocumented */ SetLastError(0xdeadbeef); len = WideCharToMultiByte(CP_UTF7, 0, w_string, w_string_len, c_string, c_string_len, NULL, &used); - ok(len == 0 && GetLastError() == ERROR_INVALID_PARAMETER, "len=%d error=%x\n", len, GetLastError()); + ok(len == 0 && GetLastError() == ERROR_INVALID_PARAMETER, "len=%d error=%lx\n", len, GetLastError());
SetLastError(0xdeadbeef); len = WideCharToMultiByte(CP_UTF8, 0, w_string, w_string_len, c_string, c_string_len, NULL, &used); ok((len == 0 && GetLastError() == ERROR_INVALID_PARAMETER) - || broken(len == 12) /* Win10 1709+ */, "len=%d error=%x\n", len, GetLastError()); + || broken(len == 12) /* Win10 1709+ */, "len=%d error=%lx\n", len, GetLastError());
SetLastError(0xdeadbeef); len = WideCharToMultiByte(CP_SYMBOL, 0, w_string, w_string_len, c_string, c_string_len, NULL, &used); - ok(len == 0 && GetLastError() == ERROR_INVALID_PARAMETER, "len=%d error=%x\n", len, GetLastError()); + ok(len == 0 && GetLastError() == ERROR_INVALID_PARAMETER, "len=%d error=%lx\n", len, GetLastError());
/* CP_UTF7, flags not 0 and used not NULL => ERROR_INVALID_PARAMETER */ @@ -301,14 +302,14 @@ static void test_other_invalid_parameters(void) instead except on Windows NT4 */ SetLastError(0xdeadbeef); len = WideCharToMultiByte(CP_UTF7, 1, w_string, w_string_len, c_string, c_string_len, NULL, &used); - ok(len == 0 && GetLastError() == ERROR_INVALID_PARAMETER, "len=%d error=%x\n", len, GetLastError()); + ok(len == 0 && GetLastError() == ERROR_INVALID_PARAMETER, "len=%d error=%lx\n", len, GetLastError());
/* CP_UTF8, unrecognized flag and used not NULL => ERROR_INVALID_PARAMETER */ SetLastError(0xdeadbeef); len = WideCharToMultiByte(CP_UTF8, 0x100, w_string, w_string_len, c_string, c_string_len, NULL, &used); ok(len == 0, "wrong ret %d\n", len); ok(GetLastError() == ERROR_INVALID_PARAMETER - || GetLastError() == ERROR_INVALID_FLAGS /* Win10 1709+ */, "wrong error %u\n", GetLastError()); + || GetLastError() == ERROR_INVALID_FLAGS /* Win10 1709+ */, "wrong error %lu\n", GetLastError()); }
static void test_overlapped_buffers(void) @@ -326,14 +327,14 @@ static void test_overlapped_buffers(void) ret = WideCharToMultiByte(CP_ACP, 0, (WCHAR *)(buf + 1), -1, buf, sizeof(buf), NULL, NULL); ok(ret == sizeof(strA), "unexpected ret %d\n", ret); ok(!memcmp(buf, strA, sizeof(strA)), "conversion failed: %s\n", buf); - ok(GetLastError() == 0xdeadbeef, "GetLastError() is %u\n", GetLastError()); + ok(GetLastError() == 0xdeadbeef, "GetLastError() is %lu\n", GetLastError());
SetLastError(0xdeadbeef); memcpy(buf + overlap_limit, strA, sizeof(strA)); ret = MultiByteToWideChar(CP_ACP, 0, buf + overlap_limit, -1, (WCHAR *)buf, sizeof(buf) / sizeof(WCHAR)); ok(ret == ARRAY_SIZE(strW), "unexpected ret %d\n", ret); ok(!memcmp(buf, strW, sizeof(strW)), "conversion failed: %s\n", wine_dbgstr_wn((WCHAR *)buf, ARRAY_SIZE(strW))); - ok(GetLastError() == 0xdeadbeef, "GetLastError() is %u\n", GetLastError()); + ok(GetLastError() == 0xdeadbeef, "GetLastError() is %lu\n", GetLastError()); }
static void test_string_conversion(LPBOOL bUsedDefaultChar) @@ -353,14 +354,14 @@ static void test_string_conversion(LPBOOL bUsedDefaultChar) ok(ret == 1, "ret is %d\n", ret); ok(mbc == '\xe4', "mbc is %d\n", mbc); if(bUsedDefaultChar) ok(*bUsedDefaultChar == FALSE, "bUsedDefaultChar is %d\n", *bUsedDefaultChar); - ok(GetLastError() == 0xdeadbeef, "GetLastError() is %u\n", GetLastError()); + ok(GetLastError() == 0xdeadbeef, "GetLastError() is %lu\n", GetLastError());
SetLastError(0xdeadbeef); ret = WideCharToMultiByte(1252, 0, &wc2, 1, &mbc, 1, NULL, bUsedDefaultChar); ok(ret == 1, "ret is %d\n", ret); ok(mbc == 63, "mbc is %d\n", mbc); if(bUsedDefaultChar) ok(*bUsedDefaultChar == TRUE, "bUsedDefaultChar is %d\n", *bUsedDefaultChar); - ok(GetLastError() == 0xdeadbeef, "GetLastError() is %u\n", GetLastError()); + ok(GetLastError() == 0xdeadbeef, "GetLastError() is %lu\n", GetLastError());
if (IsValidCodePage(1251)) { @@ -371,14 +372,14 @@ static void test_string_conversion(LPBOOL bUsedDefaultChar) if(bUsedDefaultChar) ok(*bUsedDefaultChar == FALSE, "bUsedDefaultChar is %d\n", *bUsedDefaultChar); ok(GetLastError() == 0xdeadbeef || broken(GetLastError() == 0), /* win95 */ - "GetLastError() is %u\n", GetLastError()); + "GetLastError() is %lu\n", GetLastError());
SetLastError(0xdeadbeef); ret = WideCharToMultiByte(1251, 0, &wc1, 1, &mbc, 1, NULL, bUsedDefaultChar); ok(ret == 1, "ret is %d\n", ret); ok(mbc == 97, "mbc is %d\n", mbc); if(bUsedDefaultChar) ok(*bUsedDefaultChar == FALSE, "bUsedDefaultChar is %d\n", *bUsedDefaultChar); - ok(GetLastError() == 0xdeadbeef, "GetLastError() is %u\n", GetLastError()); + ok(GetLastError() == 0xdeadbeef, "GetLastError() is %lu\n", GetLastError()); } else skip("Codepage 1251 not available\n"); @@ -389,14 +390,14 @@ static void test_string_conversion(LPBOOL bUsedDefaultChar) ok(ret == 0, "ret is %d\n", ret); ok(mbc == 84, "mbc is %d\n", mbc); if(bUsedDefaultChar) ok(*bUsedDefaultChar == FALSE, "bUsedDefaultChar is %d\n", *bUsedDefaultChar); - ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "GetLastError() is %u\n", GetLastError()); + ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "GetLastError() is %lu\n", GetLastError());
SetLastError(0xdeadbeef); ret = WideCharToMultiByte(1252, 0, wcs, -1, mbs, sizeof(mbs), NULL, bUsedDefaultChar); ok(ret == 5, "ret is %d\n", ret); ok(!strcmp(mbs, "Th?i"), "mbs is %s\n", mbs); if(bUsedDefaultChar) ok(*bUsedDefaultChar == TRUE, "bUsedDefaultChar is %d\n", *bUsedDefaultChar); - ok(GetLastError() == 0xdeadbeef, "GetLastError() is %u\n", GetLastError()); + ok(GetLastError() == 0xdeadbeef, "GetLastError() is %lu\n", GetLastError()); mbs[0] = 0;
/* WideCharToMultiByte mustn't add any null character automatically. @@ -406,7 +407,7 @@ static void test_string_conversion(LPBOOL bUsedDefaultChar) ok(ret == 3, "ret is %d\n", ret); ok(!strcmp(mbs, "Th?i"), "mbs is %s\n", mbs); if(bUsedDefaultChar) ok(*bUsedDefaultChar == TRUE, "bUsedDefaultChar is %d\n", *bUsedDefaultChar); - ok(GetLastError() == 0xdeadbeef, "GetLastError() is %u\n", GetLastError()); + ok(GetLastError() == 0xdeadbeef, "GetLastError() is %lu\n", GetLastError()); ZeroMemory(mbs, 5);
/* Now this shouldn't be the case like above as we zeroed the complete string buffer. */ @@ -415,7 +416,7 @@ static void test_string_conversion(LPBOOL bUsedDefaultChar) ok(ret == 3, "ret is %d\n", ret); ok(!strcmp(mbs, "Th?"), "mbs is %s\n", mbs); if(bUsedDefaultChar) ok(*bUsedDefaultChar == TRUE, "bUsedDefaultChar is %d\n", *bUsedDefaultChar); - ok(GetLastError() == 0xdeadbeef, "GetLastError() is %u\n", GetLastError()); + ok(GetLastError() == 0xdeadbeef, "GetLastError() is %lu\n", GetLastError());
/* Double-byte tests */ ret = WideCharToMultiByte(1252, 0, dbwcs, 3, mbs, sizeof(mbs), NULL, bUsedDefaultChar); @@ -433,13 +434,13 @@ static void test_string_conversion(LPBOOL bUsedDefaultChar) ret = WideCharToMultiByte(1252, 0, &wc2, 1, NULL, 0, NULL, bUsedDefaultChar); ok(ret == 1, "ret is %d\n", ret); if(bUsedDefaultChar) ok(*bUsedDefaultChar == TRUE, "bUsedDefaultChar is %d\n", *bUsedDefaultChar); - ok(GetLastError() == 0xdeadbeef, "GetLastError() is %u\n", GetLastError()); + ok(GetLastError() == 0xdeadbeef, "GetLastError() is %lu\n", GetLastError());
SetLastError(0xdeadbeef); ret = WideCharToMultiByte(1252, 0, wcs, -1, NULL, 0, NULL, bUsedDefaultChar); ok(ret == 5, "ret is %d\n", ret); if(bUsedDefaultChar) ok(*bUsedDefaultChar == TRUE, "bUsedDefaultChar is %d\n", *bUsedDefaultChar); - ok(GetLastError() == 0xdeadbeef, "GetLastError() is %u\n", GetLastError()); + ok(GetLastError() == 0xdeadbeef, "GetLastError() is %lu\n", GetLastError());
if (!IsValidCodePage(950)) { @@ -453,13 +454,13 @@ static void test_string_conversion(LPBOOL bUsedDefaultChar) ok(ret == 5, "ret is %d\n", ret); ok(!strcmp(mbs, "\xb5H\xa9\xd2"), "mbs is %s\n", mbs); if(bUsedDefaultChar) ok(*bUsedDefaultChar == FALSE, "bUsedDefaultChar is %d\n", *bUsedDefaultChar); - ok(GetLastError() == 0xdeadbeef, "GetLastError() is %u\n", GetLastError()); + ok(GetLastError() == 0xdeadbeef, "GetLastError() is %lu\n", GetLastError());
SetLastError(0xdeadbeef); ret = WideCharToMultiByte(950, 0, dbwcs, 1, &mbc, 1, NULL, bUsedDefaultChar); ok(ret == 0, "ret is %d\n", ret); if(bUsedDefaultChar) ok(*bUsedDefaultChar == FALSE, "bUsedDefaultChar is %d\n", *bUsedDefaultChar); - ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "GetLastError() is %u\n", GetLastError()); + ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "GetLastError() is %lu\n", GetLastError()); ZeroMemory(mbs, 5);
SetLastError(0xdeadbeef); @@ -467,20 +468,20 @@ static void test_string_conversion(LPBOOL bUsedDefaultChar) ok(ret == 2, "ret is %d\n", ret); ok(!strcmp(mbs, "\xb5H"), "mbs is %s\n", mbs); if(bUsedDefaultChar) ok(*bUsedDefaultChar == FALSE, "bUsedDefaultChar is %d\n", *bUsedDefaultChar); - ok(GetLastError() == 0xdeadbeef, "GetLastError() is %u\n", GetLastError()); + ok(GetLastError() == 0xdeadbeef, "GetLastError() is %lu\n", GetLastError());
/* Length-only tests */ SetLastError(0xdeadbeef); ret = WideCharToMultiByte(950, 0, dbwcs, 1, NULL, 0, NULL, bUsedDefaultChar); ok(ret == 2, "ret is %d\n", ret); if(bUsedDefaultChar) ok(*bUsedDefaultChar == FALSE, "bUsedDefaultChar is %d\n", *bUsedDefaultChar); - ok(GetLastError() == 0xdeadbeef, "GetLastError() is %u\n", GetLastError()); + ok(GetLastError() == 0xdeadbeef, "GetLastError() is %lu\n", GetLastError());
SetLastError(0xdeadbeef); ret = WideCharToMultiByte(950, 0, dbwcs, -1, NULL, 0, NULL, bUsedDefaultChar); ok(ret == 5, "ret is %d\n", ret); if(bUsedDefaultChar) ok(*bUsedDefaultChar == FALSE, "bUsedDefaultChar is %d\n", *bUsedDefaultChar); - ok(GetLastError() == 0xdeadbeef, "GetLastError() is %u\n", GetLastError()); + ok(GetLastError() == 0xdeadbeef, "GetLastError() is %lu\n", GetLastError()); }
static void test_utf7_encoding(void) @@ -709,7 +710,7 @@ static void test_utf7_encoding(void) if (!tests[i].len) { ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, - "tests[%i]: expected error=0x%x, got error=0x%x\n", + "tests[%i]: expected error=0x%x, got error=0x%lx\n", i, ERROR_INSUFFICIENT_BUFFER, GetLastError()); } ok(len == tests[i].len, "tests[%i]: expected len=%i, got len=%i\n", i, tests[i].len, len); @@ -983,7 +984,7 @@ static void test_utf7_decoding(void) if (!tests[i].len && tests[i].chars_written) { ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, - "tests[%i]: expected error=0x%x, got error=0x%x\n", + "tests[%i]: expected error=0x%x, got error=0x%lx\n", i, ERROR_INSUFFICIENT_BUFFER, GetLastError()); } ok(len == tests[i].len, "tests[%i]: expected len=%i, got len=%i\n", i, tests[i].len, len); @@ -1034,11 +1035,11 @@ static void test_undefined_byte_char(void) testset[i].str, -1, NULL, 0); err = GetLastError(); if (testset[i].is_error) { - ok(err == ERROR_NO_UNICODE_TRANSLATION, "Test %u: err is %u\n", i, err); + ok(err == ERROR_NO_UNICODE_TRANSLATION, "Test %u: err is %lu\n", i, err); ok(ret == 0, "Test %u: ret is %d\n", i, ret); } else { - ok(err == 0xdeadbeef, "Test %u: err is %u\n", i, err); + ok(err == 0xdeadbeef, "Test %u: err is %lu\n", i, err); ok(ret == 2, "Test %u: ret is %d\n", i, ret); }
@@ -1046,7 +1047,7 @@ static void test_undefined_byte_char(void) ret = MultiByteToWideChar(testset[i].codepage, 0, testset[i].str, -1, NULL, 0); err = GetLastError(); - ok(err == 0xdeadbeef, "Test %u: err is %u\n", i, err); + ok(err == 0xdeadbeef, "Test %u: err is %lu\n", i, err); ok(ret == 2, "Test %u: ret is %d\n", i, ret); } } @@ -1129,42 +1130,42 @@ static void test_threadcp(void)
cp = 0xdeadbeef; GetLocaleInfoA(lcids[i].lcid, LOCALE_IDEFAULTANSICODEPAGE|LOCALE_RETURN_NUMBER, (LPSTR)&cp, sizeof(cp)); - ok(cp == lcids[i].threadcp, "wrong codepage %u for lcid %04x, should be %u\n", cp, lcids[i].lcid, lcids[i].threadcp); + ok(cp == lcids[i].threadcp, "wrong codepage %u for lcid %04lx, should be %u\n", cp, lcids[i].lcid, lcids[i].threadcp);
/* GetCPInfoEx/GetCPInfo - CP_ACP */ SetLastError(0xdeadbeef); memset(&cpi, 0, sizeof(cpi)); ret = GetCPInfoExA(CP_ACP, 0, &cpi); - ok(ret, "GetCPInfoExA failed for lcid %04x, error %d\n", lcids[i].lcid, GetLastError()); - ok(cpi.CodePage == acp, "wrong codepage %u for lcid %04x, should be %u\n", cpi.CodePage, lcids[i].lcid, acp); + ok(ret, "GetCPInfoExA failed for lcid %04lx, error %ld\n", lcids[i].lcid, GetLastError()); + ok(cpi.CodePage == acp, "wrong codepage %u for lcid %04lx, should be %u\n", cpi.CodePage, lcids[i].lcid, acp);
/* WideCharToMultiByte - CP_ACP */ num = WideCharToMultiByte(CP_ACP, 0, foobarW, -1, NULL, 0, NULL, NULL); - ok(num == 7, "ret is %d (%04x)\n", num, lcids[i].lcid); + ok(num == 7, "ret is %d (%04lx)\n", num, lcids[i].lcid);
/* MultiByteToWideChar - CP_ACP */ num = MultiByteToWideChar(CP_ACP, 0, "foobar", -1, NULL, 0); - ok(num == 7, "ret is %d (%04x)\n", num, lcids[i].lcid); + ok(num == 7, "ret is %d (%04lx)\n", num, lcids[i].lcid);
/* GetCPInfoEx/GetCPInfo - CP_THREAD_ACP */ SetLastError(0xdeadbeef); memset(&cpi, 0, sizeof(cpi)); ret = GetCPInfoExA(CP_THREAD_ACP, 0, &cpi); - ok(ret, "GetCPInfoExA failed for lcid %04x, error %d\n", lcids[i].lcid, GetLastError()); + ok(ret, "GetCPInfoExA failed for lcid %04lx, error %ld\n", lcids[i].lcid, GetLastError()); if (lcids[i].threadcp) - ok(cpi.CodePage == lcids[i].threadcp, "wrong codepage %u for lcid %04x, should be %u\n", + ok(cpi.CodePage == lcids[i].threadcp, "wrong codepage %u for lcid %04lx, should be %u\n", cpi.CodePage, lcids[i].lcid, lcids[i].threadcp); else ok(cpi.CodePage == acp || cpi.CodePage == CP_UTF8 /* Win10 1809+ */, - "wrong codepage %u for lcid %04x, should be %u\n", cpi.CodePage, lcids[i].lcid, acp); + "wrong codepage %u for lcid %04lx, should be %u\n", cpi.CodePage, lcids[i].lcid, acp);
/* WideCharToMultiByte - CP_THREAD_ACP */ num = WideCharToMultiByte(CP_THREAD_ACP, 0, foobarW, -1, NULL, 0, NULL, NULL); - ok(num == 7, "ret is %d (%04x)\n", num, lcids[i].lcid); + ok(num == 7, "ret is %d (%04lx)\n", num, lcids[i].lcid);
/* MultiByteToWideChar - CP_THREAD_ACP */ num = MultiByteToWideChar(CP_THREAD_ACP, 0, "foobar", -1, NULL, 0); - ok(num == 7, "ret is %d (%04x)\n", num, lcids[i].lcid); + ok(num == 7, "ret is %d (%04lx)\n", num, lcids[i].lcid); }
/* IsDBCSLeadByteEx - locales without codepage */ @@ -1176,7 +1177,7 @@ static void test_threadcp(void) islead_default = IsDBCSLeadByteEx(cpi.CodePage, isleads_nocp[i].testchar); islead = IsDBCSLeadByteEx(CP_THREAD_ACP, isleads_nocp[i].testchar);
- ok(islead == islead_default, "wrong islead %i for test char %x in lcid %04x. should be %i\n", + ok(islead == islead_default, "wrong islead %i for test char %x in lcid %04lx. should be %i\n", islead, isleads_nocp[i].testchar, isleads_nocp[i].lcid, islead_default); }
@@ -1186,7 +1187,7 @@ static void test_threadcp(void) SetThreadLocale(isleads[i].lcid);
islead = IsDBCSLeadByteEx(CP_THREAD_ACP, isleads[i].testchar); - ok(islead == isleads[i].islead, "wrong islead %i for test char %x in lcid %04x. should be %i\n", + ok(islead == isleads[i].islead, "wrong islead %i for test char %x in lcid %04lx. should be %i\n", islead, isleads[i].testchar, isleads[i].lcid, isleads[i].islead); }
@@ -1218,10 +1219,10 @@ static void test_dbcs_to_widechar(void) count = MultiByteToWideChar(936, flags[i], (char*)&buf[0], 2, NULL, 0); count2 = MultiByteToWideChar(936, flags[i], (char*)&buf[0], 2, wbuf, count);
- ok(count == 1, "%04x: returned %d (expected 1)\n", flags[i], count); - ok(count2 == 1, "%04x: returned %d (expected 1)\n", flags[i], count2); - ok(wbuf[0] == 0x770b, "%04x: returned %04x (expected 770b)\n", flags[i], wbuf[0]); - ok(wbuf[1] == 0xffff, "%04x: returned %04x (expected ffff)\n", flags[i], wbuf[1]); + ok(count == 1, "%04lx: returned %d (expected 1)\n", flags[i], count); + ok(count2 == 1, "%04lx: returned %d (expected 1)\n", flags[i], count2); + ok(wbuf[0] == 0x770b, "%04lx: returned %04x (expected 770b)\n", flags[i], wbuf[0]); + ok(wbuf[1] == 0xffff, "%04lx: returned %04x (expected ffff)\n", flags[i], wbuf[1]); }
for (i = 0; i < ARRAY_SIZE(flags); ++i) @@ -1233,19 +1234,19 @@ static void test_dbcs_to_widechar(void)
if (flags[i] & MB_ERR_INVALID_CHARS) { - ok(count == 0, "%04x: returned %d (expected 0)\n", flags[i], count); - ok(count2 == 0, "%04x: returned %d (expected 0)\n", flags[i], count2); - ok(GetLastError() == ERROR_NO_UNICODE_TRANSLATION, "%04x: returned %d (expected %d)\n", + ok(count == 0, "%04lx: returned %d (expected 0)\n", flags[i], count); + ok(count2 == 0, "%04lx: returned %d (expected 0)\n", flags[i], count2); + ok(GetLastError() == ERROR_NO_UNICODE_TRANSLATION, "%04lx: returned %ld (expected %d)\n", flags[i], GetLastError(), ERROR_NO_UNICODE_TRANSLATION); } else { - ok(count == 2, "%04x: returned %d (expected 2)\n", flags[i], count); - ok(count2 == 2, "%04x: returned %d (expected 2)\n", flags[i], count2); - ok(wbuf[0] == 0x770b, "%04x: returned %04x (expected 770b)\n", flags[i], wbuf[0]); + ok(count == 2, "%04lx: returned %d (expected 2)\n", flags[i], count); + ok(count2 == 2, "%04lx: returned %d (expected 2)\n", flags[i], count2); + ok(wbuf[0] == 0x770b, "%04lx: returned %04x (expected 770b)\n", flags[i], wbuf[0]); ok(wbuf[1] == 0x003f || broken(wbuf[1] == 0), /*windows xp*/ - "%04x: wrong wide char: %04x\n", flags[i], wbuf[1]); - ok(wbuf[2] == 0xffff, "%04x: returned %04x (expected ffff)\n", flags[i], wbuf[2]); + "%04lx: wrong wide char: %04x\n", flags[i], wbuf[1]); + ok(wbuf[2] == 0xffff, "%04lx: returned %04x (expected ffff)\n", flags[i], wbuf[2]); } }
@@ -1256,12 +1257,12 @@ static void test_dbcs_to_widechar(void) count = MultiByteToWideChar(936, flags[i], (char*)&buf[0], 4, NULL, 0); SetLastError( 0xdeadbeef ); count2 = MultiByteToWideChar(936, flags[i], (char*)&buf[0], 4, wbuf, count); - ok(count == count2, "%04x: returned %d (expected %d)\n", flags[i], count2, count); + ok(count == count2, "%04lx: returned %d (expected %d)\n", flags[i], count2, count);
if (flags[i] & MB_ERR_INVALID_CHARS) { - ok(count == 0, "%04x: returned %d (expected 0)\n", flags[i], count); - ok(GetLastError() == ERROR_NO_UNICODE_TRANSLATION, "%04x: returned %d (expected %d)\n", + ok(count == 0, "%04lx: returned %d (expected 0)\n", flags[i], count); + ok(GetLastError() == ERROR_NO_UNICODE_TRANSLATION, "%04lx: returned %ld (expected %d)\n", flags[i], GetLastError(), ERROR_NO_UNICODE_TRANSLATION); } else @@ -1269,10 +1270,10 @@ static void test_dbcs_to_widechar(void) WCHAR wbuf_ok[] = { 0x770b, 0x003f, '\0', 0xffff }; WCHAR wbuf_broken[] = { 0x770b, '\0', 0xffff, 0xffff }; ok(count == 3 || broken(count == 2 /*windows xp*/), - "%04x: returned %d (expected 3)\n", flags[i], count); + "%04lx: returned %d (expected 3)\n", flags[i], count); ok(!memcmp(wbuf, wbuf_ok, sizeof(wbuf_ok)) || broken(!memcmp(wbuf, wbuf_broken, sizeof(wbuf_broken))), - "%04x: returned %04x %04x %04x %04x (expected %04x %04x %04x %04x)\n", + "%04lx: returned %04x %04x %04x %04x (expected %04x %04x %04x %04x)\n", flags[i], wbuf[0], wbuf[1], wbuf[2], wbuf[3], wbuf_ok[0], wbuf_ok[1], wbuf_ok[2], wbuf_ok[3]); } @@ -1285,12 +1286,12 @@ static void test_dbcs_to_widechar(void) count = MultiByteToWideChar(936, flags[i], (char*)&buf[0], 5, NULL, 0); SetLastError( 0xdeadbeef ); count2 = MultiByteToWideChar(936, flags[i], (char*)&buf[0], 5, wbuf, count); - ok(count == count2, "%04x: returned %d (expected %d)\n", flags[i], count2, count); + ok(count == count2, "%04lx: returned %d (expected %d)\n", flags[i], count2, count);
if (flags[i] & MB_ERR_INVALID_CHARS) { - ok(count == 0, "%04x: returned %d (expected 0)\n", flags[i], count); - ok(GetLastError() == ERROR_NO_UNICODE_TRANSLATION, "%04x: returned %d (expected %d)\n", + ok(count == 0, "%04lx: returned %d (expected 0)\n", flags[i], count); + ok(GetLastError() == ERROR_NO_UNICODE_TRANSLATION, "%04lx: returned %ld (expected %d)\n", flags[i], GetLastError(), ERROR_NO_UNICODE_TRANSLATION); } else @@ -1298,10 +1299,10 @@ static void test_dbcs_to_widechar(void) WCHAR wbuf_ok[] = { 0x770b, 0x003f, '\0', 'x', 0xffff }; WCHAR wbuf_broken[] = { 0x770b, '\0', 'x', 0xffff, 0xffff }; ok(count == 4 || broken(count == 3), - "%04x: returned %d (expected 4)\n", flags[i], count); + "%04lx: returned %d (expected 4)\n", flags[i], count); ok(!memcmp(wbuf, wbuf_ok, sizeof(wbuf_ok)) || broken(!memcmp(wbuf, wbuf_broken, sizeof(wbuf_broken))), - "%04x: returned %04x %04x %04x %04x %04x (expected %04x %04x %04x %04x %04x)\n", + "%04lx: returned %04x %04x %04x %04x %04x (expected %04x %04x %04x %04x %04x)\n", flags[i], wbuf[0], wbuf[1], wbuf[2], wbuf[3], wbuf[4], wbuf_ok[0], wbuf_ok[1], wbuf_ok[2], wbuf_ok[3], wbuf_ok[4]); }