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

paroga at webkit.org paroga at webkit.org
Wed Dec 22 18:22:54 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit a124a010f010c1df3fa2379e06ccb9ac0a5535ff
Author: paroga at webkit.org <paroga at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Dec 10 10:33:27 2010 +0000

    2010-12-10  Patrick Gansterer  <paroga at webkit.org>
    
            Reviewed by Eric Seidel.
    
            Cleanup StringWx.cpp
            https://bugs.webkit.org/show_bug.cgi?id=50525
    
            Use StringImpl::createUninitialized to avoid memcpy and fix style issues.
    
            * wtf/wx/StringWx.cpp:
            (WTF::String::String):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@73704 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index b839134..6bac927 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,3 +1,15 @@
+2010-12-10  Patrick Gansterer  <paroga at webkit.org>
+
+        Reviewed by Eric Seidel.
+
+        Cleanup StringWx.cpp
+        https://bugs.webkit.org/show_bug.cgi?id=50525
+
+        Use StringImpl::createUninitialized to avoid memcpy and fix style issues.
+
+        * wtf/wx/StringWx.cpp:
+        (WTF::String::String):
+
 2010-12-10  Carlos Garcia Campos  <cgarcia at igalia.com>
 
         Reviewed by Martin Robinson.
diff --git a/JavaScriptCore/wtf/wx/StringWx.cpp b/JavaScriptCore/wtf/wx/StringWx.cpp
index 665587d..59d500b 100644
--- a/JavaScriptCore/wtf/wx/StringWx.cpp
+++ b/JavaScriptCore/wtf/wx/StringWx.cpp
@@ -33,21 +33,15 @@
 
 namespace WTF {
 
-// String conversions
 String::String(const wxString& wxstr)
 {
 #if !wxUSE_UNICODE
     #error "This code only works in Unicode build of wxWidgets"
 #endif
 
-    // ICU's UChar is 16bit wide, UTF-16, and the code below counts on it, so
-    // it would break if the definition changed:
-    wxCOMPILE_TIME_ASSERT(sizeof(UChar) == 2, UCharSizeMustBe16Bit);
+#if SIZEOF_WCHAR_T == sizeof(UChar)
 
-#if SIZEOF_WCHAR_T == 2 // wchar_t==UChar
-
-    const UChar* str = wxstr.wc_str();
-    const size_t len = wxstr.length();
+    m_impl = StringImpl::create(wxstr.wc_str(), wxstr.length());
 
 #else // SIZEOF_WCHAR_T == 4
 
@@ -58,27 +52,19 @@ String::String(const wxString& wxstr)
 
 #if defined(wxUSE_UNICODE_UTF8) && wxUSE_UNICODE_UTF8
     // in wx3's UTF8 mode, wc_str() returns a buffer, not raw pointer
-   wxWCharBuffer widestr(wxstr.wc_str());
+    wxWCharBuffer wideString(wxstr.wc_str());
 #else
-    const wxChar *widestr = wxstr.wc_str();
+    const wxChar *wideString = wxstr.wc_str();
 #endif
-    const size_t widelen = wxstr.length();
+    size_t wideLength = wxstr.length();
 
-    // allocate buffer for the UTF-16 string:
+    UChar* data;
     wxMBConvUTF16 conv;
-    const size_t utf16bufLen = conv.FromWChar(NULL, 0, widestr, widelen);
-    wxCharBuffer utf16buf(utf16bufLen);
-
-    // and convert wxString to UTF-16 (=UChar*):
-    const UChar* str = (const UChar*)utf16buf.data();
-    size_t len = conv.FromWChar(utf16buf.data(), utf16bufLen, widestr, widelen) / 2;
+    unsigned utf16Length = conv.FromWChar(0, 0, wideString, wideLength);
+    m_impl = StringImpl::createUninitialized(utf16Length, data)
+    conv.FromWChar(data, utf16Length, wideString, wideLength);
 
 #endif // SIZEOF_WCHAR_T == 4
-
-    // conversion to UTF-16 or getting internal buffer isn't supposed to fail:
-    wxASSERT_MSG(str != NULL, _T("failed string conversion?"));
-
-    m_impl = StringImpl::create(str, len);
 }
 
 String::operator wxString() const
@@ -86,4 +72,4 @@ String::operator wxString() const
     return wxString(utf8().data(), wxConvUTF8);
 }
 
-} // namespace WebCore
+} // namespace WTF

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list