1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 18:47:44 +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 00:38:09 +11:00 committed by Andreas Kling
parent 099b83fd28
commit 6d97b623cd
9 changed files with 10 additions and 10 deletions

View file

@ -57,7 +57,7 @@ int main(int argc, char** argv)
for (String filename : filenames) {
if (!filename.ends_with(".gz"))
filename = String::format("%s.gz", filename);
filename = String::format("%s.gz", filename.characters());
const auto input_filename = filename;
const auto output_filename = filename.substring_view(0, filename.length() - 3);

View file

@ -107,7 +107,7 @@ int main()
if (stat(tty.characters(), &st) == 0) {
auto idle_time = now - st.st_mtime;
if (idle_time >= 0) {
builder.appendf("%ds", idle_time);
builder.appendf("%llds", idle_time);
idle_string = builder.to_string();
}
}

View file

@ -45,7 +45,7 @@ static volatile pid_t child_pid = -1;
static String build_header_string(const Vector<const char*>& command, const struct timeval& interval)
{
StringBuilder builder;
builder.appendf("Every %d", interval.tv_sec);
builder.appendff("Every {}", interval.tv_sec);
builder.appendf(".%ds: \x1b[1m", interval.tv_usec / 100000);
builder.join(' ', command);
builder.append("\x1b[0m");