Bug 1494742 - Port bug 1493276: Fix static assert errors 'don't use CallQueryInterface for compile-time-determinable casts'. r=mccr8
authorJorg K <jorgk@jorgk.com>
Thu, 27 Sep 2018 23:44:19 +0200
changeset 33251 42e6ccd2c53e639340431048801fad49eed08006
parent 33250 d9356caafc10dcb3870ad63f23fda19bc9d8d5ad
child 33252 add9c2d8bfd0f196e689b1ea86849acfeb035451
push id387
push userclokep@gmail.com
push dateMon, 10 Dec 2018 21:30:47 +0000
reviewersmccr8
bugs1494742, 1493276
Bug 1494742 - Port bug 1493276: Fix static assert errors 'don't use CallQueryInterface for compile-time-determinable casts'. r=mccr8
calendar/base/backend/libical/calICSService.cpp
mailnews/compose/src/nsSmtpService.cpp
mailnews/db/msgdb/src/nsMsgDatabase.cpp
mailnews/local/src/nsMailboxService.cpp
mailnews/local/src/nsPop3Service.cpp
mailnews/mime/src/nsSimpleMimeConverterStub.cpp
--- a/calendar/base/backend/libical/calICSService.cpp
+++ b/calendar/base/backend/libical/calICSService.cpp
@@ -1004,17 +1004,19 @@ calIcalComponent::SerializeToICSStream(n
     nsCOMPtr<nsIStringInputStream> aStringStream(
         do_CreateInstance(NS_STRINGINPUTSTREAM_CONTRACTID, &rv));
     NS_ENSURE_SUCCESS(rv, rv);
     // copies the string into the input stream that's handed back.
     // This copy is necessary because we don't really own icalstr;
     // it's one of libical's ring buffers
     rv = aStringStream->SetData(icalstr, -1);
     NS_ENSURE_SUCCESS(rv, rv);
-    return CallQueryInterface(aStringStream, aStreamResult);
+
+    aStringStream.forget(aStreamResult);
+    return NS_OK;
 }
 
 nsresult
 calIcalComponent::Serialize(char **icalstr)
 {
     NS_ENSURE_ARG_POINTER(icalstr);
 
     // add the timezone bits
--- a/mailnews/compose/src/nsSmtpService.cpp
+++ b/mailnews/compose/src/nsSmtpService.cpp
@@ -223,17 +223,18 @@ nsresult NS_MsgLoadSmtpUrl(nsIURI * aUrl
   RefPtr<nsSmtpProtocol> smtpProtocol = new nsSmtpProtocol(aUrl);
   if (!smtpProtocol)
     return NS_ERROR_OUT_OF_MEMORY;
 
   // Protocol will get destroyed when url is completed.
   rv = smtpProtocol->LoadUrl(aUrl, aConsumer);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  return CallQueryInterface(smtpProtocol.get(), aRequest);
+  smtpProtocol.forget(aRequest);
+  return NS_OK;
 }
 
 NS_IMETHODIMP nsSmtpService::VerifyLogon(nsISmtpServer *aServer,
                                          nsIUrlListener *aUrlListener,
                                          nsIMsgWindow *aMsgWindow,
                                          nsIURI **aURL)
 {
   NS_ENSURE_ARG_POINTER(aServer);
--- a/mailnews/db/msgdb/src/nsMsgDatabase.cpp
+++ b/mailnews/db/msgdb/src/nsMsgDatabase.cpp
@@ -3026,17 +3026,19 @@ nsMsgDatabase::GetFilterEnumerator(nsIAr
   NS_ENSURE_ARG_POINTER(aResult);
   RefPtr<nsMsgFilteredDBEnumerator> e =
     new nsMsgFilteredDBEnumerator(this, m_mdbAllMsgHeadersTable, aReverse,
                                   searchTerms);
 
   NS_ENSURE_TRUE(e, NS_ERROR_OUT_OF_MEMORY);
   nsresult rv = e->InitSearchSession(searchTerms, m_folder);
   NS_ENSURE_SUCCESS(rv, rv);
-  return CallQueryInterface(e.get(), aResult);
+
+  e.forget(aResult);
+  return NS_OK;
 }
 
 NS_IMETHODIMP
 nsMsgDatabase::NextMatchingHdrs(nsISimpleEnumerator *aEnumerator,
                                 int32_t aNumHdrsToLookAt, int32_t aMaxResults,
                                 nsIMutableArray *aMatchingHdrs,
                                 int32_t *aNumMatches, bool *aResult)
 {
--- a/mailnews/local/src/nsMailboxService.cpp
+++ b/mailnews/local/src/nsMailboxService.cpp
@@ -602,17 +602,18 @@ NS_IMETHODIMP nsMailboxService::NewChann
   }
 
   rv = protocol->Initialize(aURI);
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = protocol->SetLoadInfo(aLoadInfo);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  return CallQueryInterface(protocol, _retval);
+  protocol.forget(_retval);
+  return NS_OK;
 }
 
 nsresult nsMailboxService::DisplayMessageForPrinting(const char* aMessageURI,
                                                      nsISupports * aDisplayConsumer,
                                                      nsIMsgWindow * aMsgWindow,
                                                      nsIUrlListener * aUrlListener,
                                                      nsIURI ** aURL)
 {
--- a/mailnews/local/src/nsPop3Service.cpp
+++ b/mailnews/local/src/nsPop3Service.cpp
@@ -513,17 +513,18 @@ NS_IMETHODIMP nsPop3Service::NewChannel2
   rv = protocol->Initialize(aURI);
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = protocol->SetLoadInfo(aLoadInfo);
   NS_ENSURE_SUCCESS(rv, rv);
 
   protocol->SetUsername(realUserName.get());
 
-  return CallQueryInterface(protocol, _retval);
+  protocol.forget(_retval);
+  return NS_OK;
 }
 
 
 NS_IMETHODIMP
 nsPop3Service::SetDefaultLocalPath(nsIFile *aPath)
 {
     NS_ENSURE_ARG(aPath);
     return NS_SetPersistentFile(PREF_MAIL_ROOT_POP3_REL, PREF_MAIL_ROOT_POP3, aPath);
--- a/mailnews/mime/src/nsSimpleMimeConverterStub.cpp
+++ b/mailnews/mime/src/nsSimpleMimeConverterStub.cpp
@@ -200,10 +200,11 @@ nsSimpleMimeConverterStub::CreateContent
 
 nsresult
 MIME_NewSimpleMimeConverterStub(const char *aContentType,
                                 nsIMimeContentTypeHandler **aResult)
 {
     RefPtr<nsSimpleMimeConverterStub> inst = new nsSimpleMimeConverterStub(aContentType);
     NS_ENSURE_TRUE(inst, NS_ERROR_OUT_OF_MEMORY);
 
-    return CallQueryInterface(inst.get(), aResult);
+    inst.forget(aResult);
+    return NS_OK;
 }