Changeset 248552 in webkit


Ignore:
Timestamp:
Aug 12, 2019 4:09:06 PM (5 years ago)
Author:
weinig@apple.com
Message:

Replace multiparameter overloads of append() in StringBuilder as a first step toward standardizinging on the flexibleAppend() implementation
https://bugs.webkit.org/show_bug.cgi?id=200614

Reviewed by Darin Adler.

Renames StringBuilder::append(const LChar*, unsigned), StringBuilder::append(const UChar*, unsigned) and
StringBuilder::append(const char*, unsigned) to StringBuilder::appendCharacters(...).

Renames StringBuilder::append(const String& string, unsigned offset, unsigned length) to
StringBuilder::appendSubstring(...).

Source/JavaScriptCore:

  • dfg/DFGStrengthReductionPhase.cpp:

(JSC::DFG::StrengthReductionPhase::handleNode):

  • runtime/ConfigFile.cpp:

(JSC::ConfigFile::parse):

  • runtime/LiteralParser.cpp:

(JSC::LiteralParser<CharType>::Lexer::lexStringSlow):

  • tools/FunctionOverrides.cpp:

(JSC::parseClause):
Update for renames.

Source/WebCore:

  • dom/Range.cpp:

(WebCore::Range::toString const):

  • editing/Editing.cpp:

(WebCore::stringWithRebalancedWhitespace):

  • editing/MarkupAccumulator.cpp:

(WebCore::appendCharactersReplacingEntitiesInternal):

  • editing/TextIterator.cpp:

(WebCore::TextIteratorCopyableText::appendToStringBuilder const):

  • html/HTMLTextFormControlElement.cpp:

(WebCore::HTMLTextFormControlElement::valueWithHardLineBreaks const):

  • html/parser/HTMLTokenizer.cpp:

(WebCore::HTMLTokenizer::bufferedCharacters const):

  • platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:

(WebCore::InbandTextTrackPrivateAVF::processNativeSamples):

  • platform/text/SegmentedString.cpp:

(WebCore::SegmentedString::Substring::appendTo const):

  • platform/text/TextCodecICU.cpp:

(WebCore::TextCodecICU::decode):

  • xml/XSLTProcessorLibxslt.cpp:

(WebCore::writeToStringBuilder):
Update for renames.

Source/WebKit:

  • Shared/mac/AuxiliaryProcessMac.mm:

(WebKit::setAndSerializeSandboxParameters):

  • UIProcess/WebProcessPool.cpp:

(WebKit::WebProcessPool::didReceiveInvalidMessage):
Update for renames.

Source/WTF:

  • wtf/HexNumber.h:

(WTF::appendUnsignedAsHexFixedSize):
Add overload that explicitly takes a StringBuilder to work around rename from append to appendCharacters.

  • wtf/text/StringBuilder.cpp:

(WTF::StringBuilder::appendCharacters):
(WTF::StringBuilder::append):

  • wtf/text/StringBuilder.h:

(WTF::StringBuilder::appendCharacters):
(WTF::StringBuilder::append):
(WTF::StringBuilder::appendSubstring):
(WTF::StringBuilder::appendLiteral):
(WTF::IntegerToStringConversionTrait<StringBuilder>::flush):
Update for renames.

Tools:

  • TestWebKitAPI/Tests/WTF/StringBuilder.cpp:

(TestWebKitAPI::TEST):
Update for renames.

Location:
trunk
Files:
28 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r248547 r248552  
     12019-08-12  Sam Weinig  <weinig@apple.com>
     2
     3        Replace multiparameter overloads of append() in StringBuilder as a first step toward standardizinging on the flexibleAppend() implementation
     4        https://bugs.webkit.org/show_bug.cgi?id=200614
     5
     6        Reviewed by Darin Adler.
     7
     8        Renames StringBuilder::append(const LChar*, unsigned), StringBuilder::append(const UChar*, unsigned) and
     9        StringBuilder::append(const char*, unsigned) to StringBuilder::appendCharacters(...).
     10       
     11        Renames StringBuilder::append(const String& string, unsigned offset, unsigned length) to
     12        StringBuilder::appendSubstring(...).
     13
     14        * dfg/DFGStrengthReductionPhase.cpp:
     15        (JSC::DFG::StrengthReductionPhase::handleNode):
     16        * runtime/ConfigFile.cpp:
     17        (JSC::ConfigFile::parse):
     18        * runtime/LiteralParser.cpp:
     19        (JSC::LiteralParser<CharType>::Lexer::lexStringSlow):
     20        * tools/FunctionOverrides.cpp:
     21        (JSC::parseClause):
     22        Update for renames.
     23
    1242019-08-12  Adrian Perez de Castro  <aperez@igalia.com>
    225
  • trunk/Source/JavaScriptCore/dfg/DFGStrengthReductionPhase.cpp

    r247387 r248552  
    855855                unsigned replLen = replace.length();
    856856                if (lastIndex < result.start || replLen) {
    857                     builder.append(string, lastIndex, result.start - lastIndex);
     857                    builder.appendSubstring(string, lastIndex, result.start - lastIndex);
    858858                    if (replLen) {
    859859                        StringBuilder replacement;
     
    900900            else {
    901901                if (lastIndex < string.length())
    902                     builder.append(string, lastIndex, string.length() - lastIndex);
     902                    builder.appendSubstring(string, lastIndex, string.length() - lastIndex);
    903903               
    904904                m_node->convertToLazyJSConstant(m_graph, LazyJSValue::newString(m_graph, builder.toString()));
  • trunk/Source/JavaScriptCore/runtime/ConfigFile.cpp

    r243754 r248552  
    315315                        p++;
    316316
    317                     builder.append(optionNameStart, p - optionNameStart);
     317                    builder.appendCharacters(optionNameStart, p - optionNameStart);
    318318
    319319                    while (*p && isASCIISpace(*p) && *p != '=')
     
    337337                        p++;
    338338
    339                     builder.append(optionValueStart, p - optionValueStart);
     339                    builder.appendCharacters(optionValueStart, p - optionValueStart);
    340340                    builder.append('\n');
    341341
  • trunk/Source/JavaScriptCore/runtime/LiteralParser.cpp

    r239427 r248552  
    623623
    624624        if (!m_builder.isEmpty())
    625             m_builder.append(runStart, m_ptr - runStart);
     625            m_builder.appendCharacters(runStart, m_ptr - runStart);
    626626
    627627slowPathBegin:
    628628        if ((m_mode != NonStrictJSON) && m_ptr < m_end && *m_ptr == '\\') {
    629629            if (m_builder.isEmpty() && runStart < m_ptr)
    630                 m_builder.append(runStart, m_ptr - runStart);
     630                m_builder.appendCharacters(runStart, m_ptr - runStart);
    631631            ++m_ptr;
    632632            if (m_ptr >= m_end) {
  • trunk/Source/JavaScriptCore/tools/FunctionOverrides.cpp

    r239569 r248552  
    218218                FAIL_WITH_ERROR(SYNTAX_ERROR, ("Unexpected characters after '", keyword, "' clause end delimiter '", delimiter, "':\n", line, "\n"));
    219219
    220             builder.append(line, p - line + 1);
     220            builder.appendCharacters(line, p - line + 1);
    221221            return builder.toString();
    222222        }
  • trunk/Source/WTF/ChangeLog

    r248546 r248552  
     12019-08-12  Sam Weinig  <weinig@apple.com>
     2
     3        Replace multiparameter overloads of append() in StringBuilder as a first step toward standardizinging on the flexibleAppend() implementation
     4        https://bugs.webkit.org/show_bug.cgi?id=200614
     5
     6        Reviewed by Darin Adler.
     7
     8        Renames StringBuilder::append(const LChar*, unsigned), StringBuilder::append(const UChar*, unsigned) and
     9        StringBuilder::append(const char*, unsigned) to StringBuilder::appendCharacters(...).
     10       
     11        Renames StringBuilder::append(const String& string, unsigned offset, unsigned length) to
     12        StringBuilder::appendSubstring(...).
     13
     14        * wtf/HexNumber.h:
     15        (WTF::appendUnsignedAsHexFixedSize):
     16        Add overload that explicitly takes a StringBuilder to work around rename from append to appendCharacters.
     17
     18        * wtf/text/StringBuilder.cpp:
     19        (WTF::StringBuilder::appendCharacters):
     20        (WTF::StringBuilder::append):
     21        * wtf/text/StringBuilder.h:
     22        (WTF::StringBuilder::appendCharacters):
     23        (WTF::StringBuilder::append):
     24        (WTF::StringBuilder::appendSubstring):
     25        (WTF::StringBuilder::appendLiteral):
     26        (WTF::IntegerToStringConversionTrait<StringBuilder>::flush):
     27        Update for renames.
     28
    1292019-08-12  Yusuke Suzuki  <ysuzuki@apple.com>
    230
  • trunk/Source/WTF/wtf/HexNumber.h

    r248546 r248552  
    2222
    2323#include <array>
     24#include <wtf/text/StringBuilder.h>
    2425#include <wtf/text/StringConcatenate.h>
    2526
     
    7374}
    7475
     76// FIXME: Consider renaming to appendHex.
     77// Same as appendUnsignedAsHex, but zero-padding to get at least the desired number of digits.
     78template<typename NumberType>
     79inline void appendUnsignedAsHexFixedSize(NumberType number, StringBuilder& destination, unsigned minimumDigits, HexConversionMode mode = Uppercase)
     80{
     81    // Each byte can generate up to two digits.
     82    std::array<LChar, sizeof(NumberType) * 2> buffer;
     83    auto result = Internal::appendHex(buffer, number, minimumDigits, mode);
     84    destination.appendCharacters(result.first, result.second);
     85}
     86
    7587struct HexNumberBuffer {
    7688    WTF_MAKE_STRUCT_FAST_ALLOCATED;
  • trunk/Source/WTF/wtf/text/StringBuilder.cpp

    r247537 r248552  
    304304}
    305305
    306 void StringBuilder::append(const UChar* characters, unsigned length)
     306void StringBuilder::appendCharacters(const UChar* characters, unsigned length)
    307307{
    308308    if (!length || hasOverflowed())
     
    315315            // Append as 8 bit character
    316316            LChar lChar = static_cast<LChar>(*characters);
    317             return append(&lChar, 1);
     317            return appendCharacters(&lChar, 1);
    318318        }
    319319
     
    346346}
    347347
    348 void StringBuilder::append(const LChar* characters, unsigned length)
     348void StringBuilder::appendCharacters(const LChar* characters, unsigned length)
    349349{
    350350    if (!length || hasOverflowed())
     
    384384    // Fast path: avoid constructing a temporary String when possible.
    385385    if (auto* characters = CFStringGetCStringPtr(string, kCFStringEncodingISOLatin1)) {
    386         append(reinterpret_cast<const LChar*>(characters), CFStringGetLength(string));
     386        appendCharacters(reinterpret_cast<const LChar*>(characters), CFStringGetLength(string));
    387387        return;
    388388    }
  • trunk/Source/WTF/wtf/text/StringBuilder.h

    r248546 r248552  
    7070    ALWAYS_INLINE bool crashesOnOverflow() const { return m_length.shouldCrashOnOverflow(); }
    7171
    72     WTF_EXPORT_PRIVATE void append(const UChar*, unsigned);
    73     WTF_EXPORT_PRIVATE void append(const LChar*, unsigned);
    74 
    75     ALWAYS_INLINE void append(const char* characters, unsigned length) { append(reinterpret_cast<const LChar*>(characters), length); }
     72    WTF_EXPORT_PRIVATE void appendCharacters(const UChar*, unsigned);
     73    WTF_EXPORT_PRIVATE void appendCharacters(const LChar*, unsigned);
     74
     75    ALWAYS_INLINE void appendCharacters(const char* characters, unsigned length) { appendCharacters(reinterpret_cast<const LChar*>(characters), length); }
    7676
    7777    void append(const AtomString& atomString)
     
    9898
    9999        if (string.is8Bit())
    100             append(string.characters8(), string.length());
     100            appendCharacters(string.characters8(), string.length());
    101101        else
    102             append(string.characters16(), string.length());
     102            appendCharacters(string.characters16(), string.length());
    103103    }
    104104
     
    123123
    124124        if (other.is8Bit())
    125             append(other.characters8(), other.m_length.unsafeGet());
     125            appendCharacters(other.characters8(), other.m_length.unsafeGet());
    126126        else
    127             append(other.characters16(), other.m_length.unsafeGet());
     127            appendCharacters(other.characters16(), other.m_length.unsafeGet());
    128128    }
    129129
     
    131131    {
    132132        if (stringView.is8Bit())
    133             append(stringView.characters8(), stringView.length());
     133            appendCharacters(stringView.characters8(), stringView.length());
    134134        else
    135             append(stringView.characters16(), stringView.length());
     135            appendCharacters(stringView.characters16(), stringView.length());
    136136    }
    137137
     
    143143#endif
    144144   
    145     void append(const String& string, unsigned offset, unsigned length)
     145    void appendSubstring(const String& string, unsigned offset, unsigned length)
    146146    {
    147147        if (!string.length())
     
    152152
    153153        if (string.is8Bit())
    154             append(string.characters8() + offset, length);
     154            appendCharacters(string.characters8() + offset, length);
    155155        else
    156             append(string.characters16() + offset, length);
     156            appendCharacters(string.characters16() + offset, length);
    157157    }
    158158
     
    160160    {
    161161        if (characters)
    162             append(characters, strlen(characters));
     162            appendCharacters(characters, strlen(characters));
    163163    }
    164164
     
    181181            }
    182182        }
    183         append(&c, 1);
     183        appendCharacters(&c, 1);
    184184    }
    185185
     
    196196            m_length++;
    197197        } else
    198             append(&c, 1);
     198            appendCharacters(&c, 1);
    199199    }
    200200
     
    217217
    218218    template<unsigned characterCount>
    219     ALWAYS_INLINE void appendLiteral(const char (&characters)[characterCount]) { append(characters, characterCount - 1); }
     219    ALWAYS_INLINE void appendLiteral(const char (&characters)[characterCount]) { appendCharacters(characters, characterCount - 1); }
    220220
    221221    WTF_EXPORT_PRIVATE void appendNumber(int);
     
    470470    using ReturnType = void;
    471471    using AdditionalArgumentType = StringBuilder;
    472     static void flush(LChar* characters, unsigned length, StringBuilder* stringBuilder) { stringBuilder->append(characters, length); }
     472    static void flush(LChar* characters, unsigned length, StringBuilder* stringBuilder) { stringBuilder->appendCharacters(characters, length); }
    473473};
    474474
  • trunk/Source/WebCore/ChangeLog

    r248547 r248552  
     12019-08-12  Sam Weinig  <weinig@apple.com>
     2
     3        Replace multiparameter overloads of append() in StringBuilder as a first step toward standardizinging on the flexibleAppend() implementation
     4        https://bugs.webkit.org/show_bug.cgi?id=200614
     5
     6        Reviewed by Darin Adler.
     7
     8        Renames StringBuilder::append(const LChar*, unsigned), StringBuilder::append(const UChar*, unsigned) and
     9        StringBuilder::append(const char*, unsigned) to StringBuilder::appendCharacters(...).
     10       
     11        Renames StringBuilder::append(const String& string, unsigned offset, unsigned length) to
     12        StringBuilder::appendSubstring(...).
     13
     14        * dom/Range.cpp:
     15        (WebCore::Range::toString const):
     16        * editing/Editing.cpp:
     17        (WebCore::stringWithRebalancedWhitespace):
     18        * editing/MarkupAccumulator.cpp:
     19        (WebCore::appendCharactersReplacingEntitiesInternal):
     20        * editing/TextIterator.cpp:
     21        (WebCore::TextIteratorCopyableText::appendToStringBuilder const):
     22        * html/HTMLTextFormControlElement.cpp:
     23        (WebCore::HTMLTextFormControlElement::valueWithHardLineBreaks const):
     24        * html/parser/HTMLTokenizer.cpp:
     25        (WebCore::HTMLTokenizer::bufferedCharacters const):
     26        * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:
     27        (WebCore::InbandTextTrackPrivateAVF::processNativeSamples):
     28        * platform/text/SegmentedString.cpp:
     29        (WebCore::SegmentedString::Substring::appendTo const):
     30        * platform/text/TextCodecICU.cpp:
     31        (WebCore::TextCodecICU::decode):
     32        * xml/XSLTProcessorLibxslt.cpp:
     33        (WebCore::writeToStringBuilder):
     34        Update for renames.
     35
    1362019-08-12  Adrian Perez de Castro  <aperez@igalia.com>
    237
  • trunk/Source/WebCore/dom/Range.cpp

    r247730 r248552  
    947947            unsigned start = node == &startContainer() ? std::min(m_start.offset(), length) : 0U;
    948948            unsigned end = node == &endContainer() ? std::min(std::max(start, m_end.offset()), length) : length;
    949             builder.append(data, start, end - start);
     949            builder.appendSubstring(data, start, end - start);
    950950        }
    951951    }
  • trunk/Source/WebCore/editing/Editing.cpp

    r248037 r248552  
    421421            continue;
    422422        rebalancedString.reserveCapacity(length);
    423         rebalancedString.append(string, rebalancedString.length(), i - rebalancedString.length());
     423        rebalancedString.appendSubstring(string, rebalancedString.length(), i - rebalancedString.length());
    424424        rebalancedString.append(selectedWhitespaceCharacter);
    425425    }
     
    429429
    430430    rebalancedString.reserveCapacity(length);
    431     rebalancedString.append(string, rebalancedString.length(), length - rebalancedString.length());
     431    rebalancedString.appendSubstring(string, rebalancedString.length(), length - rebalancedString.length());
    432432    return rebalancedString.toString();
    433433}
  • trunk/Source/WebCore/editing/MarkupAccumulator.cpp

    r248042 r248552  
    151151        uint8_t substitution = character < WTF_ARRAY_LENGTH(entityMap) ? entityMap[character] : static_cast<uint8_t>(EntitySubstitutionNullIndex);
    152152        if (UNLIKELY(substitution != EntitySubstitutionNullIndex) && entitySubstitutionList[substitution].mask & entityMask) {
    153             result.append(text + positionAfterLastEntity, i - positionAfterLastEntity);
    154             result.append(entitySubstitutionList[substitution].characters, entitySubstitutionList[substitution].length);
     153            result.appendCharacters(text + positionAfterLastEntity, i - positionAfterLastEntity);
     154            result.appendCharacters(entitySubstitutionList[substitution].characters, entitySubstitutionList[substitution].length);
    155155            positionAfterLastEntity = i + 1;
    156156        }
    157157    }
    158     result.append(text + positionAfterLastEntity, length - positionAfterLastEntity);
     158    result.appendCharacters(text + positionAfterLastEntity, length - positionAfterLastEntity);
    159159}
    160160
  • trunk/Source/WebCore/editing/TextIterator.cpp

    r244200 r248552  
    336336        builder.append(m_singleCharacter);
    337337    else
    338         builder.append(m_string, m_offset, m_length);
     338        builder.appendSubstring(m_string, m_offset, m_length);
    339339}
    340340
  • trunk/Source/WebCore/html/HTMLTextFormControlElement.cpp

    r247367 r248552  
    718718            while (breakNode == node && breakOffset <= length) {
    719719                if (breakOffset > position) {
    720                     result.append(data, position, breakOffset - position);
     720                    result.appendSubstring(data, position, breakOffset - position);
    721721                    position = breakOffset;
    722722                    result.append(newlineCharacter);
     
    724724                getNextSoftBreak(line, breakNode, breakOffset);
    725725            }
    726             result.append(data, position, length - position);
     726            result.appendSubstring(data, position, length - position);
    727727        }
    728728        while (breakNode == node)
  • trunk/Source/WebCore/html/parser/HTMLTokenizer.cpp

    r246490 r248552  
    14021402    characters.append('<');
    14031403    characters.append('/');
    1404     characters.append(m_temporaryBuffer.data(), m_temporaryBuffer.size());
     1404    characters.appendCharacters(m_temporaryBuffer.data(), m_temporaryBuffer.size());
    14051405    return characters.toString();
    14061406}
  • trunk/Source/WebCore/platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp

    r243164 r248552  
    530530            // reccognized this string as a full header.
    531531            StringBuilder header;
    532             header.append(reinterpret_cast<const unsigned char*>(CFDataGetBytePtr(webvttHeaderData)), length);
     532            header.appendCharacters(reinterpret_cast<const unsigned char*>(CFDataGetBytePtr(webvttHeaderData)), length);
    533533            header.append("\n\n");
    534534
  • trunk/Source/WebCore/platform/text/SegmentedString.cpp

    r209129 r248552  
    2828inline void SegmentedString::Substring::appendTo(StringBuilder& builder) const
    2929{
    30     builder.append(string, string.length() - length, length);
     30    builder.appendSubstring(string, string.length() - length, length);
    3131}
    3232
  • trunk/Source/WebCore/platform/text/TextCodecICU.cpp

    r225618 r248552  
    308308    do {
    309309        int ucharsDecoded = decodeToBuffer(buffer, bufferLimit, source, sourceLimit, offsets, flush, err);
    310         result.append(buffer, ucharsDecoded);
     310        result.appendCharacters(buffer, ucharsDecoded);
    311311    } while (err == U_BUFFER_OVERFLOW_ERROR);
    312312
  • trunk/Source/WebCore/platform/wpe/RenderThemeWPE.cpp

    r236666 r248552  
    5959{
    6060    StringBuilder scriptBuilder;
    61     scriptBuilder.append(mediaControlsLocalizedStringsJavaScript, sizeof(mediaControlsLocalizedStringsJavaScript));
    62     scriptBuilder.append(mediaControlsBaseJavaScript, sizeof(mediaControlsBaseJavaScript));
     61    scriptBuilder.appendCharacters(mediaControlsLocalizedStringsJavaScript, sizeof(mediaControlsLocalizedStringsJavaScript));
     62    scriptBuilder.appendCharacters(mediaControlsBaseJavaScript, sizeof(mediaControlsBaseJavaScript));
    6363    return scriptBuilder.toString();
    6464}
  • trunk/Source/WebCore/rendering/RenderThemeGtk.cpp

    r248033 r248552  
    12131213{
    12141214    StringBuilder scriptBuilder;
    1215     scriptBuilder.append(mediaControlsLocalizedStringsJavaScript, sizeof(mediaControlsLocalizedStringsJavaScript));
    1216     scriptBuilder.append(mediaControlsBaseJavaScript, sizeof(mediaControlsBaseJavaScript));
    1217     scriptBuilder.append(mediaControlsGtkJavaScript, sizeof(mediaControlsGtkJavaScript));
     1215    scriptBuilder.appendCharacters(mediaControlsLocalizedStringsJavaScript, sizeof(mediaControlsLocalizedStringsJavaScript));
     1216    scriptBuilder.appendCharacters(mediaControlsBaseJavaScript, sizeof(mediaControlsBaseJavaScript));
     1217    scriptBuilder.appendCharacters(mediaControlsGtkJavaScript, sizeof(mediaControlsGtkJavaScript));
    12181218    return scriptBuilder.toString();
    12191219}
  • trunk/Source/WebCore/xml/XSLTProcessorLibxslt.cpp

    r244828 r248552  
    191191    }
    192192
    193     resultOutput.append(outputBuffer.data(), outputOffset);
     193    resultOutput.appendCharacters(outputBuffer.data(), outputOffset);
    194194    return inputOffset;
    195195}
  • trunk/Source/WebKit/ChangeLog

    r248550 r248552  
     12019-08-12  Sam Weinig  <weinig@apple.com>
     2
     3        Replace multiparameter overloads of append() in StringBuilder as a first step toward standardizinging on the flexibleAppend() implementation
     4        https://bugs.webkit.org/show_bug.cgi?id=200614
     5
     6        Reviewed by Darin Adler.
     7
     8        Renames StringBuilder::append(const LChar*, unsigned), StringBuilder::append(const UChar*, unsigned) and
     9        StringBuilder::append(const char*, unsigned) to StringBuilder::appendCharacters(...).
     10       
     11        Renames StringBuilder::append(const String& string, unsigned offset, unsigned length) to
     12        StringBuilder::appendSubstring(...).
     13
     14        * Shared/mac/AuxiliaryProcessMac.mm:
     15        (WebKit::setAndSerializeSandboxParameters):
     16        * UIProcess/WebProcessPool.cpp:
     17        (WebKit::WebProcessPool::didReceiveInvalidMessage):
     18        Update for renames.
     19
    1202019-08-12  Dean Jackson  <dino@apple.com>
    221
  • trunk/Source/WebKit/Shared/mac/AuxiliaryProcessMac.mm

    r246892 r248552  
    235235            CRASH();
    236236        }
    237         builder.append(name, strlen(name));
     237        builder.append(name);
    238238        builder.append(':');
    239         builder.append(value, strlen(value));
     239        builder.append(value);
    240240        builder.append(':');
    241241    }
     
    244244        if (!contents)
    245245            return WTF::nullopt;
    246         builder.append(contents->data(), contents->size());
     246        builder.appendCharacters(contents->data(), contents->size());
    247247    } else
    248248        builder.append(profileOrProfilePath);
  • trunk/Source/WebKit/UIProcess/WebProcessPool.cpp

    r248526 r248552  
    793793
    794794    StringBuilder messageNameStringBuilder;
    795     messageNameStringBuilder.append(messageReceiverName.data(), messageReceiverName.size());
     795    messageNameStringBuilder.appendCharacters(messageReceiverName.data(), messageReceiverName.size());
    796796    messageNameStringBuilder.append('.');
    797     messageNameStringBuilder.append(messageName.data(), messageName.size());
     797    messageNameStringBuilder.appendCharacters(messageName.data(), messageName.size());
    798798
    799799    s_invalidMessageCallback(toAPI(API::String::create(messageNameStringBuilder.toString()).ptr()));
  • trunk/Tools/ChangeLog

    r248548 r248552  
     12019-08-12  Sam Weinig  <weinig@apple.com>
     2
     3        Replace multiparameter overloads of append() in StringBuilder as a first step toward standardizinging on the flexibleAppend() implementation
     4        https://bugs.webkit.org/show_bug.cgi?id=200614
     5
     6        Reviewed by Darin Adler.
     7
     8        Renames StringBuilder::append(const LChar*, unsigned), StringBuilder::append(const UChar*, unsigned) and
     9        StringBuilder::append(const char*, unsigned) to StringBuilder::appendCharacters(...).
     10       
     11        Renames StringBuilder::append(const String& string, unsigned offset, unsigned length) to
     12        StringBuilder::appendSubstring(...).
     13
     14        * TestWebKitAPI/Tests/WTF/StringBuilder.cpp:
     15        (TestWebKitAPI::TEST):
     16        Update for renames.
     17
    1182019-08-12  Megan Gardner  <megan_gardner@apple.com>
    219
  • trunk/Tools/TestWebKitAPI/Tests/WTF/StringBuilder.cpp

    r247537 r248552  
    6565    builder.append("abcd");
    6666    expectBuilderContent("0123456789abcd", builder);
    67     builder.append("efgh", 3);
     67    builder.appendCharacters("efgh", 3);
    6868    expectBuilderContent("0123456789abcdefg", builder);
    6969    builder.append("");
     
    7474    builder.toString(); // Test after reifyString().
    7575    StringBuilder builder1;
    76     builder.append("", 0);
     76    builder.appendCharacters("", 0);
    7777    expectBuilderContent("0123456789abcdefg#", builder);
    78     builder1.append(builder.characters8(), builder.length());
     78    builder1.appendCharacters(builder.characters8(), builder.length());
    7979    builder1.append("XYZ");
    80     builder.append(builder1.characters8(), builder1.length());
     80    builder.appendCharacters(builder1.characters8(), builder1.length());
    8181    expectBuilderContent("0123456789abcdefg#0123456789abcdefg#XYZ", builder);
    8282
     
    105105        UChar32 frakturAChar = 0x1D504;
    106106        const UChar data[] = { U16_LEAD(frakturAChar), U16_TRAIL(frakturAChar) };
    107         builder2.append(data, 2);
     107        builder2.appendCharacters(data, 2);
    108108        ASSERT_EQ(2U, builder2.length());
    109109        String result2 = builder2.toString();
    110110        ASSERT_EQ(2U, result2.length());
    111111        builder.append(builder2);
    112         builder.append(data, 2);
     112        builder.appendCharacters(data, 2);
    113113        ASSERT_EQ(4U, builder.length());
    114114        const UChar resultArray[] = { U16_LEAD(frakturAChar), U16_TRAIL(frakturAChar), U16_LEAD(frakturAChar), U16_TRAIL(frakturAChar) };
     
    361361    { // AtomString constructed from an empty char* string.
    362362        StringBuilder builder;
    363         builder.append("", 0);
     363        builder.appendCharacters("", 0);
    364364        AtomString atomString = builder.toAtomString();
    365365        ASSERT_EQ(emptyAtom(), atomString);
  • trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebKitWebContext.cpp

    r248437 r248552  
    272272
    273273    if (contentLength <= baseLength)
    274         builder.append(baseString, 0, contentLength);
     274        builder.appendSubstring(baseString, 0, contentLength);
    275275    else {
    276276        unsigned currentLength = 0;
     
    279279                builder.append(baseString);
    280280            else
    281                 builder.append(baseString, 0, contentLength - currentLength);
     281                builder.appendSubstring(baseString, 0, contentLength - currentLength);
    282282
    283283            // Account for the 12 characters of the '<html><body>' prefix.
Note: See TracChangeset for help on using the changeset viewer.