wininet/tests: Print GetLastError() in decimal with '%u'.

Francois Gouget fgouget at free.fr
Sat Jan 6 12:25:07 CST 2007


---
 dlls/wininet/tests/http.c |   76 ++++++++++++++++++++++----------------------
 dlls/wininet/tests/url.c  |   10 +++---
 2 files changed, 43 insertions(+), 43 deletions(-)

diff --git a/dlls/wininet/tests/http.c b/dlls/wininet/tests/http.c
index ab9f6fe..876e616 100644
--- a/dlls/wininet/tests/http.c
+++ b/dlls/wininet/tests/http.c
@@ -171,7 +171,7 @@ static void InternetReadFile_test(int flags)
 
     trace("InternetOpenA <--\n");
     hi = InternetOpenA("", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, flags);
-    ok((hi != 0x0),"InternetOpen failed with error %d\n", GetLastError());
+    ok((hi != 0x0),"InternetOpen failed with error %u\n", GetLastError());
     trace("InternetOpenA -->\n");
 
     if (hi == 0x0) goto abort;
@@ -181,7 +181,7 @@ static void InternetReadFile_test(int flags)
     trace("InternetConnectA <--\n");
     hic=InternetConnectA(hi, "www.winehq.org", INTERNET_INVALID_PORT_NUMBER,
                          NULL, NULL, INTERNET_SERVICE_HTTP, 0x0, 0xdeadbeef);
-    ok((hic != 0x0),"InternetConnect failed with error %d\n", GetLastError());
+    ok((hic != 0x0),"InternetConnect failed with error %u\n", GetLastError());
     trace("InternetConnectA -->\n");
 
     if (hic == 0x0) goto abort;
@@ -198,7 +198,7 @@ static void InternetReadFile_test(int flags)
          * abort.
          */
     } else  {
-        ok((hor != 0x0),"HttpOpenRequest failed with error %d\n", GetLastError());
+        ok((hor != 0x0),"HttpOpenRequest failed with error %u\n", GetLastError());
     }
     trace("HttpOpenRequestA -->\n");
 
@@ -212,7 +212,7 @@ static void InternetReadFile_test(int flags)
             "Asynchronous HttpSendRequest NOT returning 0 with error ERROR_IO_PENDING\n");
     else
         ok((rc != 0) || GetLastError() == ERROR_INTERNET_NAME_NOT_RESOLVED,
-           "Synchronous HttpSendRequest returning 0, error %d\n", GetLastError());
+           "Synchronous HttpSendRequest returning 0, error %u\n", GetLastError());
     trace("HttpSendRequestA <--\n");
 
     if (flags & INTERNET_FLAG_ASYNC)
@@ -238,7 +238,7 @@ static void InternetReadFile_test(int flags)
 
     length = 16;
     rc = HttpQueryInfoA(hor,HTTP_QUERY_CONTENT_LENGTH,&buffer,&length,0x0);
-    trace("Option 0x5 -> %i  %s  (%i)\n",rc,buffer,GetLastError());
+    trace("Option 0x5 -> %i  %s  (%u)\n",rc,buffer,GetLastError());
 
     length = 100;
     rc = HttpQueryInfoA(hor,HTTP_QUERY_CONTENT_TYPE,buffer,&length,0x0);
@@ -249,7 +249,7 @@ static void InternetReadFile_test(int flags)
     rc = InternetReadFile(NULL, buffer, 100, &length);
     ok(!rc, "InternetReadFile should have failed\n");
     ok(GetLastError() == ERROR_INVALID_HANDLE,
-        "InternetReadFile should have set last error to ERROR_INVALID_HANDLE instead of %d\n",
+        "InternetReadFile should have set last error to ERROR_INVALID_HANDLE instead of %u\n",
         GetLastError());
 
     length = 100;
@@ -283,7 +283,7 @@ abort:
         rc = InternetCloseHandle(hor);
         ok ((rc == 0), "Double close of handle opened by HttpOpenRequestA succeeded\n");
         ok (GetLastError() == ERROR_INVALID_HANDLE,
-            "Double close of handle should have set ERROR_INVALID_HANDLE instead of %d\n",
+            "Double close of handle should have set ERROR_INVALID_HANDLE instead of %u\n",
             GetLastError());
     }
     if (hic != 0x0) {
@@ -313,7 +313,7 @@ static void InternetReadFileExA_test(int flags)
 
     trace("InternetOpenA <--\n");
     hi = InternetOpenA("", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, flags);
-    ok((hi != 0x0),"InternetOpen failed with error %d\n", GetLastError());
+    ok((hi != 0x0),"InternetOpen failed with error %u\n", GetLastError());
     trace("InternetOpenA -->\n");
 
     if (hi == 0x0) goto abort;
@@ -323,7 +323,7 @@ static void InternetReadFileExA_test(int flags)
     trace("InternetConnectA <--\n");
     hic=InternetConnectA(hi, "www.winehq.org", INTERNET_INVALID_PORT_NUMBER,
                          NULL, NULL, INTERNET_SERVICE_HTTP, 0x0, 0xdeadbeef);
-    ok((hic != 0x0),"InternetConnect failed with error %d\n", GetLastError());
+    ok((hic != 0x0),"InternetConnect failed with error %u\n", GetLastError());
     trace("InternetConnectA -->\n");
 
     if (hic == 0x0) goto abort;
@@ -340,7 +340,7 @@ static void InternetReadFileExA_test(int flags)
          * abort.
          */
     } else  {
-        ok((hor != 0x0),"HttpOpenRequest failed with error %d\n", GetLastError());
+        ok((hor != 0x0),"HttpOpenRequest failed with error %u\n", GetLastError());
     }
     trace("HttpOpenRequestA -->\n");
 
@@ -354,7 +354,7 @@ static void InternetReadFileExA_test(int flags)
             "Asynchronous HttpSendRequest NOT returning 0 with error ERROR_IO_PENDING\n");
     else
         ok((rc != 0) || GetLastError() == ERROR_INTERNET_NAME_NOT_RESOLVED,
-           "Synchronous HttpSendRequest returning 0, error %d\n", GetLastError());
+           "Synchronous HttpSendRequest returning 0, error %u\n", GetLastError());
     trace("HttpSendRequestA <--\n");
 
     if (!rc && (GetLastError() == ERROR_IO_PENDING))
@@ -370,7 +370,7 @@ static void InternetReadFileExA_test(int flags)
     inetbuffers.dwOffsetLow = 5678;
     rc = InternetReadFileEx(hor, &inetbuffers, 0, 0xdeadcafe);
     ok(!rc && (GetLastError() == ERROR_INVALID_PARAMETER),
-        "InternetReadFileEx should have failed with ERROR_INVALID_PARAMETER instead of %s, %d\n",
+        "InternetReadFileEx should have failed with ERROR_INVALID_PARAMETER instead of %s, %u\n",
         rc ? "TRUE" : "FALSE", GetLastError());
     HeapFree(GetProcessHeap(), 0, inetbuffers.lpvBuffer);
 
@@ -383,11 +383,11 @@ static void InternetReadFileExA_test(int flags)
     inetbuffers.dwOffsetHigh = 1234;
     inetbuffers.dwOffsetLow = 5678;
     rc = InternetReadFileEx(hor, &inetbuffers, 0, 0xdeadcafe);
-    ok(rc, "InternetReadFileEx failed with error %d\n", GetLastError());
+    ok(rc, "InternetReadFileEx failed with error %u\n", GetLastError());
 
     rc = InternetReadFileEx(NULL, &inetbuffers, 0, 0xdeadcafe);
     ok(!rc && (GetLastError() == ERROR_INVALID_HANDLE),
-        "InternetReadFileEx should have failed with ERROR_INVALID_HANDLE instead of %s, %d\n",
+        "InternetReadFileEx should have failed with ERROR_INVALID_HANDLE instead of %s, %u\n",
         rc ? "TRUE" : "FALSE", GetLastError());
 
     length = 0;
@@ -411,7 +411,7 @@ static void InternetReadFileExA_test(int flags)
             }
             else
             {
-                trace("InternetReadFileEx -> FAILED %d\n", GetLastError());
+                trace("InternetReadFileEx -> FAILED %u\n", GetLastError());
                 break;
             }
         }
@@ -462,19 +462,19 @@ static void InternetOpenUrlA_test(void)
   BOOL ret;
   
   myhinternet = InternetOpen("Winetest",0,NULL,NULL,INTERNET_FLAG_NO_CACHE_WRITE);
-  ok((myhinternet != 0), "InternetOpen failed, error %x\n",GetLastError());
+  ok((myhinternet != 0), "InternetOpen failed, error %u\n",GetLastError());
   size = 0x400;
   ret = InternetCanonicalizeUrl(TEST_URL, buffer, &size,ICU_BROWSER_MODE);
-  ok( ret, "InternetCanonicalizeUrl failed, error %x\n",GetLastError());
+  ok( ret, "InternetCanonicalizeUrl failed, error %u\n",GetLastError());
 
   SetLastError(0);
   myhttp = InternetOpenUrl(myhinternet, TEST_URL, 0, 0,
 			   INTERNET_FLAG_RELOAD|INTERNET_FLAG_NO_CACHE_WRITE|INTERNET_FLAG_TRANSFER_BINARY,0);
   if (GetLastError() == 12007)
     return; /* WinXP returns this when not connected to the net */
-  ok((myhttp != 0),"InternetOpenUrl failed, error %x\n",GetLastError());
+  ok((myhttp != 0),"InternetOpenUrl failed, error %u\n",GetLastError());
   ret = InternetReadFile(myhttp, buffer,0x400,&readbytes);
-  ok( ret, "InternetReadFile failed, error %x\n",GetLastError());
+  ok( ret, "InternetReadFile failed, error %u\n",GetLastError());
   totalbytes += readbytes;
   while (readbytes && InternetReadFile(myhttp, buffer,0x400,&readbytes))
     totalbytes += readbytes;
@@ -489,10 +489,10 @@ static void InternetTimeFromSystemTimeA_test(void)
     static const char expect[] = "Fri, 07 Jan 2005 12:06:35 GMT";
 
     ret = InternetTimeFromSystemTimeA( &time, INTERNET_RFC1123_FORMAT, string, sizeof(string) );
-    ok( ret, "InternetTimeFromSystemTimeA failed (%d)\n", GetLastError() );
+    ok( ret, "InternetTimeFromSystemTimeA failed (%u)\n", GetLastError() );
 
     ok( !memcmp( string, expect, sizeof(expect) ),
-        "InternetTimeFromSystemTimeA failed (%d)\n", GetLastError() );
+        "InternetTimeFromSystemTimeA failed (%u)\n", GetLastError() );
 }
 
 static void InternetTimeFromSystemTimeW_test(void)
@@ -504,10 +504,10 @@ static void InternetTimeFromSystemTimeW_test(void)
                                     '1','2',':','0','6',':','3','5',' ','G','M','T',0 };
 
     ret = InternetTimeFromSystemTimeW( &time, INTERNET_RFC1123_FORMAT, string, sizeof(string) );
-    ok( ret, "InternetTimeFromSystemTimeW failed (%d)\n", GetLastError() );
+    ok( ret, "InternetTimeFromSystemTimeW failed (%u)\n", GetLastError() );
 
     ok( !memcmp( string, expect, sizeof(expect) ),
-        "InternetTimeFromSystemTimeW failed (%d)\n", GetLastError() );
+        "InternetTimeFromSystemTimeW failed (%u)\n", GetLastError() );
 }
 
 static void InternetTimeToSystemTimeA_test(void)
@@ -519,14 +519,14 @@ static void InternetTimeToSystemTimeA_test(void)
     static const char string2[] = " fri 7 jan 2005 12 06 35";
 
     ret = InternetTimeToSystemTimeA( string, &time, 0 );
-    ok( ret, "InternetTimeToSystemTimeA failed (%d)\n", GetLastError() );
+    ok( ret, "InternetTimeToSystemTimeA failed (%u)\n", GetLastError() );
     ok( !memcmp( &time, &expect, sizeof(expect) ),
-        "InternetTimeToSystemTimeA failed (%d)\n", GetLastError() );
+        "InternetTimeToSystemTimeA failed (%u)\n", GetLastError() );
 
     ret = InternetTimeToSystemTimeA( string2, &time, 0 );
-    ok( ret, "InternetTimeToSystemTimeA failed (%d)\n", GetLastError() );
+    ok( ret, "InternetTimeToSystemTimeA failed (%u)\n", GetLastError() );
     ok( !memcmp( &time, &expect, sizeof(expect) ),
-        "InternetTimeToSystemTimeA failed (%d)\n", GetLastError() );
+        "InternetTimeToSystemTimeA failed (%u)\n", GetLastError() );
 }
 
 static void InternetTimeToSystemTimeW_test(void)
@@ -541,29 +541,29 @@ static void InternetTimeToSystemTimeW_test(void)
     static const WCHAR string3[] = { 'F','r',0 };
 
     ret = InternetTimeToSystemTimeW( NULL, NULL, 0 );
-    ok( !ret, "InternetTimeToSystemTimeW succeeded (%d)\n", GetLastError() );
+    ok( !ret, "InternetTimeToSystemTimeW succeeded (%u)\n", GetLastError() );
 
     ret = InternetTimeToSystemTimeW( NULL, &time, 0 );
-    ok( !ret, "InternetTimeToSystemTimeW succeeded (%d)\n", GetLastError() );
+    ok( !ret, "InternetTimeToSystemTimeW succeeded (%u)\n", GetLastError() );
 
     ret = InternetTimeToSystemTimeW( string, NULL, 0 );
-    ok( !ret, "InternetTimeToSystemTimeW succeeded (%d)\n", GetLastError() );
+    ok( !ret, "InternetTimeToSystemTimeW succeeded (%u)\n", GetLastError() );
 
     ret = InternetTimeToSystemTimeW( string, &time, 1 );
-    ok( ret, "InternetTimeToSystemTimeW failed (%d)\n", GetLastError() );
+    ok( ret, "InternetTimeToSystemTimeW failed (%u)\n", GetLastError() );
 
     ret = InternetTimeToSystemTimeW( string, &time, 0 );
-    ok( ret, "InternetTimeToSystemTimeW failed (%d)\n", GetLastError() );
+    ok( ret, "InternetTimeToSystemTimeW failed (%u)\n", GetLastError() );
     ok( !memcmp( &time, &expect, sizeof(expect) ),
-        "InternetTimeToSystemTimeW failed (%d)\n", GetLastError() );
+        "InternetTimeToSystemTimeW failed (%u)\n", GetLastError() );
 
     ret = InternetTimeToSystemTimeW( string2, &time, 0 );
-    ok( ret, "InternetTimeToSystemTimeW failed (%d)\n", GetLastError() );
+    ok( ret, "InternetTimeToSystemTimeW failed (%u)\n", GetLastError() );
     ok( !memcmp( &time, &expect, sizeof(expect) ),
-        "InternetTimeToSystemTimeW failed (%d)\n", GetLastError() );
+        "InternetTimeToSystemTimeW failed (%u)\n", GetLastError() );
 
     ret = InternetTimeToSystemTimeW( string3, &time, 0 );
-    ok( ret, "InternetTimeToSystemTimeW failed (%d)\n", GetLastError() );
+    ok( ret, "InternetTimeToSystemTimeW failed (%u)\n", GetLastError() );
 }
 
 static void HttpSendRequestEx_test(void)
@@ -596,7 +596,7 @@ static void HttpSendRequestEx_test(void)
         trace( "Network unreachable, skipping test\n" );
         goto done;
     }
-    ok( hRequest != NULL, "Failed to open request handle err %x\n", GetLastError());
+    ok( hRequest != NULL, "Failed to open request handle err %u\n", GetLastError());
 
 
     BufferIn.dwStructSize = sizeof( INTERNET_BUFFERS);
@@ -611,7 +611,7 @@ static void HttpSendRequestEx_test(void)
     BufferIn.dwOffsetHigh = 0;
 
     ret = HttpSendRequestEx(hRequest, &BufferIn, NULL, 0 ,0);
-    ok(ret, "HttpSendRequestEx Failed with error %d\n", GetLastError());
+    ok(ret, "HttpSendRequestEx Failed with error %u\n", GetLastError());
 
     for (i = 3; szPostData[i]; i++)
         ok(InternetWriteFile(hRequest, &szPostData[i], 1, &dwBytesWritten),
diff --git a/dlls/wininet/tests/url.c b/dlls/wininet/tests/url.c
index 90008f0..10b45c9 100644
--- a/dlls/wininet/tests/url.c
+++ b/dlls/wininet/tests/url.c
@@ -112,13 +112,13 @@ static void InternetCrackUrl_test(void)
 
   copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 1024, 2048, 1024);
   ret = InternetCrackUrl(TEST_URL, 0,0,&urlComponents);
-  ok( ret, "InternetCrackUrl failed, error %x\n",GetLastError());
+  ok( ret, "InternetCrackUrl failed, error %d\n",GetLastError());
   ok((strcmp(TEST_URL_PATH,path) == 0),"path cracked wrong\n");
 
   /* Bug 1805: Confirm the returned lengths are correct:                     */
   /* 1. When extra info split out explicitly */
   zero_compsA(&urlComponents, 0, 1, 0, 0, 1, 1);
-  ok(InternetCrackUrlA(TEST_URL2, 0, 0, &urlComponents),"InternetCrackUrl failed, error 0x%x\n", GetLastError());
+  ok(InternetCrackUrlA(TEST_URL2, 0, 0, &urlComponents),"InternetCrackUrl failed, error %d\n", GetLastError());
   ok(urlComponents.dwUrlPathLength == strlen(TEST_URL2_PATH),".dwUrlPathLength should be %d, but is %d\n", (DWORD)strlen(TEST_URL2_PATH), urlComponents.dwUrlPathLength);
   ok(!strncmp(urlComponents.lpszUrlPath,TEST_URL2_PATH,strlen(TEST_URL2_PATH)),"lpszUrlPath should be %s but is %s\n", TEST_URL2_PATH, urlComponents.lpszUrlPath);
   ok(urlComponents.dwHostNameLength == strlen(TEST_URL2_SERVER),".dwHostNameLength should be %d, but is %d\n", (DWORD)strlen(TEST_URL2_SERVER), urlComponents.dwHostNameLength);
@@ -128,7 +128,7 @@ static void InternetCrackUrl_test(void)
 
   /* 2. When extra info is not split out explicitly and is in url path */
   zero_compsA(&urlComponents, 0, 1, 0, 0, 1, 0);
-  ok(InternetCrackUrlA(TEST_URL2, 0, 0, &urlComponents),"InternetCrackUrl failed with GLE 0x%x\n",GetLastError());
+  ok(InternetCrackUrlA(TEST_URL2, 0, 0, &urlComponents),"InternetCrackUrl failed with GLE %d\n",GetLastError());
   ok(urlComponents.dwUrlPathLength == strlen(TEST_URL2_PATHEXTRA),".dwUrlPathLength should be %d, but is %d\n", (DWORD)strlen(TEST_URL2_PATHEXTRA), urlComponents.dwUrlPathLength);
   ok(!strncmp(urlComponents.lpszUrlPath,TEST_URL2_PATHEXTRA,strlen(TEST_URL2_PATHEXTRA)),"lpszUrlPath should be %s but is %s\n", TEST_URL2_PATHEXTRA, urlComponents.lpszUrlPath);
   ok(urlComponents.dwHostNameLength == strlen(TEST_URL2_SERVER),".dwHostNameLength should be %d, but is %d\n", (DWORD)strlen(TEST_URL2_SERVER), urlComponents.dwHostNameLength);
@@ -137,7 +137,7 @@ static void InternetCrackUrl_test(void)
   ok(urlComponents.nScheme == INTERNET_SCHEME_HTTP,"urlComponents->nScheme should have been INTERNET_SCHEME_HTTP instead of %d\n", urlComponents.nScheme);
 
   zero_compsA(&urlComponents, 1, 1, 1, 1, 1, 1);
-  ok(InternetCrackUrlA(TEST_URL, strlen(TEST_URL), 0, &urlComponents),"InternetCrackUrl failed with GLE 0x%x\n",GetLastError());
+  ok(InternetCrackUrlA(TEST_URL, strlen(TEST_URL), 0, &urlComponents),"InternetCrackUrl failed with GLE %d\n",GetLastError());
   ok(urlComponents.dwUrlPathLength == strlen(TEST_URL_PATH),".dwUrlPathLength should be %d, but is %d\n", lstrlenA(TEST_URL_PATH), urlComponents.dwUrlPathLength);
   ok(!strncmp(urlComponents.lpszUrlPath,TEST_URL_PATH,strlen(TEST_URL_PATH)),"lpszUrlPath should be %s but is %s\n", TEST_URL_PATH, urlComponents.lpszUrlPath);
   ok(urlComponents.dwHostNameLength == strlen(TEST_URL_HOST),".dwHostNameLength should be %d, but is %d\n", lstrlenA(TEST_URL_HOST), urlComponents.dwHostNameLength);
@@ -153,7 +153,7 @@ static void InternetCrackUrl_test(void)
 
   /*3. Check for %20 */
   copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 1024, 2048, 1024);
-  ok(InternetCrackUrlA(TEST_URL3, 0, ICU_DECODE, &urlComponents),"InternetCrackUrl failed with GLE 0x%x\n",GetLastError());
+  ok(InternetCrackUrlA(TEST_URL3, 0, ICU_DECODE, &urlComponents),"InternetCrackUrl failed with GLE %d\n",GetLastError());
 
 
   /* Tests for lpsz* members pointing to real strings while 
-- 
1.4.4.2




More information about the wine-patches mailing list