Bug 1020892 - Quell some GCC warnings. r=luke
authorJan de Mooij <jdemooij@mozilla.com>
Fri, 06 Jun 2014 11:17:45 +0200
changeset 206294 74f5be69e4c9df83f25cd1028513da267becc26e
parent 206293 f627995bd6faf00ac5939dc9d99cd662b7dfc71c
child 206295 32b157ae5ed7752907b7158eaccd96499a14c789
push id3741
push userasasaki@mozilla.com
push dateMon, 21 Jul 2014 20:25:18 +0000
treeherdermozilla-beta@4d6f46f5af68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersluke
bugs1020892
milestone32.0a1
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 1020892 - Quell some GCC warnings. r=luke
js/src/jsstr.cpp
js/src/vm/String.h
--- a/js/src/jsstr.cpp
+++ b/js/src/jsstr.cpp
@@ -1045,31 +1045,31 @@ BoyerMooreHorspool(const TextChar *text,
     JS_ASSERT(0 < patLen && patLen <= sBMHPatLenMax);
 
     uint8_t skip[sBMHCharSetSize];
     for (uint32_t i = 0; i < sBMHCharSetSize; i++)
         skip[i] = uint8_t(patLen);
 
     uint32_t patLast = patLen - 1;
     for (uint32_t i = 0; i < patLast; i++) {
-        PatChar c = pat[i];
+        jschar c = pat[i];
         if (c >= sBMHCharSetSize)
             return sBMHBadPattern;
         skip[c] = uint8_t(patLast - i);
     }
 
     for (uint32_t k = patLast; k < textLen; ) {
         for (uint32_t i = k, j = patLast; ; i--, j--) {
             if (text[i] != pat[j])
                 break;
             if (j == 0)
                 return static_cast<int>(i);  /* safe: max string size */
         }
 
-        TextChar c = text[k];
+        jschar c = text[k];
         k += (c >= sBMHCharSetSize) ? patLen : skip[c];
     }
     return -1;
 }
 
 template <typename TextChar, typename PatChar>
 struct MemCmp {
     typedef uint32_t Extent;
--- a/js/src/vm/String.h
+++ b/js/src/vm/String.h
@@ -1073,20 +1073,22 @@ class StaticStrings
     inline JSLinearString *getUnitStringForElement(JSContext *cx, JSString *str, size_t index);
 
     static bool isStatic(JSAtom *atom);
 
     /* Return null if no static atom exists for the given (chars, length). */
     template <typename CharT>
     JSAtom *lookup(const CharT *chars, size_t length) {
         switch (length) {
-          case 1:
-            if (chars[0] < UNIT_STATIC_LIMIT)
-                return getUnit(chars[0]);
+          case 1: {
+            jschar c = chars[0];
+            if (c < UNIT_STATIC_LIMIT)
+                return getUnit(c);
             return nullptr;
+          }
           case 2:
             if (fitsInSmallChar(chars[0]) && fitsInSmallChar(chars[1]))
                 return getLength2(chars[0], chars[1]);
             return nullptr;
           case 3:
             /*
              * Here we know that JSString::intStringTable covers only 256 (or at least
              * not 1000 or more) chars. We rely on order here to resolve the unit vs.