Bug 624410: Add gcc-suggested parentheses in nsReadableUtils.cpp to silence build warning. r=dwitte
authorDaniel Holbert <dholbert@cs.stanford.edu>
Tue, 29 Mar 2011 08:47:53 -0700
changeset 64138 8fdd8b2b6b695f3815d6d232554378d39593510b
parent 64137 43467a3a651d3678e0c57d864ca6eba70aaf13d7
child 64139 fc1935dc39874c203c48e8ee3f80a8684360fbba
push id19316
push userdholbert@mozilla.com
push dateTue, 29 Mar 2011 16:18:55 +0000
treeherdermozilla-central@d6832692e749 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdwitte
bugs624410
milestone2.2a1pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 624410: Add gcc-suggested parentheses in nsReadableUtils.cpp to silence build warning. r=dwitte
xpcom/string/src/nsReadableUtils.cpp
--- a/xpcom/string/src/nsReadableUtils.cpp
+++ b/xpcom/string/src/nsReadableUtils.cpp
@@ -568,24 +568,26 @@ IsUTF8( const nsACString& aString )
           }
           
         while ( ptr < end && state )
           {
             c = *ptr++;
             --state;
 
             // non-character : EF BF [BE-BF] or F[0-7] [89AB]F BF [BE-BF]
-            if ( nonchar &&  ( !state &&  c < 0xBE ||
-                  state == 1 && c != 0xBF  ||
-                  state == 2 && 0x0F != (0x0F & c) ))
-                nonchar = PR_FALSE;
+            if ( nonchar &&  
+                 ( ( !state && c < 0xBE ) ||
+                   ( state == 1 && c != 0xBF )  ||
+                   ( state == 2 && 0x0F != (0x0F & c) )))
+              nonchar = PR_FALSE;
 
-            if ( !UTF8traits::isInSeq(c) || overlong && c <= olupper || 
-                  surrogate && slower <= c || nonchar && !state )
+            if ( !UTF8traits::isInSeq(c) || ( overlong && c <= olupper ) || 
+                 ( surrogate && slower <= c ) || ( nonchar && !state ))
               return PR_FALSE; // Not UTF-8 string
+
             overlong = surrogate = PR_FALSE;
           }
         }
     return !state; // state != 0 at the end indicates an invalid UTF-8 seq. 
   }
 
   /**
    * A character sink for in-place case conversion.