Bug 675473 - Incorrect use of PRBool when other types are more appropriate or vice versa (in comm-central); r=Standard8
authorMichael Wu <mwu@mozilla.com>
Tue, 16 Aug 2011 11:12:05 +0100
changeset 8767 181f38be31944679475fb83d3939edc5d9c374ad
parent 8766 912f956bb78f6a9ea03b85ab6f3207fd742c0b23
child 8768 de5786ac0fd7ce1929448bc5181f527a3c0da585
push idunknown
push userunknown
push dateunknown
reviewersStandard8
bugs675473
Bug 675473 - Incorrect use of PRBool when other types are more appropriate or vice versa (in comm-central); r=Standard8
ldap/xpcom/src/nsLDAPOperation.cpp
mailnews/base/src/nsMsgPrintEngine.cpp
mailnews/base/src/nsMsgPrintEngine.h
mailnews/base/src/nsSpamSettings.cpp
mailnews/base/util/nsMsgUtils.cpp
mailnews/compose/src/nsMsgComposeService.h
mailnews/compose/src/nsMsgPrompts.cpp
mailnews/imap/src/nsImapMailFolder.h
mailnews/imap/src/nsImapProtocol.cpp
mailnews/imap/src/nsImapUrl.cpp
mailnews/mime/src/mimetpfl.cpp
mailnews/mime/src/mimetpla.cpp
--- a/ldap/xpcom/src/nsLDAPOperation.cpp
+++ b/ldap/xpcom/src/nsLDAPOperation.cpp
@@ -287,17 +287,17 @@ nsLDAPOperation::SaslStep(const char *to
 
 // wrapper for ldap_simple_bind()
 //
 NS_IMETHODIMP
 nsLDAPOperation::SimpleBind(const nsACString& passwd)
 {
     nsresult rv;
     nsCAutoString bindName;
-    PRBool originalMsgID = mMsgID;
+    PRInt32 originalMsgID = mMsgID;
     // Ugly hack alert:
     // the first time we get called with a passwd, remember it.
     // 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())
--- a/mailnews/base/src/nsMsgPrintEngine.cpp
+++ b/mailnews/base/src/nsMsgPrintEngine.cpp
@@ -736,17 +736,17 @@ private:
 PRBool
 nsMsgPrintEngine::FirePrintEvent()
 {
   nsCOMPtr<nsIRunnable> event = new nsPrintMsgWindowEvent(this);
   return NS_SUCCEEDED(NS_DispatchToCurrentThread(event));
 }
 
 //-----------------------------------------------------------
-PRBool
+nsresult
 nsMsgPrintEngine::FireStartNextEvent()
 {
   nsCOMPtr<nsIRunnable> event = new nsStartNextPrintOpEvent(this);
   return NS_DispatchToCurrentThread(event);
 }
 
 /* void setStartupPPObserver (in nsIObserver startupPPObs); */
 NS_IMETHODIMP nsMsgPrintEngine::SetStartupPPObserver(nsIObserver *startupPPObs)
--- a/mailnews/base/src/nsMsgPrintEngine.h
+++ b/mailnews/base/src/nsMsgPrintEngine.h
@@ -82,17 +82,17 @@ public:
   NS_DECL_NSIOBSERVER
 
   void PrintMsgWindow();
   NS_IMETHOD  StartNextPrintOperation();
 
 protected:
 
   PRBool      FirePrintEvent();
-  PRBool      FireStartNextEvent();
+  nsresult    FireStartNextEvent();
   nsresult    FireThatLoadOperationStartup(const nsString& uri);
   nsresult    FireThatLoadOperation(const nsString& uri);
   void        InitializeDisplayCharset();
   void        SetupObserver();
   nsresult    SetStatusMessage(const nsString& aMsgString);
   void GetString(const PRUnichar *aStringName, nsString& aOutString);
   nsresult    ShowProgressDialog(PRBool aIsForPrinting, PRBool& aDoNotify);
 
--- a/mailnews/base/src/nsSpamSettings.cpp
+++ b/mailnews/base/src/nsSpamSettings.cpp
@@ -654,17 +654,17 @@ NS_IMETHODIMP nsSpamSettings::GetServerF
     } // until we find the location of mServerFilterName
   } // if we haven't already stored mServerFilterFile
 
   NS_IF_ADDREF(*aFile = mServerFilterFile);
   return NS_OK;
 }
 
 
-NS_IMPL_GETSET(nsSpamSettings, ServerFilterTrustFlags, PRBool, mServerFilterTrustFlags)
+NS_IMPL_GETSET(nsSpamSettings, ServerFilterTrustFlags, PRInt32, mServerFilterTrustFlags)
 
 #define LOG_ENTRY_START_TAG "<p>\n"
 #define LOG_ENTRY_START_TAG_LEN (strlen(LOG_ENTRY_START_TAG))
 #define LOG_ENTRY_END_TAG "</p>\n"
 #define LOG_ENTRY_END_TAG_LEN (strlen(LOG_ENTRY_END_TAG))
 
 NS_IMETHODIMP nsSpamSettings::LogJunkHit(nsIMsgDBHdr *aMsgHdr, PRBool aMoveMessage)
 {
--- a/mailnews/base/util/nsMsgUtils.cpp
+++ b/mailnews/base/util/nsMsgUtils.cpp
@@ -845,17 +845,17 @@ nsresult GetExistingFolder(const nsCStri
 
     NS_ADDREF(*aFolder = thisFolder);
   }
   return rv;
 }
 
 PRBool IsAFromSpaceLine(char *start, const char *end)
 {
-  nsresult rv = PR_FALSE;
+  PRBool rv = PR_FALSE;
   while ((start < end) && (*start == '>'))
     start++;
   // If the leading '>'s are followed by an 'F' then we have a possible case here.
   if ( (*start == 'F') && (end-start > 4) && !strncmp(start, "From ", 5) )
     rv = PR_TRUE;
   return rv;
 }
 
--- a/mailnews/compose/src/nsMsgComposeService.h
+++ b/mailnews/compose/src/nsMsgComposeService.h
@@ -96,17 +96,17 @@ private:
   PRInt32 mMaxRecycledWindows;
   nsMsgCachedWindowInfo *mCachedWindows;
   
   void CloseHiddenCachedWindow(nsIDOMWindow *domWindow);
 
   nsresult LoadDraftOrTemplate(const nsACString& aMsgURI, nsMimeOutputType aOutType, 
                                nsIMsgIdentity * aIdentity, const char * aOriginalMsgURI, 
                                nsIMsgDBHdr * aOrigMsgHdr, PRBool aForwardInline,
-                               MSG_ComposeFormat format,
+                               PRBool overrideComposeFormat,
                                nsIMsgWindow *aMsgWindow);
 
   nsresult RunMessageThroughMimeDraft(const nsACString& aMsgURI,
                                       nsMimeOutputType aOutType,
                                       nsIMsgIdentity * aIdentity,
                                       const char * aOriginalMsgURI,
                                       nsIMsgDBHdr * aOrigMsgHdr,
                                       PRBool aForwardInline,
--- a/mailnews/compose/src/nsMsgPrompts.cpp
+++ b/mailnews/compose/src/nsMsgPrompts.cpp
@@ -125,32 +125,27 @@ nsMsgDisplayMessageByString(nsIPrompt * 
     rv = prompt->Alert(windowTitle, msg);
   return NS_OK;
 }
 
 nsresult
 nsMsgAskBooleanQuestionByString(nsIPrompt * aPrompt, const PRUnichar * msg, PRBool *answer, const PRUnichar * windowTitle)
 {
   nsresult rv;
-  PRInt32 result;
   nsCOMPtr<nsIPrompt> dialog = aPrompt;
 
   if ((!msg) || (!*msg))
     return NS_ERROR_INVALID_ARG;
 
   if (!dialog)
   {
     nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
     if (wwatch)
       wwatch->GetNewPrompter(0, getter_AddRefs(dialog));
   }
 
   if (dialog)
   {
-    rv = dialog->Confirm(windowTitle, msg, &result);
-    if (result == 1)
-      *answer = PR_TRUE;
-    else
-      *answer = PR_FALSE;
+    rv = dialog->Confirm(windowTitle, msg, answer);
   }
 
   return NS_OK;
 }
--- a/mailnews/imap/src/nsImapMailFolder.h
+++ b/mailnews/imap/src/nsImapMailFolder.h
@@ -107,17 +107,17 @@ public:
     PRUint32 m_unreadCount; // num unread messages we're moving
     PRBool m_streamCopy;
     char *m_dataBuffer; // temporary buffer for this copy operation
     nsCOMPtr<nsIOutputStream> m_msgFileStream;         // temporary file (processed mail)
     PRUint32 m_dataBufferSize;
     PRUint32 m_leftOver;
     PRBool m_allowUndo;
     PRBool m_eatLF;
-    PRBool m_newMsgFlags; // only used if there's no m_message
+    PRUint32 m_newMsgFlags; // only used if there's no m_message
     nsCString m_newMsgKeywords; // ditto 
     // If the server supports UIDPLUS, this is the UID for the append,
     // if we're doing an append.
     nsMsgKey m_appendUID;
 };
 
 NS_DEFINE_STATIC_IID_ACCESSOR(nsImapMailCopyState, NS_IMAPMAILCOPYSTATE_IID)
 
--- a/mailnews/imap/src/nsImapProtocol.cpp
+++ b/mailnews/imap/src/nsImapProtocol.cpp
@@ -8219,17 +8219,17 @@ nsresult nsImapProtocol::GetPassword(nsC
   }
   if (!password.IsEmpty())
     m_lastPasswordSent = password;
   return rv;
 }
 
 // This is called from the UI thread.
 NS_IMETHODIMP
-nsImapProtocol::OnPromptStart(PRInt32 *aResult)
+nsImapProtocol::OnPromptStart(PRBool *aResult)
 {
   nsresult rv;
   nsCOMPtr<nsIImapIncomingServer> imapServer = do_QueryReferent(m_server, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
   nsCOMPtr<nsIMsgWindow> msgWindow;
 
   *aResult = PR_FALSE;
   GetMsgWindow(getter_AddRefs(msgWindow));
--- a/mailnews/imap/src/nsImapUrl.cpp
+++ b/mailnews/imap/src/nsImapUrl.cpp
@@ -433,17 +433,17 @@ NS_IMETHODIMP nsImapUrl::MessageIdsAreUi
 
 NS_IMETHODIMP
 nsImapUrl::SetExtraStatus(PRInt32 aExtraStatus)
 {
   m_extraStatus = aExtraStatus;
   return NS_OK;
 }
 
-NS_IMETHODIMP nsImapUrl::GetExtraStatus(PRBool *aResult)
+NS_IMETHODIMP nsImapUrl::GetExtraStatus(PRInt32 *aResult)
 {
   NS_ENSURE_ARG_POINTER(aResult);
   *aResult = m_extraStatus;
   return NS_OK;
 }
 
 // this method is only called from the imap thread
 NS_IMETHODIMP nsImapUrl::GetMsgFlags(imapMessageFlagsType *result)  // kAddMsgFlags or kSubtractMsgFlags only
--- a/mailnews/mime/src/mimetpfl.cpp
+++ b/mailnews/mime/src/mimetpfl.cpp
@@ -366,17 +366,17 @@ MimeInlineTextPlainFlowed_parse_line (co
   char *mailCharset = NULL;
   nsresult rv;
 
   if (!skipConversion)
   {
     // Convert only if the source string is not empty
     if (length - (linep - line) > 0)
     {
-      PRBool whattodo = obj->options->whattodo;
+      PRUint32 whattodo = obj->options->whattodo;
       if (plainHTML)
       {
         if (quoting)
           whattodo = 0;
         else
           whattodo = whattodo & ~mozITXTToHTMLConv::kGlyphSubstitution;
                     /* Do recognition for the case, the result is viewed in
                         Mozilla, but not GlyphSubstitution, because other UAs
--- a/mailnews/mime/src/mimetpla.cpp
+++ b/mailnews/mime/src/mimetpla.cpp
@@ -363,17 +363,17 @@ MimeInlineTextPlain_parse_line (const ch
     // Recognize quotes
     PRUint32 oldCiteLevel = text->mCiteLevel;
     PRUint32 logicalLineStart = 0;
     rv = conv->CiteLevelTXT(lineSourceStr.get(),
                             &logicalLineStart, &(text->mCiteLevel));
     NS_ENSURE_SUCCESS(rv, -1);
 
     // Find out, which recognitions to do
-    PRBool whattodo = obj->options->whattodo;
+    PRUint32 whattodo = obj->options->whattodo;
     if (plainHTML)
     {
       if (quoting)
         whattodo = 0;  // This is done on Send. Don't do it twice.
       else
         whattodo = whattodo & ~mozITXTToHTMLConv::kGlyphSubstitution;
                    /* Do recognition for the case, the result is viewed in
                       Mozilla, but not GlyphSubstitution, because other UAs