From 4d03fb11c96f54f54cca3ef8ff28423143f22d6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wiesner=20Andr=C3=A1s?= Date: Tue, 5 Sep 2023 13:40:55 +0200 Subject: [PATCH] %c printing repetition fixed --- embformat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/embformat.c b/embformat.c index b30cb31..c486672 100644 --- a/embformat.c +++ b/embformat.c @@ -337,7 +337,7 @@ static int pfn_double(va_list *va, FmtWord *fmt, char *outbuf, size_t free_space // print character static int pfn_char(va_list *va, FmtWord *fmt, char *outbuf, size_t free_space) { int c = va_arg((*va), int); - unsigned rep = (fmt->width == 0) ? 1 : fmt->width; // determine repetition count + unsigned rep = (fmt->width <= 0) ? 1 : fmt->width; // determine repetition count rep = MIN(free_space, rep); for (unsigned i = 0; i < rep; i++) { outbuf[i] = (char)c;