diff options
author | asynts <asynts@gmail.com> | 2020-09-29 13:55:58 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-09-29 16:14:58 +0200 |
commit | 71b7ef0992b5d18bd4d463943a5ab3f3876ce41d (patch) | |
tree | 8836d4780cafe0dabae6866a8cd6ed1a8680d5a2 /AK/PrintfImplementation.h | |
parent | c0d9daadb07432db6667d2f3b9080af9f26f6925 (diff) | |
download | serenity-71b7ef0992b5d18bd4d463943a5ab3f3876ce41d.zip |
AK+Format: Support all format specifiers for strings.
The following is now possible:
outf("{:.4}", "abcdef"); // abcd
outf("{:*<8}", "abcdef"); // abcdef**
Diffstat (limited to 'AK/PrintfImplementation.h')
-rw-r--r-- | AK/PrintfImplementation.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/AK/PrintfImplementation.h b/AK/PrintfImplementation.h index 4fd8665ece..f7926968c2 100644 --- a/AK/PrintfImplementation.h +++ b/AK/PrintfImplementation.h @@ -141,7 +141,7 @@ inline size_t convert_unsigned_to_string( }; const auto used_by_field = used_by_significant_digits + used_by_prefix; - const auto used_by_padding = static_cast<size_t>(max<ssize_t>(0, static_cast<ssize_t>(width) - static_cast<ssize_t>(used_by_field))); + const auto used_by_padding = width < used_by_field ? 0 : width - used_by_field; if (align == Align::Left) { const auto used_by_right_padding = used_by_padding; |