diff options
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | stream.c | 11 |
2 files changed, 17 insertions, 4 deletions
@@ -1,5 +1,15 @@ 2014-01-09 Kaz Kylheku <kaz@kylheku.com> + Fix broken Json parsing test case on MinGW. + + * stream.c (vformat): Fix incorrect code for normalizing + exponent fields in the output of sprintf's floating-point + conversion. For ~e, the logic would let through a leading zero. + For ~a/~s conversion, it was comparing to 0 instead of '0', + not squashing leading zeros at all. + +2014-01-09 Kaz Kylheku <kaz@kylheku.com> + * stream.c: Eliminate useless #else section containing #error 2013-01-09 Kaz Kylheku <kaz@kylheku.com> @@ -1528,11 +1528,14 @@ val vformat(val stream, val fmtstr, va_list vl) else if (*scan == '+') scan++; - while (scan[0] == '0' && scan[1] == '0') + while (*scan == '0') scan++; - while (*scan) - *exp++ = *scan++; + if (!*scan) + *exp++ = '0'; + else + while (*scan) + *exp++ = *scan++; *exp = 0; } @@ -1588,7 +1591,7 @@ val vformat(val stream, val fmtstr, va_list vl) else if (*scan == '+') scan++; - while (*scan == 0) + while (*scan == '0') scan++; while (*scan) |