From 33e1b11555d3557a36bd69d63f5bf0c290b5d462 Mon Sep 17 00:00:00 2001 From: Anton Kling Date: Wed, 26 Jun 2024 01:41:28 +0200 Subject: LibC: Fix printf formatting Previously %02x would not print out padding if the given value was zero. --- userland/libc/stdio/vfprintf.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'userland/libc/stdio/vfprintf.c') diff --git a/userland/libc/stdio/vfprintf.c b/userland/libc/stdio/vfprintf.c index 7006578..2ba3e2c 100644 --- a/userland/libc/stdio/vfprintf.c +++ b/userland/libc/stdio/vfprintf.c @@ -10,7 +10,7 @@ const char HEX_SET[0x10] = {'0', '1', '2', '3', '4', '5', '6', '7', #define FILE_WRITE(_f, _s, _l, _r) \ { \ size_t _rc = _f->write(_f, (const unsigned char *)_s, _l); \ - if ((size_t)-1 == _rc) \ + if ((size_t) - 1 == _rc) \ assert(0); \ *(int *)(_r) += _rc; \ } @@ -18,10 +18,6 @@ const char HEX_SET[0x10] = {'0', '1', '2', '3', '4', '5', '6', '7', int fprint_num(FILE *f, long long n, int base, char *char_set, int prefix, int zero_padding, int right_padding) { int c = 0; - if (0 == n) { - zero_padding = 1; - prefix = 1; - } char str[32]; int i = 0; -- cgit v1.2.3