summaryrefslogtreecommitdiff
path: root/sprintf.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-07-26 08:29:21 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-07-26 08:29:21 +0000
commit1bc1c9f103c60fed79a1aac57da3323ad5e18ba4 (patch)
tree480f836a634d952b98a1285a5e17b505ca49b555 /sprintf.c
parent63b2b93950f9b0038927537578aff87aff4a1ece (diff)
* sprintf.c (rb_f_sprintf): prepend ".." to %u for negative bignum,
but not "-". fixed: [ruby-core:08167] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10605 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'sprintf.c')
-rw-r--r--sprintf.c35
1 files changed, 16 insertions, 19 deletions
diff --git a/sprintf.c b/sprintf.c
index 3c0bc5cd2b..9ad7e0c4cc 100644
--- a/sprintf.c
+++ b/sprintf.c
@@ -626,27 +626,24 @@ rb_f_sprintf(argc, argv)
if (*s == '-') {
if (base == 10) {
rb_warning("negative number for %%u specifier");
- s++;
}
- else {
- remove_sign_bits(++s, base);
- tmp = rb_str_new(0, 3+strlen(s));
- t = RSTRING(tmp)->ptr;
- if (!(flags&(FPREC|FZERO))) {
- strcpy(t, "..");
- t += 2;
- }
- switch (base) {
- case 16:
- if (s[0] != 'f') strcpy(t++, "f"); break;
- case 8:
- if (s[0] != '7') strcpy(t++, "7"); break;
- case 2:
- if (s[0] != '1') strcpy(t++, "1"); break;
- }
- strcpy(t, s);
- bignum = 2;
+ remove_sign_bits(++s, base);
+ tmp = rb_str_new(0, 3+strlen(s));
+ t = RSTRING(tmp)->ptr;
+ if (!(flags&(FPREC|FZERO))) {
+ strcpy(t, "..");
+ t += 2;
+ }
+ switch (base) {
+ case 16:
+ if (s[0] != 'f') strcpy(t++, "f"); break;
+ case 8:
+ if (s[0] != '7') strcpy(t++, "7"); break;
+ case 2:
+ if (s[0] != '1') strcpy(t++, "1"); break;
}
+ strcpy(t, s);
+ bignum = 2;
}
s = RSTRING(tmp)->ptr;