| Index: Source/wtf/text/StringBuffer.h
|
| diff --git a/Source/wtf/text/StringBuffer.h b/Source/wtf/text/StringBuffer.h
|
| index 3e3315d01c35b48a84a98434a206b7c10d9ab89f..2a9b356ecc22cee7eeb9a52c50cf352e6e65274a 100644
|
| --- a/Source/wtf/text/StringBuffer.h
|
| +++ b/Source/wtf/text/StringBuffer.h
|
| @@ -40,6 +40,8 @@ template <typename CharType>
|
| class StringBuffer {
|
| WTF_MAKE_NONCOPYABLE(StringBuffer);
|
| public:
|
| + StringBuffer() { }
|
| +
|
| explicit StringBuffer(unsigned length)
|
| {
|
| RELEASE_ASSERT(length <= std::numeric_limits<unsigned>::max() / sizeof(CharType));
|
| @@ -60,8 +62,13 @@ public:
|
|
|
| void resize(unsigned newLength)
|
| {
|
| + RELEASE_ASSERT(newLength <= std::numeric_limits<unsigned>::max() / sizeof(CharType));
|
| + if (!m_data) {
|
| + CharType* characters;
|
| + m_data = StringImpl::createUninitialized(newLength, characters);
|
| + return;
|
| + }
|
| if (newLength > m_data->length()) {
|
| - RELEASE_ASSERT(newLength <= std::numeric_limits<unsigned>::max() / sizeof(UChar));
|
| CharType* characters;
|
| m_data = StringImpl::reallocate(m_data.release(), newLength, characters);
|
| return;
|
|
|