Title: [126780] trunk/Source/WTF
Revision
126780
Author
[email protected]
Date
2012-08-27 11:55:11 -0700 (Mon, 27 Aug 2012)

Log Message

Even up WTF::String to CString functions
https://bugs.webkit.org/show_bug.cgi?id=95008

Reviewed by Sam Weinig.

Apply advantages from UString to WTF::String.

* wtf/text/WTFString.cpp:
(WTF::String::ascii): There is no need to special case the null length, both
following branches use CString::newUninitialized(), which create empty string
for null length.
(WTF::String::latin1): Use characters16() instead of characters() to avoid
testing is8Bit() a second time.

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (126779 => 126780)


--- trunk/Source/WTF/ChangeLog	2012-08-27 18:54:15 UTC (rev 126779)
+++ trunk/Source/WTF/ChangeLog	2012-08-27 18:55:11 UTC (rev 126780)
@@ -1,3 +1,19 @@
+2012-08-27  Benjamin Poulain  <[email protected]>
+
+        Even up WTF::String to CString functions
+        https://bugs.webkit.org/show_bug.cgi?id=95008
+
+        Reviewed by Sam Weinig.
+
+        Apply advantages from UString to WTF::String.
+
+        * wtf/text/WTFString.cpp:
+        (WTF::String::ascii): There is no need to special case the null length, both
+        following branches use CString::newUninitialized(), which create empty string
+        for null length.
+        (WTF::String::latin1): Use characters16() instead of characters() to avoid
+        testing is8Bit() a second time.
+
 2012-08-24  Benjamin Poulain  <[email protected]>
 
         Touch Platform.h to solve a build dependency issue

Modified: trunk/Source/WTF/wtf/text/WTFString.cpp (126779 => 126780)


--- trunk/Source/WTF/wtf/text/WTFString.cpp	2012-08-27 18:54:15 UTC (rev 126779)
+++ trunk/Source/WTF/wtf/text/WTFString.cpp	2012-08-27 18:55:11 UTC (rev 126780)
@@ -1,6 +1,6 @@
 /*
  * (C) 1999 Lars Knoll ([email protected])
- * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010, 2012 Apple Inc. All rights reserved.
  * Copyright (C) 2007-2009 Torch Mobile, Inc.
  *
  * This library is free software; you can redistribute it and/or
@@ -604,11 +604,6 @@
 
     unsigned length = this->length();
 
-    if (!length) {
-        char* characterBuffer;
-        return CString::newUninitialized(length, characterBuffer);
-    }
-
     if (this->is8Bit()) {
         const LChar* characters = this->characters8();
 
@@ -649,7 +644,7 @@
     if (is8Bit())
         return CString(reinterpret_cast<const char*>(this->characters8()), length);
 
-    const UChar* characters = this->characters();
+    const UChar* characters = this->characters16();
 
     char* characterBuffer;
     CString result = CString::newUninitialized(length, characterBuffer);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to