Bug 494683 warning: comparison between signed and unsigned and incorrect initialization order
authortimeless@mozdev.org
Fri, 12 Mar 2010 07:50:13 +0100
changeset 39341 b193d3213d41f3c4bc3e454615f34843b530e8b0
parent 39340 3dcd3fda6b091bd4b19aebfc3fb3918550d2cb11
child 39343 7146ff1099dc9271161ebb42f394a99be5f07ea7
push idunknown
push userunknown
push dateunknown
bugs494683
milestone1.9.3a3pre
Bug 494683 warning: comparison between signed and unsigned and incorrect initialization order r=jst sr=jst
content/base/src/nsContentSink.h
content/base/src/nsContentUtils.cpp
content/base/src/nsDocumentEncoder.cpp
content/base/src/nsPlainTextSerializer.cpp
content/base/src/nsXMLContentSerializer.cpp
content/base/src/nsXMLContentSerializer.h
content/html/content/src/nsHTMLSelectElement.cpp
--- a/content/base/src/nsContentSink.h
+++ b/content/base/src/nsContentSink.h
@@ -354,41 +354,41 @@ protected:
   // -- Can interrupt parsing members --
   //
 
   // The number of tokens that have been processed since we measured
   // if it's time to return to the main event loop.
   PRUint32 mDeflectedCount;
 
   // How many times to deflect in interactive/perf modes
-  PRInt32 mInteractiveDeflectCount;
-  PRInt32 mPerfDeflectCount;
+  PRUint32 mInteractiveDeflectCount;
+  PRUint32 mPerfDeflectCount;
 
   // 0 = don't check for pending events
   // 1 = don't deflect if there are pending events
   // 2 = bail if there are pending events
-  PRInt32 mPendingEventMode;
+  PRUint32 mPendingEventMode;
 
   // How often to probe for pending events. 1=every token
-  PRInt32 mEventProbeRate;
+  PRUint32 mEventProbeRate;
 
   // Is there currently a pending event?
   PRBool mHasPendingEvent;
 
   // When to return to the main event loop
-  PRInt32 mCurrentParseEndTime;
+  PRUint32 mCurrentParseEndTime;
 
   // How long to stay off the event loop in interactive/perf modes
-  PRInt32 mInteractiveParseTime;
-  PRInt32 mPerfParseTime;
+  PRUint32 mInteractiveParseTime;
+  PRUint32 mPerfParseTime;
 
   // How long to be in interactive mode after an event
-  PRInt32 mInteractiveTime;
+  PRUint32 mInteractiveTime;
   // How long to stay in perf mode after initial loading
-  PRInt32 mInitialPerfTime;
+  PRUint32 mInitialPerfTime;
 
   // Should we switch between perf-mode and interactive-mode
   PRBool mEnablePerfMode;
 
   PRInt32 mBeginLoadTime;
 
   // Last mouse event or keyboard event time sampled by the content
   // sink
--- a/content/base/src/nsContentUtils.cpp
+++ b/content/base/src/nsContentUtils.cpp
@@ -4574,17 +4574,17 @@ nsContentUtils::RemoveScriptBlocker()
                "bad sRunnersCountAtFirstBlocker");
 
   while (firstBlocker < lastBlocker) {
     nsCOMPtr<nsIRunnable> runnable = (*sBlockedScriptRunners)[firstBlocker];
     sBlockedScriptRunners->RemoveObjectAt(firstBlocker);
     --lastBlocker;
 
     runnable->Run();
-    NS_ASSERTION(lastBlocker == sBlockedScriptRunners->Count() &&
+    NS_ASSERTION(lastBlocker == (PRUint32)sBlockedScriptRunners->Count() &&
                  sRunnersCountAtFirstBlocker == 0,
                  "Bad count");
     NS_ASSERTION(!sScriptBlockerCount, "This is really bad");
   }
 }
 
 /* static */
 PRBool
--- a/content/base/src/nsDocumentEncoder.cpp
+++ b/content/base/src/nsDocumentEncoder.cpp
@@ -666,21 +666,21 @@ nsDocumentEncoder::SerializeRangeNodes(n
   nsCOMPtr<nsIContent> content = do_QueryInterface(aNode);
   NS_ENSURE_TRUE(content, NS_ERROR_FAILURE);
 
   nsresult rv=NS_OK;
   
   // get start and end nodes for this recursion level
   nsCOMPtr<nsIContent> startNode, endNode;
   PRInt32 start = mStartRootIndex - aDepth;
-  if (start >= 0 && start <= mStartNodes.Length())
+  if (start >= 0 && (PRUint32)start <= mStartNodes.Length())
     startNode = mStartNodes[start];
 
   PRInt32 end = mEndRootIndex - aDepth;
-  if (end >= 0 && end <= mEndNodes.Length())
+  if (end >= 0 && (PRUint32)end <= mEndNodes.Length())
     endNode = mEndNodes[end];
 
   if ((startNode != content) && (endNode != content))
   {
     // node is completely contained in range.  Serialize the whole subtree
     // rooted by this node.
     rv = SerializeToStringRecursive(aNode, aString, PR_FALSE);
     NS_ENSURE_SUCCESS(rv, rv);
--- a/content/base/src/nsPlainTextSerializer.cpp
+++ b/content/base/src/nsPlainTextSerializer.cpp
@@ -1381,17 +1381,17 @@ nsPlainTextSerializer::AddToLine(const P
       }
       
       nsAutoString restOfLine;
       if (goodSpace == NS_LINEBREAKER_NEED_MORE_TEXT) {
         // If we don't found a good place to break, accept long line and
         // try to find another place to break
         goodSpace=(prefixwidth>mWrapColumn+1)?1:mWrapColumn-prefixwidth+1;
         if (mLineBreaker) {
-          if (goodSpace < mCurrentLine.Length())
+          if ((PRUint32)goodSpace < mCurrentLine.Length())
             goodSpace = mLineBreaker->Next(mCurrentLine.get(), 
                                            mCurrentLine.Length(), goodSpace);
           if (goodSpace == NS_LINEBREAKER_NEED_MORE_TEXT)
             goodSpace = mCurrentLine.Length();
         }
         // fallback if the line breaker is unavailable or failed
         if (!mLineBreaker) {
           goodSpace=(prefixwidth>mWrapColumn)?1:mWrapColumn-prefixwidth;
--- a/content/base/src/nsXMLContentSerializer.cpp
+++ b/content/base/src/nsXMLContentSerializer.cpp
@@ -1479,17 +1479,17 @@ nsXMLContentSerializer::AppendWrapped_No
   // Iterate until we find the first whitespace char or an aEnd condition
   // Updates "aPos" to point to the first unhandled char.
   // Also updates the aMayIgnoreStartOfLineWhitespaceSequence flag,
   // as well as the other "global" state flags.
 
   PRBool thisSequenceStartsAtBeginningOfLine = !mColPos;
   PRBool onceAgainBecauseWeAddedBreakInFront = PR_FALSE;
   PRBool foundWhitespaceInLoop;
-  PRInt32 length, colPos;
+  PRUint32 length, colPos;
 
   do {
 
     if (mColPos) {
       colPos = mColPos;
     }
     else {
       if (mDoFormat && !mPreLevel && !onceAgainBecauseWeAddedBreakInFront) {
--- a/content/base/src/nsXMLContentSerializer.h
+++ b/content/base/src/nsXMLContentSerializer.h
@@ -349,30 +349,30 @@ class nsXMLContentSerializer : public ns
 
   // characters to use for line break
   nsString  mLineBreak;
 
   // The charset that was passed to Init()
   nsCString mCharset;
   
   // current column position on the current line
-  PRInt32   mColPos;
+  PRUint32   mColPos;
 
   // true = pretty formating should be done (OutputFormated flag)
   PRPackedBool mDoFormat;
 
   // true = no formatting,(OutputRaw flag)
   // no newline convertion and no rewrap long lines even if OutputWrap is set.
   PRPackedBool mDoRaw;
 
   // true = wrapping should be done (OutputWrap flag)
   PRPackedBool mDoWrap;
 
   // number of maximum column in a line, in the wrap mode
-  PRInt32   mMaxColumn;
+  PRUint32   mMaxColumn;
 
   // current indent value
   nsString   mIndent;
 
   // this is the indentation level after the indentation reached
   // the maximum length of indentation
   PRInt32    mIndentOverflow;
 
--- a/content/html/content/src/nsHTMLSelectElement.cpp
+++ b/content/html/content/src/nsHTMLSelectElement.cpp
@@ -741,17 +741,17 @@ nsHTMLSelectElement::SetLength(PRUint32 
     nsCOMPtr<nsIDOMNode> node(do_QueryInterface(element));
 
     for (i = curlen; i < aLength; i++) {
       nsCOMPtr<nsIDOMNode> tmpNode;
 
       rv = AppendChild(node, getter_AddRefs(tmpNode));
       NS_ENSURE_SUCCESS(rv, rv);
 
-      if (i < ((PRInt32)aLength - 1)) {
+      if (i + 1 < aLength) {
         nsCOMPtr<nsIDOMNode> newNode;
 
         rv = node->CloneNode(PR_TRUE, getter_AddRefs(newNode));
         NS_ENSURE_SUCCESS(rv, rv);
 
         node = newNode;
       }
     }
@@ -2001,13 +2001,13 @@ nsHTMLOptionCollection::Add(nsIDOMHTMLOp
 
 NS_IMETHODIMP
 nsHTMLOptionCollection::Remove(PRInt32 aIndex)
 {
   NS_ENSURE_TRUE(mSelect, NS_ERROR_UNEXPECTED);
 
   PRUint32 len = 0;
   mSelect->GetLength(&len);
-  if (aIndex < 0 || aIndex >= len)
+  if (aIndex < 0 || (PRUint32)aIndex >= len)
     aIndex = 0;
 
   return mSelect->Remove(aIndex);
 }