Bug 801803: More nsresult as enum class creates warnings r=me
☠☠ backed out by ce9bde99d93e ☠ ☠
authorDavid Zbarsky <dzbarsky@gmail.com>
Mon, 15 Oct 2012 21:00:20 -0400
changeset 110487 14f09c2fb04ccb82a478ac23fabf9c79ab9bc248
parent 110486 7b582c09463b12f1f47242e62a94dafb102bc78e
child 110488 758c495dae14009c1428d308e5b1c79f3c201b25
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewersme
bugs801803
milestone19.0a1
Bug 801803: More nsresult as enum class creates warnings r=me
netwerk/cache/nsCacheService.cpp
netwerk/test/TestDNS.cpp
netwerk/test/TestIncrementalDownload.cpp
netwerk/test/TestOpen.cpp
netwerk/test/TestPageLoad.cpp
--- a/netwerk/cache/nsCacheService.cpp
+++ b/netwerk/cache/nsCacheService.cpp
@@ -1541,17 +1541,18 @@ nsCacheService::CreateDiskDevice()
     mDiskDevice->SetCacheParentDirectory(mObserver->DiskCacheParentDirectory());
     mDiskDevice->SetCapacity(mObserver->DiskCacheCapacity());
     mDiskDevice->SetMaxEntrySize(mObserver->DiskCacheMaxEntrySize());
     
     nsresult rv = mDiskDevice->Init();
     if (NS_FAILED(rv)) {
 #if DEBUG
         printf("###\n");
-        printf("### mDiskDevice->Init() failed (0x%.8x)\n", rv);
+        printf("### mDiskDevice->Init() failed (0x%.8x)\n",
+               static_cast<uint32_t>(rv));
         printf("###    - disabling disk cache for this session.\n");
         printf("###\n");
 #endif        
         mEnableDiskDevice = false;
         delete mDiskDevice;
         mDiskDevice = nullptr;
         return rv;
     }
--- a/netwerk/test/TestDNS.cpp
+++ b/netwerk/test/TestDNS.cpp
@@ -29,17 +29,17 @@ public:
         , mIndex(index) {}
     virtual ~myDNSListener() {}
 
     NS_IMETHOD OnLookupComplete(nsICancelable *request,
                                 nsIDNSRecord  *rec,
                                 nsresult       status)
     {
         printf("%d: OnLookupComplete called [host=%s status=%x rec=%p]\n",
-            mIndex, mHost.get(), status, (void*)rec);
+            mIndex, static_cast<uint32_t>(mHost.get()), status, (void*)rec);
 
         if (NS_SUCCEEDED(status)) {
             nsAutoCString buf;
 
             rec->GetCanonicalName(buf);
             printf("%d: canonname=%s\n", mIndex, buf.get());
 
             bool hasMore;
@@ -106,17 +106,18 @@ int main(int argc, char **argv)
 
                 nsCOMPtr<nsIDNSListener> listener = new myDNSListener(argv[i], i);
 
                 nsCOMPtr<nsICancelable> req;
                 nsresult rv = dns->AsyncResolve(hostBuf,
                                                 nsIDNSService::RESOLVE_CANONICAL_NAME,
                                                 listener, nullptr, getter_AddRefs(req));
                 if (NS_FAILED(rv))
-                    printf("### AsyncResolve failed [rv=%x]\n", rv);
+                    printf("### AsyncResolve failed [rv=%x]\n",
+                           static_cast<uint32_t>(rv));
             }
 
             printf("main thread sleeping for %d seconds...\n", sleepLen);
             PR_Sleep(PR_SecondsToInterval(sleepLen));
         }
 
         printf("shutting down main thread...\n");
         dns->Shutdown();
--- a/netwerk/test/TestIncrementalDownload.cpp
+++ b/netwerk/test/TestIncrementalDownload.cpp
@@ -52,17 +52,18 @@ FetchObserver::OnStatus(nsIRequest *requ
 {
   return NS_OK;
 }
 
 NS_IMETHODIMP
 FetchObserver::OnStopRequest(nsIRequest *request, nsISupports *context,
                              nsresult status)
 {
-  printf("FetchObserver::OnStopRequest [status=%x]\n", status);
+  printf("FetchObserver::OnStopRequest [status=%x]\n",
+         static_cast<uint32_t>(status));
 
   QuitPumpingEvents();
   return NS_OK;
 }
 
 //-----------------------------------------------------------------------------
 
 static nsresult
@@ -116,13 +117,14 @@ main(int argc, char **argv)
   if (NS_FAILED(rv))
     return -1;
 
   int32_t chunkSize = atoi(argv[3]);
   int32_t interval = atoi(argv[4]);
 
   rv = DoIncrementalFetch(argv[1], argv[2], chunkSize, interval);
   if (NS_FAILED(rv))
-    fprintf(stderr, "ERROR: DoIncrementalFetch failed [%x]\n", rv);
+    fprintf(stderr, "ERROR: DoIncrementalFetch failed [%x]\n",
+            static_cast<uint32_t>(rv));
 
   NS_ShutdownXPCOM(nullptr);
   return 0;
 }
--- a/netwerk/test/TestOpen.cpp
+++ b/netwerk/test/TestOpen.cpp
@@ -19,17 +19,17 @@ using namespace mozilla;
 
 /*
  * Test synchronous Open.
  */
 
 #define RETURN_IF_FAILED(rv, what) \
     PR_BEGIN_MACRO \
     if (NS_FAILED(rv)) { \
-        printf(what ": failed - %08x\n", rv); \
+        printf(what ": failed - %08x\n", static_cast<uint32_t>(rv)); \
         return -1; \
     } \
     PR_END_MACRO
 
 int
 main(int argc, char **argv)
 {
     if (test_common_init(&argc, &argv) != 0)
--- a/netwerk/test/TestPageLoad.cpp
+++ b/netwerk/test/TestPageLoad.cpp
@@ -175,17 +175,18 @@ MyListener::OnDataAvailable(nsIRequest *
       while (count) {
         uint32_t amount = NS_MIN<uint32_t>(count, sizeof(buf));
         rv = stream->Read(buf, amount, &bytesRead);  
         count -= bytesRead;
       }
     }
 
     if (NS_FAILED(rv)) {
-      printf(">>> stream->Read failed with rv=%x\n", rv);
+      printf(">>> stream->Read failed with rv=%x\n",
+             static_cast<uint32_t>(rv));
       return rv;
     }
 
     return NS_OK;
 }
 
 //-----------------------------------------------------------------------------
 // NotificationCallbacks implementation