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

barraclough at apple.com barraclough at apple.com
Wed Dec 22 12:39:58 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit a71092e8c2d72ac3c06ad57e509143c76ac3bc7d
Author: barraclough at apple.com <barraclough at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Aug 26 22:22:33 2010 +0000

    Bug 44655 - Add debug only convenience methods to obtain a Vector<char> from a String/StringImpl.
    
    Reviewed by Brady Eidson.
    
    * wtf/text/WTFString.cpp:
    (asciiDebug):
        Return a Vector<char> containing the contents of a string as ASCII.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@66142 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index 685ec61..7431d6e 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,3 +1,13 @@
+2010-08-26  Gavin Barraclough  <barraclough at apple.com>
+
+        Reviewed by Brady Eidson.
+
+        Bug 44655 - Add debug only convenience methods to obtain a Vector<char> from a String/StringImpl.
+
+        * wtf/text/WTFString.cpp:
+        (asciiDebug):
+            Return a Vector<char> containing the contents of a string as ASCII.
+
 2010-08-26  Sam Weinig  <sam at webkit.org>
 
         Reviewed by Darin Adler.
diff --git a/JavaScriptCore/wtf/text/WTFString.cpp b/JavaScriptCore/wtf/text/WTFString.cpp
index bbff576..3f7b39f 100644
--- a/JavaScriptCore/wtf/text/WTFString.cpp
+++ b/JavaScriptCore/wtf/text/WTFString.cpp
@@ -985,11 +985,38 @@ unsigned numberToString(double x, NumberToStringBuffer& buffer)
 } // namespace WTF
 
 #ifndef NDEBUG
-// For use in the debugger - leaks memory
+// For use in the debugger
 String* string(const char*);
+Vector<char> asciiDebug(StringImpl* impl);
+Vector<char> asciiDebug(String& string);
 
 String* string(const char* s)
 {
+    // leaks memory!
     return new String(s);
 }
+
+Vector<char> asciiDebug(StringImpl* impl)
+{
+    if (!impl)
+        return asciiDebug(String("[null]").impl());
+
+    Vector<char> buffer;
+    unsigned length = impl->length();
+    const UChar* characters = impl->characters();
+
+    buffer.resize(length);
+    for (unsigned i = 0; i < length; ++i) {
+        UChar ch = characters[i];
+        buffer[i] = ch && (ch < 0x20 || ch > 0x7f) ? '?' : ch;
+    }
+
+    return buffer;
+}
+
+Vector<char> asciiDebug(String& string)
+{
+    return asciiDebug(string.impl());
+}
+
 #endif

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list