Commit 15a17812 authored by andersca@apple.com's avatar andersca@apple.com

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

* wtf/text/StringBuffer.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155126 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 018cdd8a
2013-09-05 Anders Carlsson <andersca@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 <andersca@apple.com>
Vector::releaseBuffer should return an OwnPtr
......
......@@ -44,11 +44,12 @@ public:
{
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 @@ public:
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 = m_data.release();
return data.release();
CharType* data = m_data;
m_data = 0;
return adoptPtr(data);
}
private:
unsigned m_length;
OwnPtr<CharType> m_data;
CharType* m_data;
};
} // namespace WTF
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment