Fixed test failures seen on SnowLeopard buildbot.
authorggaren@apple.com <ggaren@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 11 May 2010 20:38:13 +0000 (20:38 +0000)
committerggaren@apple.com <ggaren@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 11 May 2010 20:38:13 +0000 (20:38 +0000)
* runtime/JSString.cpp:
(JSC::JSString::replaceCharacter): Don't use size_t and wtf::notFound.
Instead, use the individual types and notFound values of the string APIs
we're using, since they're not necessarily the same in 64bit.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@59170 268f45cc-cd09-0410-ab3c-d52691b4dbfc

JavaScriptCore/ChangeLog
JavaScriptCore/runtime/JSString.cpp

index 14d1045..1129375 100644 (file)
@@ -1,5 +1,14 @@
 2010-05-11  Geoffrey Garen  <ggaren@apple.com>
 
+        Fixed test failures seen on SnowLeopard buildbot.
+
+        * runtime/JSString.cpp:
+        (JSC::JSString::replaceCharacter): Don't use size_t and wtf::notFound.
+        Instead, use the individual types and notFound values of the string APIs
+        we're using, since they're not necessarily the same in 64bit.
+
+2010-05-11  Geoffrey Garen  <ggaren@apple.com>
+
         Reviewed by Oliver Hunt and Darin Adler.
 
         Start using ropes in String.prototype.replace.
index d33c836..df67133 100644 (file)
@@ -107,8 +107,8 @@ void JSString::resolveRope(ExecState* exec) const
 JSValue JSString::replaceCharacter(ExecState* exec, UChar character, const UString& replacement)
 {
     if (!isRope()) {
-        size_t matchPosition = m_value.find(character);
-        if (matchPosition == notFound)
+        unsigned matchPosition = m_value.find(character);
+        if (matchPosition == UString::NotFound)
             return JSValue(this);
         return jsString(exec, m_value.substr(0, matchPosition), replacement, m_value.substr(matchPosition + 1));
     }
@@ -118,7 +118,7 @@ JSValue JSString::replaceCharacter(ExecState* exec, UChar character, const UStri
     // Count total fibers and find matching string.
     size_t fiberCount = 0;
     UStringImpl* matchString = 0;
-    size_t matchPosition = notFound;
+    int matchPosition = -1;
     for (RopeIterator it(m_other.m_fibers, m_fiberCount); it != end; ++it) {
         ++fiberCount;
         if (matchString)
@@ -126,7 +126,7 @@ JSValue JSString::replaceCharacter(ExecState* exec, UChar character, const UStri
 
         UStringImpl* string = *it;
         matchPosition = string->find(character);
-        if (matchPosition == notFound)
+        if (matchPosition == -1)
             continue;
         matchString = string;
     }