From 81caf951362e18b3851f89289b1953c776c4a656 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Wed, 11 Sep 2019 20:08:11 +0200 Subject: [PATCH] printf: %w, %b, and %p should be zero-padded but not left-padded This fixes the goofy issue with %p coming out as " 0x123" instead of "0x00000123". --- AK/PrintfImplementation.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/AK/PrintfImplementation.h b/AK/PrintfImplementation.h index e93103739c1..5c8e431d8d1 100644 --- a/AK/PrintfImplementation.h +++ b/AK/PrintfImplementation.h @@ -331,11 +331,11 @@ template break; case 'w': - ret += print_hex(putch, bufptr, va_arg(ap, int), false, alternate_form, true, true, 4); + ret += print_hex(putch, bufptr, va_arg(ap, int), false, alternate_form, false, true, 4); break; case 'b': - ret += print_hex(putch, bufptr, va_arg(ap, int), false, alternate_form, true, true, 2); + ret += print_hex(putch, bufptr, va_arg(ap, int), false, alternate_form, false, true, 2); break; case 'c': @@ -350,7 +350,7 @@ template case 'P': case 'p': - ret += print_hex(putch, bufptr, va_arg(ap, u32), *p == 'P', true, true, true, 8); + ret += print_hex(putch, bufptr, va_arg(ap, u32), *p == 'P', true, false, true, 8); break; default: dbg() << "printf_internal: Unimplemented format specifier " << *p;