1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 19:15:09 +00:00

Everywhere: Fix incorrect uses of String::format and StringBuilder::appendf

These changes are arbitrarily divided into multiple commits to make it
easier to find potentially introduced bugs with git bisect.
This commit is contained in:
Sahan Fernando 2021-01-12 01:01:33 +11:00 committed by Andreas Kling
parent 6d97b623cd
commit fe2b8906d4
7 changed files with 21 additions and 21 deletions

View file

@ -714,16 +714,16 @@ const Vector<String> OpCode_Compare::variable_arguments_to_string(Optional<Match
} else if (compare_type == CharacterCompareType::NamedReference) {
auto ptr = (const char*)m_bytecode->at(offset++);
auto length = m_bytecode->at(offset++);
result.empend(String::format("name='%.*s'", length, ptr));
result.empend(String::format("name='%.*s'", (int)length, ptr));
} else if (compare_type == CharacterCompareType::Reference) {
auto ref = m_bytecode->at(offset++);
result.empend(String::format("number=%lu", ref));
result.empend(String::formatted("number={}", ref));
} else if (compare_type == CharacterCompareType::String) {
auto& length = m_bytecode->at(offset++);
StringBuilder str_builder;
for (size_t i = 0; i < length; ++i)
str_builder.append(m_bytecode->at(offset++));
result.empend(String::format("value=\"%.*s\"", length, str_builder.string_view().characters_without_null_termination()));
result.empend(String::format("value=\"%.*s\"", (int)length, str_builder.string_view().characters_without_null_termination()));
if (!view.is_null() && view.length() > state().string_position)
result.empend(String::format(
"compare against: \"%s\"",