diff options
Diffstat (limited to 'Source/WTF/wtf/text/StringBuilder.h')
-rw-r--r-- | Source/WTF/wtf/text/StringBuilder.h | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/Source/WTF/wtf/text/StringBuilder.h b/Source/WTF/wtf/text/StringBuilder.h index 5b2322701..e65f8f301 100644 --- a/Source/WTF/wtf/text/StringBuilder.h +++ b/Source/WTF/wtf/text/StringBuilder.h @@ -111,10 +111,18 @@ public: void append(UChar c) { - if (m_buffer && !m_is8Bit && m_length < m_buffer->length() && m_string.isNull()) - m_bufferCharacters16[m_length++] = c; - else - append(&c, 1); + if (m_buffer && m_length < m_buffer->length() && m_string.isNull()) { + if (!m_is8Bit) { + m_bufferCharacters16[m_length++] = c; + return; + } + + if (!(c & ~0xff)) { + m_bufferCharacters8[m_length++] = static_cast<LChar>(c); + return; + } + } + append(&c, 1); } void append(LChar c) |