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

This commit is contained in:
David Zbarsky 2012-10-15 23:37:34 -04:00
parent a0ada57ef1
commit 95cf6682cb
7 changed files with 23 additions and 14 deletions

View File

@ -1850,7 +1850,7 @@ main(int argc, char **argv, char **envp)
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;
}

View File

@ -1546,7 +1546,8 @@ nsCacheService::CreateDiskDevice()
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

View File

@ -34,7 +34,7 @@ public:
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;
@ -111,7 +111,8 @@ int main(int argc, char **argv)
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);

View File

@ -57,7 +57,8 @@ 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;
@ -121,7 +122,8 @@ main(int argc, char **argv)
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;

View File

@ -24,7 +24,7 @@ using namespace mozilla;
#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

View File

@ -180,7 +180,8 @@ MyListener::OnDataAvailable(nsIRequest *req, nsISupports *ctxt,
}
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;
}

View File

@ -33,12 +33,13 @@ main(void)
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_cat<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,
@ -53,7 +54,7 @@ main(void)
"\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;
}
@ -61,7 +62,8 @@ main(void)
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;
}
@ -69,7 +71,8 @@ main(void)
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);
@ -78,7 +81,8 @@ main(void)
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))