1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 22:57:34 +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

@ -1356,7 +1356,7 @@ String Style::to_string() const
if (m_foreground.m_is_rgb) {
builder.join(", ", m_foreground.m_rgb_color);
} else {
builder.appendf("(XtermColor) %d", m_foreground.m_xterm_color);
builder.appendf("(XtermColor) %d", (int)m_foreground.m_xterm_color);
}
builder.append("), ");
}
@ -1366,7 +1366,7 @@ String Style::to_string() const
if (m_background.m_is_rgb) {
builder.join(' ', m_background.m_rgb_color);
} else {
builder.appendf("(XtermColor) %d", m_background.m_xterm_color);
builder.appendf("(XtermColor) %d", (int)m_background.m_xterm_color);
}
builder.append("), ");
}

View file

@ -153,7 +153,7 @@ void XtermSuggestionDisplay::display(const SuggestionManager& manager)
if (m_pages.size() > 1) {
auto left_arrow = page_index > 0 ? '<' : ' ';
auto right_arrow = page_index < m_pages.size() - 1 ? '>' : ' ';
auto string = String::format("%c page %d of %d %c", left_arrow, page_index + 1, m_pages.size(), right_arrow);
auto string = String::format("%c page %zu of %zu %c", left_arrow, page_index + 1, m_pages.size(), right_arrow);
if (string.length() > m_num_columns - 1) {
// This would overflow into the next line, so just don't print an indicator.