Changeset 133726 in webkit
- Timestamp:
- Nov 6, 2012, 11:13:20 PM (13 years ago)
- Location:
- trunk/Source/WTF
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r133653 r133726 1 2012-11-06 Michael Saboff <msaboff@apple.com> 2 3 StringBuilder::append(UChar) with an 8 bit quantity shouldn't change the contents to 16 bits 4 https://bugs.webkit.org/show_bug.cgi?id=101421 5 6 Reviewed by Anders Carlsson. 7 8 If the string builder contains only 8 bit data, check if the character being appended contains 9 8 bit data. If so, append it to the 8 bit buffer instead of converting the buffer to 16 bits. 10 11 * wtf/text/StringBuilder.cpp: 12 (WTF::StringBuilder::append): 13 * wtf/text/StringBuilder.h: 14 (WTF::StringBuilder::append): 15 1 16 2012-11-06 Benjamin Poulain <benjamin@webkit.org> 2 17 -
trunk/Source/WTF/wtf/text/StringBuilder.cpp
r128014 r133726 244 244 245 245 if (m_is8Bit) { 246 if (length == 1 && !(*characters & ~0xff)) { 247 // Append as 8 bit character 248 LChar lChar = static_cast<LChar>(*characters); 249 append(&lChar, 1); 250 return; 251 } 252 246 253 // Calculate the new size of the builder after appending. 247 254 unsigned requiredLength = length + m_length; -
trunk/Source/WTF/wtf/text/StringBuilder.h
r131250 r133726 112 112 void append(UChar c) 113 113 { 114 if (m_buffer && !m_is8Bit && m_length < m_buffer->length() && m_string.isNull()) 115 m_bufferCharacters16[m_length++] = c; 116 else 117 append(&c, 1); 114 if (m_buffer && m_length < m_buffer->length() && m_string.isNull()) { 115 if (!m_is8Bit) { 116 m_bufferCharacters16[m_length++] = c; 117 return; 118 } 119 120 if (!(c & ~0xff)) { 121 m_bufferCharacters8[m_length++] = static_cast<LChar>(c); 122 return; 123 } 124 } 125 append(&c, 1); 118 126 } 119 127
Note:
See TracChangeset
for help on using the changeset viewer.