Changeset 284456 in webkit


Ignore:
Timestamp:
Oct 19, 2021 9:00:19 AM (3 years ago)
Author:
fpizlo@apple.com
Message:

StringBuffer should really know that strings might be 8-bit
https://bugs.webkit.org/show_bug.cgi?id=231937

Reviewed by Yusuke Suzuki.

We somehow forgot to change this to use CharType instead of UChar.

  • wtf/text/StringBuffer.h:

(WTF::StringBuffer::resize):

Location:
trunk/Source/WTF
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r284439 r284456  
     12021-10-18  Filip Pizlo  <fpizlo@apple.com>
     2
     3        StringBuffer should really know that strings might be 8-bit
     4        https://bugs.webkit.org/show_bug.cgi?id=231937
     5
     6        Reviewed by Yusuke Suzuki.
     7
     8        We somehow forgot to change this to use CharType instead of UChar.
     9
     10        * wtf/text/StringBuffer.h:
     11        (WTF::StringBuffer::resize):
     12
    1132021-10-19  Cameron McCormack  <heycam@apple.com>
    214
  • trunk/Source/WTF/wtf/text/StringBuffer.h

    r278338 r284456  
    6464    void resize(unsigned newLength)
    6565    {
    66         if (newLength > m_length) {
    67             if (newLength > std::numeric_limits<unsigned>::max() / sizeof(UChar))
    68                 CRASH();
    69             m_data = static_cast<UChar*>(StringBufferMalloc::realloc(m_data, newLength * sizeof(UChar)));
    70         }
     66        if (newLength > m_length)
     67            m_data = static_cast<CharType*>(StringBufferMalloc::realloc(m_data, Checked<size_t>(newLength) * sizeof(CharType)));
    7168        m_length = newLength;
    7269    }
Note: See TracChangeset for help on using the changeset viewer.