From e61e4b918a3cbe9f3fa35cf3d2bb71813cc84b15 Mon Sep 17 00:00:00 2001 From: Chris Peterson Date: Mon, 19 Oct 2015 20:07:52 -0700 Subject: [PATCH] Bug 1218258 - Fix -Wshadow warnings in toolkit/components/downloads. r=paolo toolkit/components/downloads/ApplicationReputation.cpp:598:14 [-Wshadow] declaration shadows a local variable toolkit/components/downloads/ApplicationReputation.cpp:721:15 [-Wshadow] declaration shadows a local variable toolkit/components/downloads/ApplicationReputation.cpp:809:29 [-Wshadow] declaration shadows a local variable toolkit/components/downloads/nsDownloadManager.cpp:1268:36 [-Wshadow] declaration shadows a local variable toolkit/components/downloads/nsDownloadManager.cpp:1483:33 [-Wshadow] declaration shadows a local variable --- .../downloads/ApplicationReputation.cpp | 30 +++++++++---------- .../downloads/nsDownloadManager.cpp | 13 ++++---- 2 files changed, 20 insertions(+), 23 deletions(-) diff --git a/toolkit/components/downloads/ApplicationReputation.cpp b/toolkit/components/downloads/ApplicationReputation.cpp index 0fc954bf9e9e..c8d0c15a632a 100644 --- a/toolkit/components/downloads/ApplicationReputation.cpp +++ b/toolkit/components/downloads/ApplicationReputation.cpp @@ -596,7 +596,7 @@ PendingLookup::GenerateWhitelistStringsForChain( aChain.element(i).certificate().size(), getter_AddRefs(issuer)); NS_ENSURE_SUCCESS(rv, rv); - nsresult rv = GenerateWhitelistStringsForPair(signer, issuer); + rv = GenerateWhitelistStringsForPair(signer, issuer); NS_ENSURE_SUCCESS(rv, rv); } return NS_OK; @@ -706,24 +706,24 @@ PendingLookup::DoLookupInternal() nsresult rv = mQuery->GetSourceURI(getter_AddRefs(uri)); NS_ENSURE_SUCCESS(rv, rv); - nsCString spec; - rv = GetStrippedSpec(uri, spec); + nsCString sourceSpec; + rv = GetStrippedSpec(uri, sourceSpec); NS_ENSURE_SUCCESS(rv, rv); - mAnylistSpecs.AppendElement(spec); + mAnylistSpecs.AppendElement(sourceSpec); ClientDownloadRequest_Resource* resource = mRequest.add_resources(); - resource->set_url(spec.get()); + resource->set_url(sourceSpec.get()); resource->set_type(ClientDownloadRequest::DOWNLOAD_URL); nsCOMPtr referrer = nullptr; rv = mQuery->GetReferrerURI(getter_AddRefs(referrer)); if (referrer) { - nsCString spec; - rv = GetStrippedSpec(referrer, spec); + nsCString referrerSpec; + rv = GetStrippedSpec(referrer, referrerSpec); NS_ENSURE_SUCCESS(rv, rv); - mAnylistSpecs.AppendElement(spec); - resource->set_referrer(spec.get()); + mAnylistSpecs.AppendElement(referrerSpec); + resource->set_referrer(referrerSpec.get()); } nsCOMPtr redirects; rv = mQuery->GetRedirects(getter_AddRefs(redirects)); @@ -790,11 +790,11 @@ PendingLookup::ParseCertificates(nsIArray* aSigArray) NS_ENSURE_SUCCESS(rv, rv); while (hasMoreChains) { - nsCOMPtr supports; - rv = chains->GetNext(getter_AddRefs(supports)); + nsCOMPtr chainSupports; + rv = chains->GetNext(getter_AddRefs(chainSupports)); NS_ENSURE_SUCCESS(rv, rv); - nsCOMPtr certList = do_QueryInterface(supports, &rv); + nsCOMPtr certList = do_QueryInterface(chainSupports, &rv); NS_ENSURE_SUCCESS(rv, rv); safe_browsing::ClientDownloadRequest_CertificateChain* certChain = @@ -807,11 +807,11 @@ PendingLookup::ParseCertificates(nsIArray* aSigArray) bool hasMoreCerts = false; rv = chainElt->HasMoreElements(&hasMoreCerts); while (hasMoreCerts) { - nsCOMPtr supports; - rv = chainElt->GetNext(getter_AddRefs(supports)); + nsCOMPtr certSupports; + rv = chainElt->GetNext(getter_AddRefs(certSupports)); NS_ENSURE_SUCCESS(rv, rv); - nsCOMPtr cert = do_QueryInterface(supports, &rv); + nsCOMPtr cert = do_QueryInterface(certSupports, &rv); NS_ENSURE_SUCCESS(rv, rv); uint8_t* data = nullptr; diff --git a/toolkit/components/downloads/nsDownloadManager.cpp b/toolkit/components/downloads/nsDownloadManager.cpp index fab0d7963a5d..de62c84cf407 100644 --- a/toolkit/components/downloads/nsDownloadManager.cpp +++ b/toolkit/components/downloads/nsDownloadManager.cpp @@ -1274,17 +1274,17 @@ nsDownloadManager::GetDownloadFromDB(mozIStorageConnection* aDBConn, if (dl->mGUID.IsEmpty()) { rv = GenerateGUID(dl->mGUID); NS_ENSURE_SUCCESS(rv, rv); - nsCOMPtr stmt; + nsCOMPtr updateStmt; rv = mDBConn->CreateStatement(NS_LITERAL_CSTRING( "UPDATE moz_downloads SET guid = :guid " "WHERE id = :id"), - getter_AddRefs(stmt)); + getter_AddRefs(updateStmt)); NS_ENSURE_SUCCESS(rv, rv); - rv = stmt->BindUTF8StringByName(NS_LITERAL_CSTRING("guid"), dl->mGUID); + rv = updateStmt->BindUTF8StringByName(NS_LITERAL_CSTRING("guid"), dl->mGUID); NS_ENSURE_SUCCESS(rv, rv); - rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("id"), dl->mID); + rv = updateStmt->BindInt64ByName(NS_LITERAL_CSTRING("id"), dl->mID); NS_ENSURE_SUCCESS(rv, rv); - rv = stmt->Execute(); + rv = updateStmt->Execute(); NS_ENSURE_SUCCESS(rv, rv); } @@ -1489,9 +1489,6 @@ nsDownloadManager::GetUserDownloadsDirectory(nsIFile **aResult) case 0: // Desktop { nsCOMPtr downloadDir; - nsCOMPtr dirService = - do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv); - NS_ENSURE_SUCCESS(rv, rv); rv = dirService->Get(NS_OS_DESKTOP_DIR, NS_GET_IID(nsIFile), getter_AddRefs(downloadDir));