From 5c511de4cc001b66fac941c6f064f903e1005302 Mon Sep 17 00:00:00 2001 From: Tim Schumacher Date: Tue, 7 Dec 2021 14:47:01 +0100 Subject: [PATCH] AK: Zero-pad automatically if formatting with precision --- AK/PrintfImplementation.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/AK/PrintfImplementation.h b/AK/PrintfImplementation.h index 408733d5d7..38b5fcf360 100644 --- a/AK/PrintfImplementation.h +++ b/AK/PrintfImplementation.h @@ -443,6 +443,7 @@ ALWAYS_INLINE int printf_internal(PutChFunc putch, char* buffer, const char*& fm } else { if (!state.has_fraction_length) { state.has_fraction_length = true; + state.zero_pad = true; state.fraction_length = 0; } state.fraction_length *= 10; @@ -454,6 +455,7 @@ ALWAYS_INLINE int printf_internal(PutChFunc putch, char* buffer, const char*& fm if (*p == '*') { if (state.dot) { state.has_fraction_length = true; + state.zero_pad = true; state.fraction_length = NextArgument()(ap); } else { state.field_width = NextArgument()(ap);