summaryrefslogtreecommitdiff
path: root/sprintf.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-03-06 08:26:55 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-03-06 08:26:55 +0000
commitec2205b2052ddf72685e6e6f1c25d0b3c19de831 (patch)
treed649ed2369bee201643b7727ee7f7b6bca853b28 /sprintf.c
parentfe2a671fdb1333914a2b751fefc6191c2c3c28e9 (diff)
* sprintf.c (rb_str_format): space flag is in effect for Inf/NaN too.
[ruby-dev:34002] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15720 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'sprintf.c')
-rw-r--r--sprintf.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sprintf.c b/sprintf.c
index 63ac093..1e3e76c 100644
--- a/sprintf.c
+++ b/sprintf.c
@@ -794,6 +794,8 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
buf[blen + need - strlen(expr) - 1] = '-';
else if (flags & FPLUS)
buf[blen + need - strlen(expr) - 1] = '+';
+ else if ((flags & FSPACE) && need > width)
+ blen++;
strncpy(&buf[blen + need - strlen(expr)], expr,
strlen(expr));
}