From 03c09d358ec20eb196188125637dd1692db39078 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Fri, 8 Feb 2019 13:44:31 +0100 Subject: [PATCH] mescc: Mes C Library: Support gcc-4.6.4: vfprintf, vsnprintf: pad with space. * lib/stdio/vfprintf.c (vfprintf): pad with space. * lib/stdio/vsnprintf.c (vsnprintf): pad with space. --- lib/stdio/vfprintf.c | 5 +++++ lib/stdio/vsnprintf.c | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/lib/stdio/vfprintf.c b/lib/stdio/vfprintf.c index 979ad8df..3386d4d6 100644 --- a/lib/stdio/vfprintf.c +++ b/lib/stdio/vfprintf.c @@ -48,6 +48,11 @@ vfprintf (FILE * f, char const *format, va_list ap) c = *++p; } char pad = ' '; + if (c == ' ') + { + pad = c; + c = *p++; + } if (c == '0') { pad = c; diff --git a/lib/stdio/vsnprintf.c b/lib/stdio/vsnprintf.c index a8d9624d..7f284646 100644 --- a/lib/stdio/vsnprintf.c +++ b/lib/stdio/vsnprintf.c @@ -50,6 +50,11 @@ vsnprintf (char *str, size_t size, char const *format, va_list ap) c = *++p; } char pad = ' '; + if (c == ' ') + { + pad = c; + c = *p++; + } if (c == '0') { pad = c;