summaryrefslogtreecommitdiff
path: root/userland/libc/stdio
diff options
context:
space:
mode:
authorAnton Kling <anton@kling.gg>2024-06-26 01:41:28 +0200
committerAnton Kling <anton@kling.gg>2024-06-26 01:41:28 +0200
commit33e1b11555d3557a36bd69d63f5bf0c290b5d462 (patch)
tree7690db8310fc26f70b3cb96c8d2241969303cfe7 /userland/libc/stdio
parent3bed68592da11f2d013f76534220275739dd7556 (diff)
LibC: Fix printf formatting
Previously %02x would not print out padding if the given value was zero.
Diffstat (limited to 'userland/libc/stdio')
-rw-r--r--userland/libc/stdio/vfprintf.c6
1 files changed, 1 insertions, 5 deletions
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;