Title: [155126] trunk/Source/WTF
Revision
155126
Author
ander...@apple.com
Date
2013-09-05 10:11:55 -0700 (Thu, 05 Sep 2013)

Log Message

Change StringBuffer back to not use an OwnPtr in an attempt to fix ports.

* wtf/text/StringBuffer.h:

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (155125 => 155126)


--- trunk/Source/WTF/ChangeLog	2013-09-05 17:10:13 UTC (rev 155125)
+++ trunk/Source/WTF/ChangeLog	2013-09-05 17:11:55 UTC (rev 155126)
@@ -1,3 +1,9 @@
+2013-09-05  Anders Carlsson  <ander...@apple.com>
+
+        Change StringBuffer back to not use an OwnPtr in an attempt to fix ports.
+        
+        * wtf/text/StringBuffer.h:
+
 2013-09-04  Anders Carlsson  <ander...@apple.com>
 
         Vector::releaseBuffer should return an OwnPtr

Modified: trunk/Source/WTF/wtf/text/StringBuffer.h (155125 => 155126)


--- trunk/Source/WTF/wtf/text/StringBuffer.h	2013-09-05 17:10:13 UTC (rev 155125)
+++ trunk/Source/WTF/wtf/text/StringBuffer.h	2013-09-05 17:11:55 UTC (rev 155126)
@@ -44,11 +44,12 @@
     {
         if (m_length > std::numeric_limits<unsigned>::max() / sizeof(CharType))
             CRASH();
-        m_data = adoptPtr(static_cast<CharType*>(fastMalloc(m_length * sizeof(CharType))));
+        m_data = static_cast<CharType*>(fastMalloc(m_length * sizeof(CharType)));
     }
 
     ~StringBuffer()
     {
+        fastFree(m_data);
     }
 
     void shrink(unsigned newLength)
@@ -62,29 +63,26 @@
         if (newLength > m_length) {
             if (newLength > std::numeric_limits<unsigned>::max() / sizeof(UChar))
                 CRASH();
-            m_data = adoptPtr(static_cast<UChar*>(fastRealloc(m_data.release().leakPtr(), newLength * sizeof(UChar))));
+            m_data = static_cast<UChar*>(fastRealloc(m_data, newLength * sizeof(UChar)));
         }
         m_length = newLength;
     }
 
     unsigned length() const { return m_length; }
-    CharType* characters() { return m_data.get(); }
+    CharType* characters() { return m_data; }
 
-    CharType& operator[](unsigned i)
-    {
-        ASSERT_WITH_SECURITY_IMPLICATION(i < m_length);
-        return m_data.get()[i];
-    }
+    CharType& operator[](unsigned i) { ASSERT_WITH_SECURITY_IMPLICATION(i < m_length); return m_data[i]; }
 
     PassOwnPtr<CharType> release()
     {
-        OwnPtr<CharType> data = ""
-        return data.release();
+        CharType* data = ""
+        m_data = 0;
+        return adoptPtr(data);
     }
 
 private:
     unsigned m_length;
-    OwnPtr<CharType> m_data;
+    CharType* m_data;
 };
 
 } // namespace WTF
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to