Bug 583618 Fix PRBool misuses in mailnews. r/sr=Neil. Bustage fix for CLOSED TREE
authorMark Banner <bugzilla@standard8.plus.com>
Mon, 02 Aug 2010 10:57:42 +0100
changeset 6055 af27e33d07dedb6f504f46f68c36ed152bef932d
parent 6054 d76f0693764440ef142a41f374d939f0d5d48006
child 6056 e8157cc88f5a3dab60a787ad08203d5b77f093c6
push id4682
push userbugzilla@standard8.plus.com
push dateMon, 02 Aug 2010 09:58:24 +0000
treeherdercomm-central@af27e33d07de [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs583618
Bug 583618 Fix PRBool misuses in mailnews. r/sr=Neil. Bustage fix for CLOSED TREE
mailnews/db/msgdb/src/nsDBFolderInfo.cpp
mailnews/db/msgdb/src/nsMsgDatabase.cpp
--- a/mailnews/db/msgdb/src/nsDBFolderInfo.cpp
+++ b/mailnews/db/msgdb/src/nsDBFolderInfo.cpp
@@ -661,16 +661,17 @@ nsDBFolderInfo::GetEffectiveCharacterSet
 NS_IMETHODIMP nsDBFolderInfo::SetCharacterSet(const nsACString &charSet)
 {
   m_charSet.Assign(charSet);
   return SetCharProperty(kCharacterSetColumnName, charSet);
 }
 
 NS_IMETHODIMP nsDBFolderInfo::GetCharacterSetOverride(PRBool *characterSetOverride)
 {
+  NS_ENSURE_ARG_POINTER(characterSetOverride);
   *characterSetOverride = m_charSetOverride;
   return NS_OK;
 }
 
 NS_IMETHODIMP nsDBFolderInfo::SetCharacterSetOverride(PRBool characterSetOverride)
 {
   m_charSetOverride = characterSetOverride;
   return SetUint32Property(kCharacterSetOverrideColumnName, characterSetOverride);
--- a/mailnews/db/msgdb/src/nsMsgDatabase.cpp
+++ b/mailnews/db/msgdb/src/nsMsgDatabase.cpp
@@ -2039,31 +2039,31 @@ nsresult nsMsgDatabase::IsHeaderRead(nsI
 {
   if (!msgHdr)
     return NS_MSG_MESSAGE_NOT_FOUND;
 
   nsMsgHdr* hdr = static_cast<nsMsgHdr*>(msgHdr);          // closed system, cast ok
   // can't call GetFlags, because it will be recursive.
   PRUint32 flags;
   hdr->GetRawFlags(&flags);
-  *pRead = (flags & nsMsgMessageFlags::Read) != 0;
+  *pRead = !!(flags & nsMsgMessageFlags::Read);
   return NS_OK;
 }
 
 NS_IMETHODIMP nsMsgDatabase::IsMarked(nsMsgKey key, PRBool *pMarked)
 {
   nsCOMPtr <nsIMsgDBHdr> msgHdr;
 
   nsresult rv = GetMsgHdrForKey(key, getter_AddRefs(msgHdr));
   if (NS_FAILED(rv))
     return NS_MSG_MESSAGE_NOT_FOUND; // XXX return rv?
 
   PRUint32 flags;
   (void)msgHdr->GetFlags(&flags);
-  *pMarked = (flags & nsMsgMessageFlags::Marked) == nsMsgMessageFlags::Marked;
+  *pMarked = !!(flags & nsMsgMessageFlags::Marked);
   return rv;
 }
 
 NS_IMETHODIMP nsMsgDatabase::IsIgnored(nsMsgKey key, PRBool *pIgnored)
 {
   PR_ASSERT(pIgnored != NULL);
   if (!pIgnored)
     return NS_ERROR_NULL_POINTER;
@@ -2072,33 +2072,33 @@ NS_IMETHODIMP nsMsgDatabase::IsIgnored(n
   nsresult rv = GetThreadForMsgKey(key, getter_AddRefs(threadHdr));
   // This should be very surprising, but we leave that up to the caller
   // to determine for now.
   if (!threadHdr)
     return NS_MSG_MESSAGE_NOT_FOUND;
 
   PRUint32 threadFlags;
   threadHdr->GetFlags(&threadFlags);
-  *pIgnored = (threadFlags & nsMsgMessageFlags::Ignored) ? PR_TRUE : PR_FALSE;
+  *pIgnored = !!(threadFlags & nsMsgMessageFlags::Ignored);
   return rv;
 }
 
 nsresult nsMsgDatabase::HasAttachments(nsMsgKey key, PRBool *pHasThem)
 {
   NS_ENSURE_ARG_POINTER(pHasThem);
 
   nsCOMPtr <nsIMsgDBHdr> msgHdr;
 
   nsresult rv = GetMsgHdrForKey(key, getter_AddRefs(msgHdr));
   if (NS_FAILED(rv))
     return rv;
 
   PRUint32 flags;
   (void)msgHdr->GetFlags(&flags);
-  *pHasThem = (flags & nsMsgMessageFlags::Attachment) ? PR_TRUE : PR_FALSE;
+  *pHasThem = !!(flags & nsMsgMessageFlags::Attachment);
   return rv;
 }
 
 PRBool nsMsgDatabase::SetHdrReadFlag(nsIMsgDBHdr *msgHdr, PRBool bRead)
 {
   return SetHdrFlag(msgHdr, bRead, nsMsgMessageFlags::Read);
 }
 
@@ -2436,17 +2436,17 @@ NS_IMETHODIMP nsMsgDatabase::IsMDNNeeded
   nsCOMPtr <nsIMsgDBHdr> msgHdr;
 
   nsresult rv = GetMsgHdrForKey(key, getter_AddRefs(msgHdr));
   if (NS_FAILED(rv) || !msgHdr)
     return NS_MSG_MESSAGE_NOT_FOUND; // XXX return rv?
 
   PRUint32 flags;
   (void)msgHdr->GetFlags(&flags);
-  *pNeeded = ((flags & nsMsgMessageFlags::MDNReportNeeded) == nsMsgMessageFlags::MDNReportNeeded);
+  *pNeeded = !!(flags & nsMsgMessageFlags::MDNReportNeeded);
   return rv;
 }
 
 
 nsresult nsMsgDatabase::MarkMDNSent(nsMsgKey key, PRBool bSent,
                                     nsIDBChangeListener *instigator /* = NULL */)
 {
   return SetKeyFlag(key, bSent, nsMsgMessageFlags::MDNReportSent, instigator);
@@ -2458,17 +2458,17 @@ nsresult nsMsgDatabase::IsMDNSent(nsMsgK
   nsCOMPtr <nsIMsgDBHdr> msgHdr;
 
   nsresult rv = GetMsgHdrForKey(key, getter_AddRefs(msgHdr));
   if (NS_FAILED(rv) || !msgHdr)
     return NS_MSG_MESSAGE_NOT_FOUND; // XXX return rv?
 
   PRUint32 flags;
   (void)msgHdr->GetFlags(&flags);
-  *pSent = flags & nsMsgMessageFlags::MDNReportSent;
+  *pSent = !!(flags & nsMsgMessageFlags::MDNReportSent);
   return rv;
 }
 
 
 nsresult  nsMsgDatabase::SetKeyFlag(nsMsgKey key, PRBool set, PRUint32 flag,
                                      nsIDBChangeListener *instigator)
 {
   nsresult rv;
@@ -3994,17 +3994,17 @@ nsresult nsMsgDatabase::SetUint64Propert
 }
 
 nsresult nsMsgDatabase::GetBooleanProperty(nsIMdbRow *row, const char *propertyName, 
                                      PRBool *result, 
                                      PRBool defaultValue /* = PR_FALSE */)
 {
   PRUint32 res;
   nsresult rv = GetUint32Property(row, propertyName, &res, (PRUint32) defaultValue);
-  *result = (PRBool) res;
+  *result = !!res;
   return rv;
 }
 
 nsresult nsMsgDatabase::SetBooleanProperty(nsIMdbRow *row, const char *propertyName, 
                                     PRBool propertyVal)
 {
   return SetUint32Property(row, propertyName, (PRUint32) propertyVal);
 }