From 0e55071bc70a3efe6e6a397808849697e440ae05 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Fri, 20 Sep 2019 14:44:31 +0200 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 00ac4917..0b2c30a0 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 b1ed2e0a..9a8d796d 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;