~ chicken-core (chicken-5) 2e4ec6d4d6dfdb6d80760571c8608a6c16f69362
commit 2e4ec6d4d6dfdb6d80760571c8608a6c16f69362 Author: felix <felix@call-with-current-continuation.org> AuthorDate: Thu Jul 11 12:14:50 2013 +0200 Commit: Christian Kellermann <ckeen@pestilenz.org> CommitDate: Thu Jul 11 12:23:11 2013 +0200 Explicitly add trailing 0 when printing fractions on mingw32 On mingw32 gcvt(3) doesn't add a trailing zero to it's output when the argument has a zero fractional part. This change adds '\0' explicitly in that case. Reported by Michele La Monaca, who also tested the fix. Signed-off-by: Christian Kellermann <ckeen@pestilenz.org> diff --git a/runtime.c b/runtime.c index d7d79f2c..33e4d111 100644 --- a/runtime.c +++ b/runtime.c @@ -7832,6 +7832,11 @@ void C_ccall C_number_to_string(C_word c, C_word closure, C_word k, C_word num, } else if(buffer[ 1 ] != 'i') C_strcat(buffer, C_text(".0")); /* negative infinity? */ } +#ifdef __MINGW32__ + /* On mingw32, gcvt(3) does not add a trailing '\0' */ + else if(buffer[ C_strlen(buffer) - 1 ] == '.') + C_strcat(buffer, C_text("0")); +#endif p = buffer; }Trap