summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Bugaev <bugaevc@serenityos.org>2020-03-26 01:09:02 +0300
committerAndreas Kling <kling@serenityos.org>2020-03-26 08:01:16 +0100
commit5bb18bf5487c942f41f98d7d3de94aa8b4947d86 (patch)
tree65288d19868d9fdad9fc3d9e8688dd892fb6177c
parentd01b97b50a6efd61a3baa1220c828e77356c3354 (diff)
downloadserenity-5bb18bf5487c942f41f98d7d3de94aa8b4947d86.zip
AK: Use print_string() for %c formatting
Instead of simply outputting the character. This way, we get proper padding support and other niceties strings enjoy.
-rw-r--r--AK/PrintfImplementation.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/AK/PrintfImplementation.h b/AK/PrintfImplementation.h
index 3fa916c20c..34a7c7106a 100644
--- a/AK/PrintfImplementation.h
+++ b/AK/PrintfImplementation.h
@@ -387,10 +387,10 @@ template<typename PutChFunc>
ret += print_hex(putch, bufptr, va_arg(ap, int), false, alternate_form, false, true, 2);
break;
- case 'c':
- putch(bufptr, (char)va_arg(ap, int));
- ++ret;
- break;
+ case 'c': {
+ char s[2] { (char)va_arg(ap, int), 0 };
+ ret += print_string(putch, bufptr, s, left_pad, fieldWidth, dot);
+ } break;
case '%':
putch(bufptr, '%');