bug 454502: prbool issues in html parser. r+sr=mrbkap
authorTaras Glek <tglek@mozilla.com>
Tue, 09 Sep 2008 17:42:04 -0700
changeset 19025 22805910408e956557eaee3a2cecc427eca72254
parent 19024 5b10f79b701564eea33933ed3aa3b9b3ba030bdb
child 19026 89f146305b76720cc3e982b762a12d29020cba1f
push id1919
push usertglek@mozilla.com
push dateWed, 10 Sep 2008 00:42:12 +0000
treeherdermozilla-central@22805910408e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs454502
milestone1.9.1b1pre
bug 454502: prbool issues in html parser. r+sr=mrbkap
parser/htmlparser/src/CNavDTD.cpp
parser/htmlparser/src/nsExpatDriver.cpp
parser/htmlparser/src/nsHTMLTokenizer.cpp
parser/htmlparser/src/nsParserService.h
--- a/parser/htmlparser/src/CNavDTD.cpp
+++ b/parser/htmlparser/src/CNavDTD.cpp
@@ -2240,17 +2240,17 @@ CNavDTD::CanPropagate(eHTMLTags aParent,
           }
         }
       }
     }
     if (mScratch.Length() - 1 > gHTMLElements[aParent].mPropagateRange) {
       result = PR_FALSE;
     }
   } else {
-    result = aParentContains;
+    result = !!aParentContains;
   }
 
 
   return result;
 }
 
 
 /**
--- a/parser/htmlparser/src/nsExpatDriver.cpp
+++ b/parser/htmlparser/src/nsExpatDriver.cpp
@@ -177,17 +177,17 @@ Driver_HandleStartDoctypeDecl(void *aUse
                               const XML_Char *aDoctypeName,
                               const XML_Char *aSysid,
                               const XML_Char *aPubid,
                               int aHasInternalSubset)
 {
   NS_ASSERTION(aUserData, "expat driver should exist");
   if (aUserData) {
     static_cast<nsExpatDriver*>(aUserData)->
-      HandleStartDoctypeDecl(aDoctypeName, aSysid, aPubid, aHasInternalSubset);
+      HandleStartDoctypeDecl(aDoctypeName, aSysid, aPubid, !!aHasInternalSubset);
   }
 }
 
 PR_STATIC_CALLBACK(void)
 Driver_HandleEndDoctypeDecl(void *aUserData)
 {
   NS_ASSERTION(aUserData, "expat driver should exist");
   if (aUserData) {
--- a/parser/htmlparser/src/nsHTMLTokenizer.cpp
+++ b/parser/htmlparser/src/nsHTMLTokenizer.cpp
@@ -556,17 +556,17 @@ nsHTMLTokenizer::ConsumeTag(PRUnichar aC
         result = aScanner.Peek(theNextChar, 2);
 
         if (NS_OK == result) {
           // Get the original "<" (we've already seen it with a Peek)
           aScanner.GetChar(oldChar);
 
           // XML allows non ASCII tag names, consume this as an end tag. This
           // is needed to make XML view source work
-          PRBool isXML = mFlags & NS_IPARSER_FLAG_XML;
+          PRBool isXML = !!(mFlags & NS_IPARSER_FLAG_XML);
           if (nsCRT::IsAsciiAlpha(theNextChar) ||
               kGreaterThan == theNextChar      ||
               (isXML && !nsCRT::IsAscii(theNextChar))) {
             result = ConsumeEndTag(aChar, aToken, aScanner);
           } else {
             result = ConsumeComment(aChar, aToken, aScanner);
           }
         }
@@ -592,17 +592,17 @@ nsHTMLTokenizer::ConsumeTag(PRUnichar aC
         // It must be a processing instruction...
         // Get the original "<" (we've already seen it with a Peek)
         aScanner.GetChar(oldChar);
         result = ConsumeProcessingInstruction(aChar, aToken, aScanner);
         break;
 
       default:
         // XML allows non ASCII tag names, consume this as a start tag.
-        PRBool isXML = mFlags & NS_IPARSER_FLAG_XML;
+        PRBool isXML = !!(mFlags & NS_IPARSER_FLAG_XML);
         if (nsCRT::IsAsciiAlpha(aChar) ||
             (isXML && !nsCRT::IsAscii(aChar))) {
           // Get the original "<" (we've already seen it with a Peek)
           aScanner.GetChar(oldChar);
           result = ConsumeStartTag(aChar, aToken, aScanner, aFlushTokens);
         } else {
           // We are not dealing with a tag. So, don't consume the original
           // char and leave the decision to ConsumeText().
--- a/parser/htmlparser/src/nsParserService.h
+++ b/parser/htmlparser/src/nsParserService.h
@@ -81,21 +81,21 @@ public:
   NS_IMETHOD GetTopicObservers(const nsAString& aTopic,
                                nsIObserverEntry** aEntry);
 
   nsresult CheckQName(const nsAString& aQName,
                       PRBool aNamespaceAware, const PRUnichar** aColon);
 
   PRBool IsXMLLetter(PRUnichar aChar)
   {
-    return MOZ_XMLIsLetter(reinterpret_cast<const char*>(&aChar));
+    return !!MOZ_XMLIsLetter(reinterpret_cast<const char*>(&aChar));
   }
   PRBool IsXMLNCNameChar(PRUnichar aChar)
   {
-    return MOZ_XMLIsNCNameChar(reinterpret_cast<const char*>(&aChar));
+    return !!MOZ_XMLIsNCNameChar(reinterpret_cast<const char*>(&aChar));
   }
   PRUint32 DecodeEntity(const PRUnichar* aStart, const PRUnichar* aEnd,
                         const PRUnichar** aNext, PRUnichar* aResult)
   {
     *aNext = nsnull;
     return MOZ_XMLTranslateEntity(reinterpret_cast<const char*>(aStart),
                                   reinterpret_cast<const char*>(aEnd),
                                   reinterpret_cast<const char**>(aNext),