Commits

dzbarsky committed e6d7ec4 Draft

Bug 801803: More nsresult as enum class creates warnings r=me

Comments (0)

Files changed (7)

js/xpconnect/shell/xpcshell.cpp

         nsresult rv = rtsvc->GetBackstagePass(getter_AddRefs(backstagePass));
         if (NS_FAILED(rv)) {
             fprintf(gErrFile, "+++ Failed to get backstage pass from rtsvc: %8x\n",
-                    rv);
+                    static_cast<uint32_t>(rv));
             return 1;
         }
 

netwerk/cache/nsCacheService.cpp

     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        

netwerk/test/TestDNS.cpp

                                 nsresult       status)
     {
         printf("%d: OnLookupComplete called [host=%s status=%x rec=%p]\n",
-            mIndex, mHost.get(), status, (void*)rec);
+            mIndex, mHost.get(), static_cast<uint32_t>(status), (void*)rec);
 
         if (NS_SUCCEEDED(status)) {
             nsAutoCString buf;
                                                 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);

netwerk/test/TestIncrementalDownload.cpp

 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;
 
   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;

netwerk/test/TestOpen.cpp

 #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

netwerk/test/TestPageLoad.cpp

     }
 
     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;
     }
 

xpcom/sample/program/nsTestSample.cpp

     rv = NS_InitXPCOM2(getter_AddRefs(servMan), nullptr, nullptr);
     if (NS_FAILED(rv))
     {
-        printf("ERROR: XPCOM intialization error [%x].\n", rv);
+        printf("ERROR: XPCOM intialization error [%x].\n",
+               static_cast<uint32_t>(rv));
         return -1;
     }
 
     nsCOMPtr<nsIComponentManager> manager = do_QueryInterface(servMan);
-    
+
     // Create an instance of our component
     nsCOMPtr<nsISample> mysample;
     rv = manager->CreateInstanceByContractID(NS_SAMPLE_CONTRACTID,
                "\tsetenv NSPR_LOG_FILE xpcom.log\n"
                "\t./nsTestSample\n"
                "\t<check the contents for xpcom.log for possible cause of error>.\n",
-               rv);
+               static_cast<uint32_t>(rv));
         return -2;
     }
 
     rv = mysample->WriteValue("Inital print:");
     if (NS_FAILED(rv))
     {
-        printf("ERROR: Calling nsISample::WriteValue() [%x]\n", rv);
+        printf("ERROR: Calling nsISample::WriteValue() [%x]\n",
+               static_cast<uint32_t>(rv));
         return -3;
     }
 
     rv = mysample->SetValue(testValue);
     if (NS_FAILED(rv))
     {
-        printf("ERROR: Calling nsISample::SetValue() [%x]\n", rv);
+        printf("ERROR: Calling nsISample::SetValue() [%x]\n",
+               static_cast<uint32_t>(rv));
         return -3;
     }
     printf("Set value to: %s\n", testValue);
 
     if (NS_FAILED(rv))
     {
-        printf("ERROR: Calling nsISample::GetValue() [%x]\n", rv);
+        printf("ERROR: Calling nsISample::GetValue() [%x]\n",
+               static_cast<uint32_t>(rv));
         return -3;
     }
     if (strcmp(str, testValue))