Bug 1269316 - Port bug 1193762 to comm-central (bustage fix). r=mkmelin a=bustage fix on a CLOSED TREE
authorFrank-Rainer Grahl <frgrahl@gmx.net>
Mon, 02 May 2016 05:51:00 +0200
changeset 19286 66dea6d980f6fed6009e03a206c8076e5f7bb4b4
parent 19285 10c1a275b3cdf0e6afb0b65b4cc86332d47869c5
child 19287 05fa88baaef385cd48ccfdcc84f6cf54797cad97
push id11854
push usermozilla@jorgk.com
push dateMon, 02 May 2016 20:24:04 +0000
treeherdercomm-central@66dea6d980f6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmkmelin, bustage
bugs1269316, 1193762
Bug 1269316 - Port bug 1193762 to comm-central (bustage fix). r=mkmelin a=bustage fix on a CLOSED TREE
calendar/base/backend/libical/calDateTime.cpp
calendar/base/backend/libical/calRecurrenceRule.cpp
ldap/xpcom/src/nsLDAPOperation.cpp
mailnews/db/msgdb/src/nsMsgDatabase.cpp
mailnews/imap/src/nsImapMailFolder.cpp
--- a/calendar/base/backend/libical/calDateTime.cpp
+++ b/calendar/base/backend/libical/calDateTime.cpp
@@ -152,17 +152,18 @@ calDateTime::GetTimezoneOffset(int32_t *
     return NS_OK;
 }
 
 NS_IMETHODIMP
 calDateTime::SetNativeTime(PRTime aNativeTime)
 {
     icaltimetype icalt;
     PRTimeToIcaltime(aNativeTime, false, icaltimezone_get_utc_timezone(), &icalt);
-    FromIcalTime(&icalt, cal::UTC());
+    nsCOMPtr<calITimezone> ctz = cal::UTC();
+    FromIcalTime(&icalt, ctz);
     return NS_OK;
 }
 
 NS_IMETHODIMP
 calDateTime::AddDuration(calIDuration *aDuration)
 {
     NS_ENSURE_FALSE(mImmutable, NS_ERROR_OBJECT_IS_IMMUTABLE);
     NS_ENSURE_ARG_POINTER(aDuration);
@@ -468,22 +469,24 @@ void calDateTime::FromIcalTime(icaltimet
     if (tz) {
         mTimezone = tz;
     } else {
         mTimezone = cal::detectTimezone(t, nullptr);
     }
 #if defined(DEBUG)
     if (mTimezone) {
         if (t.is_utc) {
-            NS_ASSERTION(SameCOMIdentity(mTimezone, cal::UTC()), "UTC mismatch!");
+            nsCOMPtr<calITimezone> ctz = cal::UTC();
+            NS_ASSERTION(SameCOMIdentity(mTimezone, ctz), "UTC mismatch!");
         } else if (!t.zone) {
             nsAutoCString tzid;
             mTimezone->GetTzid(tzid);
             if (tzid.EqualsLiteral("floating")) {
-                NS_ASSERTION(SameCOMIdentity(mTimezone, cal::floating()), "floating mismatch!");
+                nsCOMPtr<calITimezone> ctz = cal::floating();
+                NS_ASSERTION(SameCOMIdentity(mTimezone, ctz), "floating mismatch!");
             }
         } else {
             nsAutoCString tzid;
             mTimezone->GetTzid(tzid);
             NS_ASSERTION(tzid.Equals(icaltimezone_get_tzid(const_cast<icaltimezone *>(t.zone))),
                          "tzid mismatch!");
         }
     }
--- a/calendar/base/backend/libical/calRecurrenceRule.cpp
+++ b/calendar/base/backend/libical/calRecurrenceRule.cpp
@@ -183,17 +183,17 @@ calRecurrenceRule::GetUntilDate(calIDate
         return NS_ERROR_FAILURE;
 
     if (!icaltime_is_null_time(mIcalRecur.until)) {
         *aRecurEnd = new calDateTime(&mIcalRecur.until, nullptr);
         CAL_ENSURE_MEMORY(*aRecurEnd);
         NS_ADDREF(*aRecurEnd);
     } else {
         // infinite recurrence
-        *aRecurEnd = nullptr; 
+        *aRecurEnd = nullptr;
     }
     return NS_OK;
 }
 
 NS_IMETHODIMP
 calRecurrenceRule::SetUntilDate(calIDateTime * aRecurEnd)
 {
     if (aRecurEnd) {
@@ -202,17 +202,18 @@ calRecurrenceRule::SetUntilDate(calIDate
         nsCOMPtr<calIDateTimeLibical> icaldt;
         nsCOMPtr<calITimezone> tz;
         aRecurEnd->GetTimezone(getter_AddRefs(tz));
 
         if (NS_SUCCEEDED(tz->GetIsUTC(&b)) && !b &&
             NS_SUCCEEDED(tz->GetIsFloating(&b)) && !b) {
             // convert to UTC:
             nsCOMPtr<calIDateTime> dt;
-            aRecurEnd->GetInTimezone(cal::UTC(), getter_AddRefs(dt));
+            nsCOMPtr<calITimezone> ctz = cal::UTC();
+            aRecurEnd->GetInTimezone(ctz, getter_AddRefs(dt));
             icaldt = do_QueryInterface(dt, &rv);
         } else {
             icaldt = do_QueryInterface(aRecurEnd, &rv);
         }
 
         NS_ENSURE_SUCCESS(rv, rv);
         struct icaltimetype itt;
         icaldt->ToIcalTime(&itt);
--- a/ldap/xpcom/src/nsLDAPOperation.cpp
+++ b/ldap/xpcom/src/nsLDAPOperation.cpp
@@ -269,17 +269,17 @@ nsLDAPOperation::SimpleBind(const nsACSt
     // Then, if we get called again w/o a password, use the
     // saved one. Getting called again means we're trying to
     // fall back to VERSION2.
     // Since LDAP operations are thrown away when done, it won't stay
     // around in memory.
     if (!passwd.IsEmpty())
       mSavePassword = passwd;
 
-    NS_PRECONDITION(mMessageListener != 0, "MessageListener not set");
+    NS_PRECONDITION(mMessageListener, "MessageListener not set");
 
     rv = connection->GetBindName(bindName);
     if (NS_FAILED(rv))
         return rv;
 
     MOZ_LOG(gLDAPLogModule, mozilla::LogLevel::Debug,
            ("nsLDAPOperation::SimpleBind(): called; bindName = '%s'; ",
             bindName.get()));
@@ -515,17 +515,17 @@ nsLDAPOperation::GetMessageID(int32_t *a
 // that has already been abandoned does not return an error
 //
 NS_IMETHODIMP
 nsLDAPOperation::AbandonExt()
 {
     nsresult rv;
     nsresult retStatus = NS_OK;
 
-    if ( mMessageListener == 0 || mMsgID == 0 ) {
+    if (!mMessageListener || mMsgID == 0) {
         NS_ERROR("nsLDAPOperation::AbandonExt(): mMessageListener or "
                  "mMsgId not initialized");
         return NS_ERROR_NOT_INITIALIZED;
     }
 
     // XXX handle controls here
     if (mServerControls || mClientControls) {
         return NS_ERROR_NOT_IMPLEMENTED;
@@ -591,17 +591,17 @@ NS_IMETHODIMP nsLDAPOperation::SetServer
 // wrappers for ldap_add_ext
 //
 nsresult
 nsLDAPOperation::AddExt(const char *base,
                         nsIArray *mods,
                         LDAPControl **serverctrls,
                         LDAPControl **clientctrls)
 {
-  if (mMessageListener == 0) {
+  if (!mMessageListener) {
     NS_ERROR("nsLDAPOperation::AddExt(): mMessageListener not set");
     return NS_ERROR_NOT_INITIALIZED;
   }
 
   LDAPMod **attrs = 0;
   int retVal = LDAP_SUCCESS;
   uint32_t modCount = 0;
   nsresult rv = mods->GetLength(&modCount);
@@ -705,17 +705,17 @@ nsLDAPOperation::AddExt(const nsACString
 
 // wrappers for ldap_delete_ext
 //
 nsresult
 nsLDAPOperation::DeleteExt(const char *base,
                            LDAPControl **serverctrls,
                            LDAPControl **clientctrls)
 {
-  if (mMessageListener == 0) {
+  if (!mMessageListener) {
     NS_ERROR("nsLDAPOperation::DeleteExt(): mMessageListener not set");
     return NS_ERROR_NOT_INITIALIZED;
   }
 
   return TranslateLDAPErrorToNSError(ldap_delete_ext(mConnectionHandle, base,
                                                      serverctrls, clientctrls,
                                                      &mMsgID));
 }
@@ -756,17 +756,17 @@ nsLDAPOperation::DeleteExt(const nsACStr
 // wrappers for ldap_modify_ext
 //
 nsresult
 nsLDAPOperation::ModifyExt(const char *base,
                            nsIArray *mods,
                            LDAPControl **serverctrls,
                            LDAPControl **clientctrls)
 {
-  if (mMessageListener == 0) {
+  if (!mMessageListener) {
     NS_ERROR("nsLDAPOperation::ModifyExt(): mMessageListener not set");
     return NS_ERROR_NOT_INITIALIZED;
   }
 
   LDAPMod **attrs = 0;
   int retVal = 0;
   uint32_t modCount = 0;
   nsresult rv = mods->GetLength(&modCount);
@@ -871,17 +871,17 @@ nsLDAPOperation::ModifyExt(const nsACStr
 nsresult
 nsLDAPOperation::Rename(const char *base,
                         const char *newRDn,
                         const char *newParent,
                         bool deleteOldRDn,
                         LDAPControl **serverctrls,
                         LDAPControl **clientctrls)
 {
-  if (mMessageListener == 0) {
+  if (!mMessageListener) {
     NS_ERROR("nsLDAPOperation::Rename(): mMessageListener not set");
     return NS_ERROR_NOT_INITIALIZED;
   }
 
   return TranslateLDAPErrorToNSError(ldap_rename(mConnectionHandle, base,
                                                  newRDn, newParent,
                                                  deleteOldRDn, serverctrls,
                                                  clientctrls, &mMsgID));
--- a/mailnews/db/msgdb/src/nsMsgDatabase.cpp
+++ b/mailnews/db/msgdb/src/nsMsgDatabase.cpp
@@ -4757,17 +4757,17 @@ nsresult nsMsgDatabase::GetThreadForMsgK
   return rv;
 }
 
 // caller needs to unrefer.
 nsIMsgThread *  nsMsgDatabase::GetThreadForThreadId(nsMsgKey threadId)
 {
 
   nsIMsgThread *retThread = (threadId == m_cachedThreadId && m_cachedThread) ?
-    m_cachedThread : FindExistingThread(threadId);
+    m_cachedThread.get() : FindExistingThread(threadId);
   if (retThread)
   {
     NS_ADDREF(retThread);
     return retThread;
   }
   if (m_mdbStore)
   {
     mdbOid tableId;
--- a/mailnews/imap/src/nsImapMailFolder.cpp
+++ b/mailnews/imap/src/nsImapMailFolder.cpp
@@ -2229,17 +2229,17 @@ NS_IMETHODIMP nsImapMailFolder::DeleteMe
 
   if (!deleteImmediatelyNoTrash)
   {
     rv = GetRootFolder(getter_AddRefs(rootFolder));
     if (NS_SUCCEEDED(rv) && rootFolder)
     {
       rootFolder->GetFolderWithFlags(nsMsgFolderFlags::Trash,
                                      getter_AddRefs(trashFolder));
-      NS_ASSERTION(trashFolder != 0, "couldn't find trash");
+      NS_ASSERTION(trashFolder, "couldn't find trash");
       // if we can't find the trash, we'll just have to do an imap delete and pretend this is the trash
       if (!trashFolder)
         deleteImmediatelyNoTrash = true;
     }
   }
 
   if ((NS_SUCCEEDED(rv) && deleteImmediatelyNoTrash) || deleteModel == nsMsgImapDeleteModels::IMAPDelete )
   {