[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

andersca at apple.com andersca at apple.com
Wed Dec 22 14:13:57 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit de2df837b6f82e3bafd8cc88e548cbc32164a1a7
Author: andersca at apple.com <andersca at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Oct 5 18:36:23 2010 +0000

    REGRESSION (r68966?): All dumpAsText test fail on WebKit2
    https://bugs.webkit.org/show_bug.cgi?id=47188
    <rdar://problem/8514104>
    
    Reviewed by Sam Weinig.
    
    When constructing the std::string, use the real string length instead of the maximum buffer size.
    
    * TestWebKitAPI/PlatformUtilities.h:
    (TestWebKitAPI::Util::toSTD):
    * WebKitTestRunner/StringFunctions.h:
    (WTR::toSTD):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69129 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index f86ef79..f28b522 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,18 @@
+2010-10-05  Anders Carlsson  <andersca at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        REGRESSION (r68966?): All dumpAsText test fail on WebKit2
+        https://bugs.webkit.org/show_bug.cgi?id=47188
+        <rdar://problem/8514104>
+
+        When constructing the std::string, use the real string length instead of the maximum buffer size.
+
+        * TestWebKitAPI/PlatformUtilities.h:
+        (TestWebKitAPI::Util::toSTD):
+        * WebKitTestRunner/StringFunctions.h:
+        (WTR::toSTD):
+
 2010-10-04  Sam Weinig  <sam at webkit.org>
 
         Reviewed by Mark Rowe.
diff --git a/WebKitTools/TestWebKitAPI/PlatformUtilities.h b/WebKitTools/TestWebKitAPI/PlatformUtilities.h
index 1e546cc..fee3f05 100644
--- a/WebKitTools/TestWebKitAPI/PlatformUtilities.h
+++ b/WebKitTools/TestWebKitAPI/PlatformUtilities.h
@@ -43,9 +43,8 @@ inline std::string toSTD(WKStringRef string)
 {
     size_t bufferSize = WKStringGetMaximumUTF8CStringSize(string);
     OwnArrayPtr<char> buffer = adoptArrayPtr(new char[bufferSize]);
-    WKStringGetUTF8CString(string, buffer.get(), bufferSize);
-
-    return std::string(buffer.get(), bufferSize);
+    size_t stringLength = WKStringGetUTF8CString(string, buffer.get(), bufferSize);
+    return std::string(buffer.get(), stringLength - 1);
 }
 
 } // namespace Util
diff --git a/WebKitTools/TestWebKitAPI/Tests/WebKit2/WKString.cpp b/WebKitTools/TestWebKitAPI/Tests/WebKit2/WKString.cpp
index c415a0d..97962d5 100644
--- a/WebKitTools/TestWebKitAPI/Tests/WebKit2/WKString.cpp
+++ b/WebKitTools/TestWebKitAPI/Tests/WebKit2/WKString.cpp
@@ -38,13 +38,13 @@ TEST(WKString)
     TEST_ASSERT(WKStringGetMaximumUTF8CStringSize(string) == 16);
 
     size_t maxSize = WKStringGetMaximumUTF8CStringSize(string);
-    char* buffer = (char*)malloc(maxSize);
-    
+    char* buffer = new char[maxSize];
+
     size_t actualSize = WKStringGetUTF8CString(string, buffer, maxSize);
     TEST_ASSERT(actualSize == 6);
     TEST_ASSERT(strcmp(buffer, "hello") == 0);
 
-    free(buffer);
+    delete[] buffer;
     
     WKRelease(string);
 }
diff --git a/WebKitTools/WebKitTestRunner/StringFunctions.h b/WebKitTools/WebKitTestRunner/StringFunctions.h
index c80e40f..ba048ea 100644
--- a/WebKitTools/WebKitTestRunner/StringFunctions.h
+++ b/WebKitTools/WebKitTestRunner/StringFunctions.h
@@ -70,9 +70,8 @@ inline std::string toSTD(WKStringRef string)
 {
     size_t bufferSize = WKStringGetMaximumUTF8CStringSize(string);
     OwnArrayPtr<char> buffer = adoptArrayPtr(new char[bufferSize]);
-    WKStringGetUTF8CString(string, buffer.get(), bufferSize);
-
-    return std::string(buffer.get(), bufferSize);
+    size_t stringLength = WKStringGetUTF8CString(string, buffer.get(), bufferSize);
+    return std::string(buffer.get(), stringLength - 1);
 }
 
 inline std::string toSTD(const WKRetainPtr<WKStringRef>& string)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list