From 42de5592999686f239f67ce8c785c55f84537187 Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Tue, 29 Jul 2003 20:45:11 +0000 Subject: 2003-07-29 Honda Hiroki * libc/stdio/vfprintf.c: Set output size to 1 when we have %f format with precision 0 and # flag not specified. --- newlib/libc/stdio/vfprintf.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'newlib/libc/stdio/vfprintf.c') diff --git a/newlib/libc/stdio/vfprintf.c b/newlib/libc/stdio/vfprintf.c index 82255735e..c10103d23 100644 --- a/newlib/libc/stdio/vfprintf.c +++ b/newlib/libc/stdio/vfprintf.c @@ -830,7 +830,9 @@ reswitch: switch (ch) { if (prec || flags & ALT) size += prec + 1; } else /* "0.X" */ - size = prec + 2; + size = (prec || flags & ALT) + ? prec + 2 + : 1; } else if (expt >= ndig) { /* fixed g fmt */ size = expt; if (flags & ALT) -- cgit v1.2.3