Bug 1342003 - convert some QueryInterface(NS_GET_IID(),) occurences to do_QueryInterface(). r=jorgk
authoraceman <acelists@atlas.sk>
Wed, 08 Mar 2017 15:21:00 +0100
changeset 21284 671537074650c774078be7374aa61145405099b8
parent 21283 07b68e86a6928b6c33f98c4d4eb8692408a1d7d2
child 21285 d005000364d48c33c17e2c83cd11242320d81cde
push id12935
push usermozilla@jorgk.com
push dateSat, 11 Mar 2017 08:10:08 +0000
treeherdercomm-central@6c8ca70fc623 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorgk
bugs1342003
Bug 1342003 - convert some QueryInterface(NS_GET_IID(),) occurences to do_QueryInterface(). r=jorgk
mail/components/migration/src/nsMailProfileMigratorUtils.cpp
mailnews/compose/src/nsMsgAttachmentHandler.cpp
mailnews/compose/src/nsMsgComposeService.cpp
mailnews/import/src/nsImportAddressBooks.cpp
mailnews/local/src/nsLocalMailFolder.cpp
mailnews/local/src/nsMailboxProtocol.cpp
--- a/mail/components/migration/src/nsMailProfileMigratorUtils.cpp
+++ b/mail/components/migration/src/nsMailProfileMigratorUtils.cpp
@@ -83,12 +83,12 @@ GetProfilePath(nsIProfileStartup* aStart
   if (aStartup) {
     aStartup->GetDirectory(getter_AddRefs(aProfileDir));
   }
   else {
     nsCOMPtr<nsIProperties> dirSvc
       (do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID));
     if (dirSvc) {
       dirSvc->Get(NS_APP_USER_PROFILE_50_DIR, NS_GET_IID(nsIFile),
-                  (void**) getter_AddRefs(aProfileDir));
+                  getter_AddRefs(aProfileDir));
     }
   }
 }
--- a/mailnews/compose/src/nsMsgAttachmentHandler.cpp
+++ b/mailnews/compose/src/nsMsgAttachmentHandler.cpp
@@ -617,18 +617,17 @@ nsMsgAttachmentHandler::SnarfMsgAttachme
 
     rv = fetcher->Initialize(mTmpFile, mOutFile, FetcherURLDoneCallback, this);
     rv = GetMessageServiceFromURI(m_uri, getter_AddRefs(messageService));
     if (NS_SUCCEEDED(rv) && messageService)
     {
       nsAutoCString uri(m_uri);
       uri += (uri.FindChar('?') == kNotFound) ? '?' : '&';
       uri.Append("fetchCompleteMessage=true");
-      nsCOMPtr<nsIStreamListener> strListener;
-      fetcher->QueryInterface(NS_GET_IID(nsIStreamListener), getter_AddRefs(strListener));
+      nsCOMPtr<nsIStreamListener> strListener = do_QueryInterface(fetcher);
 
       // initialize a new stream converter, that uses the strListener as its input
       // obtain the input stream listener from the new converter,
       // and pass the converter's input stream listener to DisplayMessage
 
       m_mime_parser = do_CreateInstance(NS_MAILNEWS_MIME_STREAM_CONVERTER_CONTRACTID, &rv);
       if (NS_FAILED(rv))
         goto done;
--- a/mailnews/compose/src/nsMsgComposeService.cpp
+++ b/mailnews/compose/src/nsMsgComposeService.cpp
@@ -471,18 +471,17 @@ nsMsgComposeService::OpenComposeWindow(c
   return rv;
 }
 
 NS_IMETHODIMP nsMsgComposeService::GetParamsForMailto(nsIURI * aURI, nsIMsgComposeParams ** aParams)
 {
   nsresult rv = NS_OK;
   if (aURI)
   {
-    nsCOMPtr<nsIMailtoUrl> aMailtoUrl;
-    rv = aURI->QueryInterface(NS_GET_IID(nsIMailtoUrl), getter_AddRefs(aMailtoUrl));
+    nsCOMPtr<nsIMailtoUrl> aMailtoUrl = do_QueryInterface(aURI, &rv);
     if (NS_SUCCEEDED(rv))
     {
        MSG_ComposeFormat requestedComposeFormat = nsIMsgCompFormat::Default;
        nsCString toPart;
        nsCString ccPart;
        nsCString bccPart;
        nsCString subjectPart;
        nsCString bodyPart;
--- a/mailnews/import/src/nsImportAddressBooks.cpp
+++ b/mailnews/import/src/nsImportAddressBooks.cpp
@@ -286,18 +286,17 @@ NS_IMETHODIMP nsImportGenericAddressBook
     }
 
     if (m_pInterface)
       m_pInterface->SetSampleLocation(m_pLocation);
   }
 
   if (!PL_strcasecmp(dataId, "addressDestination")) {
     if (item) {
-      nsCOMPtr<nsISupportsCString> abString;
-      item->QueryInterface(NS_GET_IID(nsISupportsCString), getter_AddRefs(abString));
+      nsCOMPtr<nsISupportsCString> abString = do_QueryInterface(item);
       if (abString) {
         if (m_pDestinationUri)
           NS_Free(m_pDestinationUri);
         m_pDestinationUri = nullptr;
                 nsAutoCString tempUri;
                 abString->GetData(tempUri);
                 m_pDestinationUri = ToNewCString(tempUri);
       }
--- a/mailnews/local/src/nsLocalMailFolder.cpp
+++ b/mailnews/local/src/nsLocalMailFolder.cpp
@@ -718,17 +718,17 @@ nsresult nsMsgLocalMailFolder::IsChildOf
   if (parentFlags & nsMsgFolderFlags::Trash)
   {
     *result = true;
     return rv;
   }
 
   nsCOMPtr<nsIMsgFolder> parentFolder;
   nsCOMPtr<nsIMsgFolder> thisFolder;
-  rv = QueryInterface(NS_GET_IID(nsIMsgFolder), (void **) getter_AddRefs(thisFolder));
+  rv = QueryInterface(NS_GET_IID(nsIMsgFolder), getter_AddRefs(thisFolder));
 
   while (!isServer)
   {
     thisFolder->GetParent(getter_AddRefs(parentFolder));
     if (!parentFolder)
       return NS_OK;
 
     rv = parentFolder->GetIsServer(&isServer);
--- a/mailnews/local/src/nsMailboxProtocol.cpp
+++ b/mailnews/local/src/nsMailboxProtocol.cpp
@@ -80,17 +80,17 @@ nsresult nsMailboxProtocol::OpenMultiple
 }
 
 nsresult nsMailboxProtocol::Initialize(nsIURI * aURL)
 {
   NS_PRECONDITION(aURL, "invalid URL passed into MAILBOX Protocol");
   nsresult rv = NS_OK;
   if (aURL)
   {
-    rv = aURL->QueryInterface(NS_GET_IID(nsIMailboxUrl), (void **) getter_AddRefs(m_runningUrl));
+    m_runningUrl = do_QueryInterface(aURL, &rv);
     if (NS_SUCCEEDED(rv) && m_runningUrl)
     {
       nsCOMPtr <nsIMsgWindow> window;
       rv = m_runningUrl->GetMailboxAction(&m_mailboxAction);
       // clear stopped flag on msg window, because we care.
       nsCOMPtr <nsIMsgMailNewsUrl> mailnewsUrl = do_QueryInterface(m_runningUrl);
       if (mailnewsUrl)
       {