summaryrefslogtreecommitdiffstats
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
commit5ebe489329be7fc6fbc8cef266f81b952a5e5aa7 (patch)
treed649ed2369bee201643b7727ee7f7b6bca853b28
parenta5ad15b9b336e8aad31af5544c6d01dc0ae6f524 (diff)
downloadruby-5ebe489329be7fc6fbc8cef266f81b952a5e5aa7.tar.gz
ruby-5ebe489329be7fc6fbc8cef266f81b952a5e5aa7.tar.xz
ruby-5ebe489329be7fc6fbc8cef266f81b952a5e5aa7.zip
* sprintf.c (rb_str_format): space flag is in effect for Inf/NaN too.
[ruby-dev:34002] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15720 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--sprintf.c2
2 files changed, 7 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 2176d01e1..d758dbc96 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Thu Mar 6 17:26:53 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * sprintf.c (rb_str_format): space flag is in effect for Inf/NaN too.
+ [ruby-dev:34002]
+
Thu Mar 6 15:44:20 2008 NAKAMURA Usaku <usa@ruby-lang.org>
* sprintf.c (rb_str_format): casting double to long is undefined
diff --git a/sprintf.c b/sprintf.c
index 63ac093f2..1e3e76c4a 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));
}