bug 398568: Fix prbool misuse in netwerk. r=biesi a=dsicore
authortglek@mozilla.com
Thu, 21 Feb 2008 15:18:49 -0800
changeset 12048 b42111ac9770d0dfd34b634012542fe271c580a1
parent 12047 f05e6716f8c1e6120e6519a25fae3a3567bcb894
child 12049 f212da74389af8fa11930b0b6d51e5eb32e61010
push idunknown
push userunknown
push dateunknown
reviewersbiesi, dsicore
bugs398568
milestone1.9b4pre
bug 398568: Fix prbool misuse in netwerk. r=biesi a=dsicore
netwerk/cache/src/nsCacheRequest.h
netwerk/cache/src/nsCacheSession.h
netwerk/cache/src/nsDiskCacheMap.h
netwerk/cookie/src/nsCookieService.cpp
netwerk/protocol/http/src/nsHttpChannel.cpp
netwerk/streamconv/converters/mozTXTToHTMLConv.cpp
--- a/netwerk/cache/src/nsCacheRequest.h
+++ b/netwerk/cache/src/nsCacheRequest.h
@@ -113,20 +113,20 @@ private:
         return (nsCacheAccessMode)((mInfo >> 24) & 0xFF);
     }
 
     void MarkStreamBased()      { mInfo |=  eStreamBasedMask; }
     PRBool IsStreamBased()      { return (mInfo & eStreamBasedMask) != 0; }
 
 
     void   MarkDoomEntriesIfExpired()   { mInfo |=  eDoomEntriesIfExpiredMask; }
-    PRBool WillDoomEntriesIfExpired()   { return (mInfo & eDoomEntriesIfExpiredMask); }
+    PRBool WillDoomEntriesIfExpired()   { return (0 != (mInfo & eDoomEntriesIfExpiredMask)); }
     
     void   MarkBlockingMode()           { mInfo |= eBlockingModeMask; }
-    PRBool IsBlocking()                 { return  (mInfo & eBlockingModeMask); }
+    PRBool IsBlocking()                 { return (0 != (mInfo & eBlockingModeMask)); }
     PRBool IsNonBlocking()              { return !(mInfo & eBlockingModeMask); }
 
     void SetStoragePolicy(nsCacheStoragePolicy policy)
     {
         NS_ASSERTION(policy <= 0xFF, "too many bits in nsCacheStoragePolicy");
         mInfo &= ~eStoragePolicyMask;  // clear storage policy bits
         mInfo |= policy;         // or in new bits
     }
--- a/netwerk/cache/src/nsCacheSession.h
+++ b/netwerk/cache/src/nsCacheSession.h
@@ -69,17 +69,17 @@ public:
     };
 
     void   MarkStreamBased()  { mInfo |=  eStreamBasedMask; }
     void   ClearStreamBased() { mInfo &= ~eStreamBasedMask; }
     PRBool IsStreamBased()    { return (mInfo & eStreamBasedMask) != 0; }
 
     void   MarkDoomEntriesIfExpired()  { mInfo |=  eDoomEntriesIfExpiredMask; }
     void   ClearDoomEntriesIfExpired() { mInfo &= ~eDoomEntriesIfExpiredMask; }
-    PRBool WillDoomEntriesIfExpired()  { return (mInfo & eDoomEntriesIfExpiredMask); }
+    PRBool WillDoomEntriesIfExpired()  { return (0 != (mInfo & eDoomEntriesIfExpiredMask)); }
 
     nsCacheStoragePolicy  StoragePolicy()
     {
         return (nsCacheStoragePolicy)(mInfo & eStoragePolicyMask);
     }
 
     void SetStoragePolicy(nsCacheStoragePolicy policy)
     {
--- a/netwerk/cache/src/nsDiskCacheMap.h
+++ b/netwerk/cache/src/nsDiskCacheMap.h
@@ -139,17 +139,17 @@ public:
     PRUint32  HashNumber() const                  { return mHashNumber; }
     void      SetHashNumber( PRUint32 hashNumber) { mHashNumber = hashNumber; }
 
     // EvictionRank accessors
     PRUint32  EvictionRank() const              { return mEvictionRank; }
     void      SetEvictionRank( PRUint32 rank)   { mEvictionRank = rank ? rank : 1; }
 
     // DataLocation accessors
-    PRBool    DataLocationInitialized() const { return mDataLocation & eLocationInitializedMask; }
+    PRBool    DataLocationInitialized() const { return 0 != (mDataLocation & eLocationInitializedMask); }
     void      ClearDataLocation()       { mDataLocation = 0; }
     
     PRUint32  DataFile() const
     {
         return (PRUint32)(mDataLocation & eLocationSelectorMask) >> eLocationSelectorOffset;
     }
 
     void      SetDataBlocks( PRUint32 index, PRUint32 startBlock, PRUint32 blockCount)
@@ -206,17 +206,17 @@ public:
     {
         // clear everything, (separate file index = 0)
         mDataLocation = 0;
         mDataLocation |= generation & eFileGenerationMask;
         mDataLocation |= eLocationInitializedMask;
     }
 
     // MetaLocation accessors
-    PRBool    MetaLocationInitialized() const { return mMetaLocation & eLocationInitializedMask; }
+    PRBool    MetaLocationInitialized() const { return 0 != (mMetaLocation & eLocationInitializedMask); }
     void      ClearMetaLocation()             { mMetaLocation = 0; }   
     PRUint32  MetaLocation() const            { return mMetaLocation; }
     
     PRUint32  MetaFile() const
     {
         return (PRUint32)(mMetaLocation & eLocationSelectorMask) >> eLocationSelectorOffset;
     }
 
--- a/netwerk/cookie/src/nsCookieService.cpp
+++ b/netwerk/cookie/src/nsCookieService.cpp
@@ -917,18 +917,18 @@ nsCookieService::Read()
     
     stmt->GetUTF8String(1, name);
     stmt->GetUTF8String(2, value);
     stmt->GetUTF8String(3, host);
     stmt->GetUTF8String(4, path);
 
     PRInt64 expiry = stmt->AsInt64(5);
     PRInt64 lastAccessed = stmt->AsInt64(6);
-    PRBool isSecure = stmt->AsInt32(7);
-    PRBool isHttpOnly = stmt->AsInt32(8);
+    PRBool isSecure = 0 != stmt->AsInt32(7);
+    PRBool isHttpOnly = 0 != stmt->AsInt32(8);
 
     // create a new nsCookie and assign the data.
     nsCookie* newCookie =
       nsCookie::Create(name, value, host, path,
                        expiry,
                        lastAccessed,
                        creationID,
                        PR_FALSE,
--- a/netwerk/protocol/http/src/nsHttpChannel.cpp
+++ b/netwerk/protocol/http/src/nsHttpChannel.cpp
@@ -2543,19 +2543,19 @@ nsHttpChannel::GenCredsAndSetEntry(nsIHt
     // don't log this in release build since it could contain sensitive info.
 #ifdef DEBUG 
     LOG(("generated creds: %s\n", *result));
 #endif
 
     // find out if this authenticator allows reuse of credentials and/or
     // challenge.
     PRBool saveCreds =
-        authFlags & nsIHttpAuthenticator::REUSABLE_CREDENTIALS;
+        0 != (authFlags & nsIHttpAuthenticator::REUSABLE_CREDENTIALS);
     PRBool saveChallenge =
-        authFlags & nsIHttpAuthenticator::REUSABLE_CHALLENGE;
+        0 != (authFlags & nsIHttpAuthenticator::REUSABLE_CHALLENGE);
 
     // this getter never fails
     nsHttpAuthCache *authCache = gHttpHandler->AuthCache();
 
     // create a cache entry.  we do this even though we don't yet know that
     // these credentials are valid b/c we need to avoid prompting the user
     // more than once in case the credentials are valid.
     //
--- a/netwerk/streamconv/converters/mozTXTToHTMLConv.cpp
+++ b/netwerk/streamconv/converters/mozTXTToHTMLConv.cpp
@@ -1075,19 +1075,19 @@ mozTXTToHTMLConv::CiteLevelTXT(const PRU
   }
 
   return result;
 }
 
 void
 mozTXTToHTMLConv::ScanTXT(const PRUnichar * aInString, PRInt32 aInStringLength, PRUint32 whattodo, nsString& aOutString)
 {
-  PRBool doURLs = whattodo & kURLs;
-  PRBool doGlyphSubstitution = whattodo & kGlyphSubstitution;
-  PRBool doStructPhrase = whattodo & kStructPhrase;
+  PRBool doURLs = 0 != (whattodo & kURLs);
+  PRBool doGlyphSubstitution = 0 != (whattodo & kGlyphSubstitution);
+  PRBool doStructPhrase = 0 != (whattodo & kStructPhrase);
 
   PRUint32 structPhrase_strong = 0;  // Number of currently open tags
   PRUint32 structPhrase_underline = 0;
   PRUint32 structPhrase_italic = 0;
   PRUint32 structPhrase_code = 0;
 
   nsAutoString outputHTML;  // moved here for performance increase