Bug 1487082 - fix 'Unused "kungFuDeathGrip"' errors. r=jorgk DONTBUILD
authorBen Campbell <benc@thunderbird.net>
Tue, 04 Sep 2018 11:31:52 +1200
changeset 33183 b1b281b4ba9aced1c7128ffa4441188d702ccbc0
parent 33182 e3061aa78b383ba59ba4f511d6d579f395113e63
child 33184 743a00e211a5d8d13eac398b39fa1e0d43c66c14
push id387
push userclokep@gmail.com
push dateMon, 10 Dec 2018 21:30:47 +0000
reviewersjorgk
bugs1487082
Bug 1487082 - fix 'Unused "kungFuDeathGrip"' errors. r=jorgk DONTBUILD Some dead-code removal and some tactical mozilla::Unused usage
mailnews/addrbook/src/nsAbLDAPDirectory.cpp
mailnews/addrbook/src/nsAbMDBDirectory.cpp
mailnews/addrbook/src/nsAddrDatabase.cpp
mailnews/base/src/nsMsgContentPolicy.cpp
mailnews/base/util/nsImapMoveCoalescer.cpp
mailnews/base/util/nsMsgUtils.cpp
mailnews/compose/src/nsSmtpService.cpp
mailnews/imap/src/nsImapIncomingServer.cpp
mailnews/imap/src/nsImapMailFolder.cpp
mailnews/imap/src/nsImapOfflineSync.cpp
mailnews/imap/src/nsImapService.cpp
mailnews/local/src/nsLocalMailFolder.cpp
mailnews/local/src/nsMsgBrkMBoxStore.cpp
mailnews/local/src/nsMsgMaildirStore.cpp
mailnews/local/src/nsParseMailbox.cpp
mailnews/news/src/nsNNTPProtocol.cpp
mailnews/news/src/nsNewsDownloader.cpp
mailnews/news/src/nsNntpService.cpp
--- a/mailnews/addrbook/src/nsAbLDAPDirectory.cpp
+++ b/mailnews/addrbook/src/nsAbLDAPDirectory.cpp
@@ -302,19 +302,16 @@ NS_IMETHODIMP nsAbLDAPDirectory::StartSe
       maxHits = kDefaultMaxHits;
 
     // get the appropriate ldap attribute map, and pass it in via the
     // TypeSpecificArgument
     nsCOMPtr<nsIAbLDAPAttributeMap> attrMap;
     rv = GetAttributeMap(getter_AddRefs(attrMap));
     NS_ENSURE_SUCCESS(rv, rv);
 
-    nsCOMPtr<nsISupports> typeSpecificArg = do_QueryInterface(attrMap, &rv);
-    NS_ENSURE_SUCCESS(rv, rv);
-
     rv = arguments->SetTypeSpecificArg(attrMap);
     NS_ENSURE_SUCCESS(rv, rv);
 
     if (!mDirectoryQuery)
     {
       mDirectoryQuery = do_CreateInstance(NS_ABLDAPDIRECTORYQUERY_CONTRACTID,
                                           &rv);
       NS_ENSURE_SUCCESS(rv, rv);
--- a/mailnews/addrbook/src/nsAbMDBDirectory.cpp
+++ b/mailnews/addrbook/src/nsAbMDBDirectory.cpp
@@ -555,16 +555,17 @@ NS_IMETHODIMP nsAbMDBDirectory::HasCard(
 NS_IMETHODIMP nsAbMDBDirectory::HasDirectory(nsIAbDirectory *dir, bool *hasDir)
 {
   if (!hasDir)
     return NS_ERROR_NULL_POINTER;
 
   nsresult rv;
 
   nsCOMPtr<nsIAbMDBDirectory> dbdir(do_QueryInterface(dir, &rv));
+  mozilla::Unused << dbdir;
   NS_ENSURE_SUCCESS(rv, rv);
 
   bool bIsMailingList  = false;
   dir->GetIsMailList(&bIsMailingList);
   if (bIsMailingList)
   {
     nsCOMPtr<nsIAddrDatabase> database;
     rv = GetDatabase(getter_AddRefs(database));
@@ -847,16 +848,17 @@ NS_IMETHODIMP nsAbMDBDirectory::OnListEn
 
   if (abCode == AB_NotifyPropertyChanged && list)
   {
     bool bIsMailList = false;
     rv = list->GetIsMailList(&bIsMailList);
     NS_ENSURE_SUCCESS(rv,rv);
 
     nsCOMPtr<nsIAbMDBDirectory> dblist(do_QueryInterface(list, &rv));
+    mozilla::Unused << dblist;
     NS_ENSURE_SUCCESS(rv,rv);
 
     if (bIsMailList) {
       nsString listName;
       rv = list->GetDirName(listName);
       NS_ENSURE_SUCCESS(rv,rv);
 
       rv = NotifyPropertyChanged(list, "DirName", nullptr, listName.get());
--- a/mailnews/addrbook/src/nsAddrDatabase.cpp
+++ b/mailnews/addrbook/src/nsAddrDatabase.cpp
@@ -586,17 +586,16 @@ NS_IMETHODIMP nsAddrDatabase::CloseMDB(b
 }
 
 // force the database to close - this'll flush out anybody holding onto
 // a database without having a listener!
 // This is evil in the com world, but there are times we need to delete the file.
 NS_IMETHODIMP nsAddrDatabase::ForceClosed()
 {
   nsresult err = NS_OK;
-  nsCOMPtr<nsIAddrDatabase> aDb(do_QueryInterface(this, &err));
 
   // make sure someone has a reference so object won't get deleted out from under us.
   NS_ADDREF_THIS();
   NotifyAnnouncerGoingAway();
   // OK, remove from cache first and close the store.
   RemoveFromCache(this);
 
   err = CloseMDB(false);    // since we're about to delete it, no need to commit.
--- a/mailnews/base/src/nsMsgContentPolicy.cpp
+++ b/mailnews/base/src/nsMsgContentPolicy.cpp
@@ -819,16 +819,17 @@ nsresult nsMsgContentPolicy::SetDisableI
   // run, so we're already safe and don't need to disable anything.
   if (!aRequestingContext) {
     return NS_OK;
   }
 
   nsresult rv;
   bool isAllowedContent = !ShouldBlockUnexposedProtocol(aContentLocation);
   nsCOMPtr<nsIMsgMessageUrl> msgUrl = do_QueryInterface(aContentLocation, &rv);
+  mozilla::Unused << msgUrl;
   if (NS_FAILED(rv) && !isAllowedContent) {
     // If it's not a mailnews url or allowed content url (http[s]|file) then
     // bail; otherwise set whether js and plugins are allowed.
     return NS_OK;
   }
 
   // since NS_CP_GetDocShellFromContext returns the containing docshell rather
   // than the contained one we need, we can't use that here, so...
@@ -1018,17 +1019,17 @@ nsMsgContentPolicy::OnLocationChange(nsI
     nsCOMPtr<nsIDocShell> docShell2;
     NS_QueryNotificationCallbacks(channel, docShell2);
     NS_ASSERTION(docShell == docShell2, "aWebProgress and channel callbacks"
                                         " do not point to the same docshell");
   }
 #endif
 
   nsCOMPtr<nsIMsgMessageUrl> messageUrl = do_QueryInterface(aLocation, &rv);
-
+  mozilla::Unused << messageUrl;
   if (NS_SUCCEEDED(rv)) {
     // Disable javascript on message URLs.
     rv = docShell->SetAllowJavascript(false);
     NS_ASSERTION(NS_SUCCEEDED(rv),
                  "Failed to set javascript disabled on docShell");
     // Also disable plugins if the preference requires it.
     rv = docShell->SetAllowPlugins(false);
     NS_ASSERTION(NS_SUCCEEDED(rv),
--- a/mailnews/base/util/nsImapMoveCoalescer.cpp
+++ b/mailnews/base/util/nsImapMoveCoalescer.cpp
@@ -107,19 +107,16 @@ nsresult nsImapMoveCoalescer::PlaybackMo
     m_sourceFolder->GetNumNewMessages(false, &oldNewMessageCount);
     if (oldNewMessageCount >= numKeysToAdd)
       oldNewMessageCount -= numKeysToAdd;
     else
       oldNewMessageCount = 0;
 
     m_sourceFolder->SetNumNewMessages(oldNewMessageCount);
 
-    nsCOMPtr <nsISupports> sourceSupports = do_QueryInterface(m_sourceFolder, &rv);
-    nsCOMPtr <nsIUrlListener> urlListener(do_QueryInterface(sourceSupports));
-
     keysToAdd.Clear();
     nsCOMPtr<nsIMsgCopyService> copySvc = do_GetService(NS_MSGCOPYSERVICE_CONTRACTID);
     if (copySvc)
     {
       nsCOMPtr <nsIMsgCopyServiceListener> listener;
       if (m_doNewMailNotification)
       {
         nsMoveCoalescerCopyListener *copyListener = new nsMoveCoalescerCopyListener(this, destFolder);
--- a/mailnews/base/util/nsMsgUtils.cpp
+++ b/mailnews/base/util/nsMsgUtils.cpp
@@ -963,16 +963,17 @@ nsresult IsRSSArticle(nsIURI * aMsgURI, 
   msgHdr->GetFlags(&flags);
   if (flags & nsMsgMessageFlags::FeedMsg)
   {
     *aIsRSSArticle = true;
     return rv;
   }
 
   nsCOMPtr<nsIMsgMailNewsUrl> mailnewsUrl = do_QueryInterface(aMsgURI, &rv);
+  mozilla::Unused << mailnewsUrl;
   NS_ENSURE_SUCCESS(rv, rv);
 
   // get the folder and the server from the msghdr
   nsCOMPtr<nsIMsgFolder> folder;
   rv = msgHdr->GetFolder(getter_AddRefs(folder));
   if (NS_SUCCEEDED(rv) && folder)
   {
     nsCOMPtr<nsIMsgIncomingServer> server;
--- a/mailnews/compose/src/nsSmtpService.cpp
+++ b/mailnews/compose/src/nsSmtpService.cpp
@@ -211,16 +211,17 @@ nsresult NS_MsgBuildSmtpUrl(nsIFile * aF
 
 nsresult NS_MsgLoadSmtpUrl(nsIURI * aUrl, nsISupports * aConsumer, nsIRequest ** aRequest)
 {
   NS_ENSURE_ARG_POINTER(aUrl);
 
   // For now, assume the url is an smtp url and load it.
   nsresult rv;
   nsCOMPtr<nsISmtpUrl> smtpUrl(do_QueryInterface(aUrl, &rv));
+  mozilla::Unused << smtpUrl;
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Create a smtp protocol instance to run the url in.
   RefPtr<nsSmtpProtocol> smtpProtocol = new nsSmtpProtocol(aUrl);
   if (!smtpProtocol)
     return NS_ERROR_OUT_OF_MEMORY;
 
   // Protocol will get destroyed when url is completed.
--- a/mailnews/imap/src/nsImapIncomingServer.cpp
+++ b/mailnews/imap/src/nsImapIncomingServer.cpp
@@ -534,17 +534,16 @@ nsImapIncomingServer::LoadNextQueuedUrl(
   nsCOMPtr <nsIImapProtocol>  protocolInstance ;
 
   MutexAutoLock mon(mLock);
   int32_t cnt = m_urlQueue.Count();
 
   while (cnt > 0 && !urlRun && keepGoing)
   {
     nsCOMPtr<nsIImapUrl> aImapUrl(m_urlQueue[0]);
-    nsCOMPtr<nsIMsgMailNewsUrl> aMailNewsUrl(do_QueryInterface(aImapUrl, &rv));
 
     bool removeUrlFromQueue = false;
     if (aImapUrl)
     {
       nsImapProtocol::LogImapUrl("considering playing queued url", aImapUrl);
       rv = DoomUrlIfChannelHasError(aImapUrl, &removeUrlFromQueue);
       NS_ENSURE_SUCCESS(rv, rv);
       // if we didn't doom the url, lets run it.
--- a/mailnews/imap/src/nsImapMailFolder.cpp
+++ b/mailnews/imap/src/nsImapMailFolder.cpp
@@ -358,16 +358,17 @@ nsresult nsImapMailFolder::AddSubfolderW
   if (NS_FAILED(rv))
     return rv;
 
   nsCOMPtr<nsIMsgFolder> folder(do_QueryInterface(res, &rv));
   NS_ENSURE_SUCCESS(rv, rv);
 
   folder->SetFilePath(dbPath);
   nsCOMPtr<nsIMsgImapMailFolder> imapFolder = do_QueryInterface(folder, &rv);
+  mozilla::Unused << imapFolder;
   NS_ENSURE_SUCCESS(rv, rv);
 
   uint32_t flags = 0;
   folder->GetFlags(&flags);
 
   folder->SetParent(this);
   flags |= nsMsgFolderFlags::Mail;
 
--- a/mailnews/imap/src/nsImapOfflineSync.cpp
+++ b/mailnews/imap/src/nsImapOfflineSync.cpp
@@ -1057,23 +1057,16 @@ nsresult nsImapOfflineSync::ProcessNextO
     {
       m_currentServer = nullptr;
       AdvanceToNextFolder();
     }
     if (m_singleFolderToUpdate)
     {
       m_singleFolderToUpdate->ClearFlag(nsMsgFolderFlags::OfflineEvents);
       m_singleFolderToUpdate->UpdateFolder(m_window);
-      nsCOMPtr<nsIMsgImapMailFolder> imapFolder(do_QueryInterface(m_singleFolderToUpdate));
-      if (imapFolder)
-      {
-        nsCOMPtr<nsIUrlListener> saveListener = m_listener;
-//        m_listener = nullptr;
-//        imapFolder->UpdateFolderWithListener(m_window, saveListener);
-      }
     }
   }
   // if we get here, then I *think* we're done. Not sure, though.
 #ifdef DEBUG_bienvenu
   printf("done with offline imap sync\n");
 #endif
   nsCOMPtr <nsIUrlListener> saveListener = m_listener;
   m_listener = nullptr;
--- a/mailnews/imap/src/nsImapService.cpp
+++ b/mailnews/imap/src/nsImapService.cpp
@@ -1824,17 +1824,16 @@ NS_IMETHODIMP nsImapService::DiscoverAll
   {
     rv = SetImapUrlSink(aImapMailFolder, imapUrl);
 
     if (NS_SUCCEEDED(rv))
     {
       nsCOMPtr<nsIMsgMailNewsUrl> mailnewsurl = do_QueryInterface(imapUrl);
       mailnewsurl->SetMsgWindow(aMsgWindow);
       urlSpec.AppendLiteral("/discoverallboxes");
-      nsCOMPtr <nsIURI> url = do_QueryInterface(imapUrl, &rv);
       rv = mailnewsurl->SetSpecInternal(urlSpec);
       if (NS_SUCCEEDED(rv))
         rv = GetImapConnectionAndLoadUrl(imapUrl, nullptr, aURL);
     }
   }
   return rv;
 }
 
--- a/mailnews/local/src/nsLocalMailFolder.cpp
+++ b/mailnews/local/src/nsLocalMailFolder.cpp
@@ -2004,16 +2004,17 @@ NS_IMETHODIMP nsMsgLocalMailFolder::GetN
   NS_ENSURE_SUCCESS(rv, NS_MSG_INVALID_OR_MISSING_SERVER);
 
   nsCOMPtr<nsILocalMailIncomingServer> localMailServer = do_QueryInterface(server, &rv);
   NS_ENSURE_SUCCESS(rv, NS_MSG_INVALID_OR_MISSING_SERVER);
 
   // XXX todo, move all this into nsILocalMailIncomingServer's GetNewMail
   // so that we don't have to have RSS foo here.
   nsCOMPtr<nsIRssIncomingServer> rssServer = do_QueryInterface(server, &rv);
+  mozilla::Unused << rssServer;
   if (NS_SUCCEEDED(rv))
     return localMailServer->GetNewMail(aWindow, aListener, this, nullptr);
 
   nsCOMPtr<nsIMsgFolder> inbox;
   nsCOMPtr<nsIMsgFolder> rootFolder;
   rv = server->GetRootMsgFolder(getter_AddRefs(rootFolder));
   if (NS_SUCCEEDED(rv) && rootFolder)
   {
@@ -3269,16 +3270,17 @@ nsMsgLocalMailFolder::OnStopRunningUrl(n
       mReparseListener = nullptr;
       saveReparseListener->OnStopRunningUrl(aUrl, aExitCode);
     }
   }
   if (mFlags & nsMsgFolderFlags::Inbox)
   {
     // if we are the inbox and running pop url
     nsCOMPtr<nsIPop3URL> popurl = do_QueryInterface(aUrl, &rv);
+    mozilla::Unused << popurl;
     if (NS_SUCCEEDED(rv))
     {
       nsCOMPtr<nsIMsgIncomingServer> server;
       GetServer(getter_AddRefs(server));
       // this is the deferred to account, in the global inbox case
       if (server)
         server->SetPerformingBiff(false);  //biff is over
     }
--- a/mailnews/local/src/nsMsgBrkMBoxStore.cpp
+++ b/mailnews/local/src/nsMsgBrkMBoxStore.cpp
@@ -338,18 +338,16 @@ NS_IMETHODIMP nsMsgBrkMBoxStore::RenameF
   if (NS_FAILED(rv))
     return rv;
 
   nsCOMPtr<nsIMsgFolder> parentFolder;
   rv = aFolder->GetParent(getter_AddRefs(parentFolder));
   if (!parentFolder)
     return NS_ERROR_NULL_POINTER;
 
-  nsCOMPtr<nsISupports> parentSupport = do_QueryInterface(parentFolder);
-
   nsCOMPtr<nsIFile> oldSummaryFile;
   rv = aFolder->GetSummaryFile(getter_AddRefs(oldSummaryFile));
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr<nsIFile> dirFile;
   oldPathFile->Clone(getter_AddRefs(dirFile));
 
   if (numChildren > 0)
--- a/mailnews/local/src/nsMsgMaildirStore.cpp
+++ b/mailnews/local/src/nsMsgMaildirStore.cpp
@@ -411,17 +411,16 @@ NS_IMETHODIMP nsMsgMaildirStore::CopyFol
   nsAutoString folderName;
   if (aNewName.IsEmpty())
     aSrcFolder->GetName(folderName);
   else
     folderName.Assign(aNewName);
 
   nsAutoString safeFolderName(folderName);
   NS_MsgHashIfNecessary(safeFolderName);
-  nsCOMPtr<nsIMsgLocalMailFolder> localSrcFolder(do_QueryInterface(aSrcFolder));
   aSrcFolder->ForceDBClosed();
 
   nsCOMPtr<nsIFile> oldPath;
   nsresult rv = aSrcFolder->GetFilePath(getter_AddRefs(oldPath));
   NS_ENSURE_SUCCESS(rv,rv);
 
   nsCOMPtr<nsIFile> summaryFile;
   GetSummaryFileLocation(oldPath, getter_AddRefs(summaryFile));
--- a/mailnews/local/src/nsParseMailbox.cpp
+++ b/mailnews/local/src/nsParseMailbox.cpp
@@ -2399,17 +2399,16 @@ nsresult nsParseNewMailState::EndMsgDown
   return rv;
 }
 
 nsresult nsParseNewMailState::AppendMsgFromStream(nsIInputStream *fileStream,
                                                   nsIMsgDBHdr *aHdr,
                                                   uint32_t length,
                                                   nsIMsgFolder *destFolder)
 {
-  nsCOMPtr <nsISeekableStream> seekableStream = do_QueryInterface(fileStream);
   nsCOMPtr<nsIMsgPluggableStore> store;
   nsCOMPtr<nsIOutputStream> destOutputStream;
   nsresult rv = destFolder->GetMsgStore(getter_AddRefs(store));
   NS_ENSURE_SUCCESS(rv, rv);
   bool reusable;
   rv = store->GetNewMsgOutputStream(destFolder, &aHdr, &reusable,
                                     getter_AddRefs(destOutputStream));
   NS_ENSURE_SUCCESS(rv, rv);
--- a/mailnews/news/src/nsNNTPProtocol.cpp
+++ b/mailnews/news/src/nsNNTPProtocol.cpp
@@ -2212,18 +2212,16 @@ nsresult nsNNTPProtocol::ReadArticle(nsI
   {
     mBytesReceived += status;
     mBytesReceivedSinceLastStatusUpdate += status;
   }
 
   if(!line)
     return rv;  /* no line yet or error */
 
-  nsCOMPtr<nsISupports> ctxt = do_QueryInterface(m_runningURL);
-
   if (m_typeWanted == CANCEL_WANTED && m_responseCode != MK_NNTP_RESPONSE_ARTICLE_HEAD)
   {
     /* HEAD command failed. */
     PR_FREEIF(line);
     return NS_ERROR_FAILURE;
   }
 
   if (line[0] == '.' && line[MSG_LINEBREAK_LEN + 1] == 0)
@@ -3002,17 +3000,16 @@ nsresult nsNNTPProtocol::BeginReadXover(
   return NS_OK;
 }
 
 nsresult nsNNTPProtocol::FigureNextChunk()
 {
     nsresult rv = NS_OK;
   int32_t status = 0;
 
-  nsCOMPtr<nsIMsgMailNewsUrl> mailnewsurl = do_QueryInterface(m_runningURL);
   if (m_firstArticle > 0)
   {
       MOZ_LOG(NNTP, LogLevel::Info,("(%p) add to known articles:  %d - %d", this, m_firstArticle, m_lastArticle));
 
       if (NS_SUCCEEDED(rv) && m_newsgroupList) {
           rv = m_newsgroupList->AddToKnownArticles(m_firstArticle,
                                                  m_lastArticle);
       }
--- a/mailnews/news/src/nsNewsDownloader.cpp
+++ b/mailnews/news/src/nsNewsDownloader.cpp
@@ -170,17 +170,16 @@ bool nsNewsDownloader::GetNextHdrToRetri
     if (percent < 100)  // always need to do 100%
     {
       nowMS = PR_IntervalToMilliseconds(PR_IntervalNow());
       if (nowMS - m_lastProgressTime < 750)
         return true;
     }
 
     m_lastProgressTime = nowMS;
-    nsCOMPtr <nsIMsgNewsFolder> newsFolder = do_QueryInterface(m_folder);
     nsCOMPtr<nsIStringBundleService> bundleService =
       mozilla::services::GetStringBundleService();
     NS_ENSURE_TRUE(bundleService, false);
     nsCOMPtr<nsIStringBundle> bundle;
     rv = bundleService->CreateBundle(NEWS_MSGS_URL, getter_AddRefs(bundle));
     NS_ENSURE_SUCCESS(rv, false);
 
     nsAutoString firstStr;
--- a/mailnews/news/src/nsNntpService.cpp
+++ b/mailnews/news/src/nsNntpService.cpp
@@ -349,16 +349,17 @@ nsresult nsNntpService::GetMessageFromUr
 }
 
 NS_IMETHODIMP
 nsNntpService::FetchMessage(nsIMsgFolder *folder, nsMsgKey key, nsIMsgWindow *aMsgWindow, nsISupports * aConsumer, nsIUrlListener * aUrlListener, nsIURI ** aURL)
 {
   NS_ENSURE_ARG_POINTER(folder);
   nsresult rv;
   nsCOMPtr<nsIMsgNewsFolder> msgNewsFolder = do_QueryInterface(folder, &rv);
+  mozilla::Unused << msgNewsFolder;
   NS_ENSURE_SUCCESS(rv,rv);
 
   nsCOMPtr <nsIMsgDBHdr> hdr;
   rv = folder->GetMessageHeader(key, getter_AddRefs(hdr));
   NS_ENSURE_SUCCESS(rv,rv);
 
   nsCString originalMessageUri;
   rv = folder->GetUriForMsg(hdr, originalMessageUri);