Reviewed by Darin Adler.
authortimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 8 Jan 2008 00:12:55 +0000 (00:12 +0000)
committertimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 8 Jan 2008 00:12:55 +0000 (00:12 +0000)
        Fix ASSERTION FAILED: dstOffset + srcSegmentLength == static_cast<int>(data.size())
        when the replacment string is a different length.

        * platform/text/StringImpl.cpp:
        (WebCore::StringImpl::replace): Move the parenthesis to be around only the subtraction in
        the Vector size calculation, correcting the order of math operations.

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

WebCore/ChangeLog
WebCore/platform/text/StringImpl.cpp

index c8b9904..ae8337c 100644 (file)
@@ -1,3 +1,14 @@
+2008-01-07  Timothy Hatcher  <timothy@apple.com>
+
+        Reviewed by Darin Adler.
+
+        Fix ASSERTION FAILED: dstOffset + srcSegmentLength == static_cast<int>(data.size())
+        when the replacment string is a different length.
+
+        * platform/text/StringImpl.cpp:
+        (WebCore::StringImpl::replace): Move the parenthesis to be around only the subtraction in
+        the Vector size calculation, correcting the order of math operations.
+
 2008-01-07  Nikolas Zimmermann  <zimmermann@kde.org>
 
         Reviewed by Eric. Hopefully fix build with mac tiger after the unicode-range addition. NSInteger not available there.
index 189f054..84f09d8 100644 (file)
@@ -848,7 +848,7 @@ PassRefPtr<StringImpl> StringImpl::replace(StringImpl* pattern, StringImpl* repl
     if (!matchCount)
         return this;
     
-    Vector<UChar> data(m_length + (matchCount * repStrLength - patternLength));
+    Vector<UChar> data(m_length + matchCount * (repStrLength - patternLength));
     
     // Construct the new data
     int srcSegmentEnd;