| Index: third_party/WebKit/Source/wtf/text/StringBuilder.cpp
|
| diff --git a/third_party/WebKit/Source/wtf/text/StringBuilder.cpp b/third_party/WebKit/Source/wtf/text/StringBuilder.cpp
|
| index 9236bf6fb55526c337cbc82ed4074f5da8cbc934..5b075f0a4403efe387f41999ab818ef4145c712d 100644
|
| --- a/third_party/WebKit/Source/wtf/text/StringBuilder.cpp
|
| +++ b/third_party/WebKit/Source/wtf/text/StringBuilder.cpp
|
| @@ -170,8 +170,9 @@ void StringBuilder::reallocateBuffer<LChar>(unsigned requiredLength)
|
| if (m_buffer->hasOneRef()) {
|
| m_buffer = StringImpl::reallocate(m_buffer.release(), requiredLength);
|
| m_bufferCharacters8 = const_cast<LChar*>(m_buffer->characters8());
|
| - } else
|
| + } else {
|
| allocateBuffer(m_buffer->characters8(), requiredLength);
|
| + }
|
| }
|
|
|
| template <>
|
| @@ -186,8 +187,9 @@ void StringBuilder::reallocateBuffer<UChar>(unsigned requiredLength)
|
| } else if (m_buffer->hasOneRef()) {
|
| m_buffer = StringImpl::reallocate(m_buffer.release(), requiredLength);
|
| m_bufferCharacters16 = const_cast<UChar*>(m_buffer->characters16());
|
| - } else
|
| + } else {
|
| allocateBuffer(m_buffer->characters16(), requiredLength);
|
| + }
|
| }
|
|
|
| void StringBuilder::reserveCapacity(unsigned newCapacity)
|
| @@ -206,10 +208,11 @@ void StringBuilder::reserveCapacity(unsigned newCapacity)
|
| if (!m_length) {
|
| LChar* nullPlaceholder = 0;
|
| allocateBuffer(nullPlaceholder, newCapacity);
|
| - } else if (m_string.is8Bit())
|
| + } else if (m_string.is8Bit()) {
|
| allocateBuffer(m_string.characters8(), newCapacity);
|
| - else
|
| + } else {
|
| allocateBuffer(m_string.characters16(), newCapacity);
|
| + }
|
| }
|
| }
|
| }
|
| @@ -290,8 +293,9 @@ void StringBuilder::append(const UChar* characters, unsigned length)
|
|
|
| memcpy(m_bufferCharacters16 + m_length, characters, static_cast<size_t>(length) * sizeof(UChar));
|
| m_length = requiredLength;
|
| - } else
|
| + } else {
|
| memcpy(appendUninitialized<UChar>(length), characters, static_cast<size_t>(length) * sizeof(UChar));
|
| + }
|
| }
|
|
|
| void StringBuilder::append(const LChar* characters, unsigned length)
|
| @@ -302,9 +306,9 @@ void StringBuilder::append(const LChar* characters, unsigned length)
|
|
|
| if (m_is8Bit) {
|
| LChar* dest = appendUninitialized<LChar>(length);
|
| - if (length > 8)
|
| + if (length > 8) {
|
| memcpy(dest, characters, static_cast<size_t>(length) * sizeof(LChar));
|
| - else {
|
| + } else {
|
| const LChar* end = characters + length;
|
| while (characters < end)
|
| *(dest++) = *(characters++);
|
|
|