mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-11 17:00:37 +00:00
AK: Use StringBuilder::appendff() instead of appendf()
This commit is contained in:
parent
db0149056f
commit
764af6cdec
Notes:
sideshowbarker
2024-07-18 22:28:32 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/764af6cdecb
4 changed files with 11 additions and 11 deletions
|
@ -73,7 +73,7 @@ String encode_hex(ReadonlyBytes input)
|
|||
StringBuilder output(input.size() * 2);
|
||||
|
||||
for (auto ch : input)
|
||||
output.appendf("%02x", ch);
|
||||
output.appendff("{:02x}", ch);
|
||||
|
||||
return output.build();
|
||||
}
|
||||
|
|
|
@ -172,7 +172,7 @@ inline void JsonValue::serialize(Builder& builder) const
|
|||
break;
|
||||
#if !defined(KERNEL)
|
||||
case Type::Double:
|
||||
builder.appendf("%g", m_value.as_double);
|
||||
builder.appendff("{}", m_value.as_double);
|
||||
break;
|
||||
#endif
|
||||
case Type::Int32:
|
||||
|
|
|
@ -88,43 +88,43 @@ public:
|
|||
void add(const StringView& key, int value)
|
||||
{
|
||||
begin_item(key);
|
||||
m_builder.appendf("%d", value);
|
||||
m_builder.appendff("{}", value);
|
||||
}
|
||||
|
||||
void add(const StringView& key, unsigned value)
|
||||
{
|
||||
begin_item(key);
|
||||
m_builder.appendf("%u", value);
|
||||
m_builder.appendff("{}", value);
|
||||
}
|
||||
|
||||
void add(const StringView& key, long value)
|
||||
{
|
||||
begin_item(key);
|
||||
m_builder.appendf("%ld", value);
|
||||
m_builder.appendff("{}", value);
|
||||
}
|
||||
|
||||
void add(const StringView& key, long unsigned value)
|
||||
{
|
||||
begin_item(key);
|
||||
m_builder.appendf("%lu", value);
|
||||
m_builder.appendff("{}", value);
|
||||
}
|
||||
|
||||
void add(const StringView& key, long long value)
|
||||
{
|
||||
begin_item(key);
|
||||
m_builder.appendf("%lld", value);
|
||||
m_builder.appendff("{}", value);
|
||||
}
|
||||
|
||||
void add(const StringView& key, long long unsigned value)
|
||||
{
|
||||
begin_item(key);
|
||||
m_builder.appendf("%llu", value);
|
||||
m_builder.appendff("{}", value);
|
||||
}
|
||||
|
||||
void add(const StringView& key, double value)
|
||||
{
|
||||
begin_item(key);
|
||||
m_builder.appendf("%f", value);
|
||||
m_builder.appendff("{}", value);
|
||||
}
|
||||
|
||||
JsonArraySerializer<Builder> add_array(const StringView& key)
|
||||
|
|
|
@ -207,9 +207,9 @@ void dump_bytes(ReadonlyBytes bytes)
|
|||
auto flush = [&]() {
|
||||
if (nrepeat > 0) {
|
||||
if (nrepeat == 1)
|
||||
builder.appendf("%s0x%02x", prefix, static_cast<int>(buffered_byte));
|
||||
builder.appendff("{}{:#02x}", prefix, static_cast<int>(buffered_byte));
|
||||
else
|
||||
builder.appendf("%s%zu * 0x%02x", prefix, nrepeat, static_cast<int>(buffered_byte));
|
||||
builder.appendff("{}{} * {:#02x}", prefix, nrepeat, static_cast<int>(buffered_byte));
|
||||
|
||||
nrepeat = 0;
|
||||
prefix = ", ";
|
||||
|
|
Loading…
Reference in a new issue