From 5bb18bf5487c942f41f98d7d3de94aa8b4947d86 Mon Sep 17 00:00:00 2001 From: Sergey Bugaev Date: Thu, 26 Mar 2020 01:09:02 +0300 Subject: [PATCH] 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. --- AK/PrintfImplementation.h | 8 ++++---- 1 file 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 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, '%');