summaryrefslogtreecommitdiff
path: root/sprintf.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-07-26 08:28:57 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-07-26 08:28:57 +0000
commit79c5eb1af36690c6d45975b3db93613819230bc3 (patch)
tree26a19b6497eef7659f5dcbe0d353b2ab1f384fbf /sprintf.c
parent69be57eb57a7318f8fd806e806f6a092d9689e8f (diff)
* sprintf.c (rb_str_format): prepend ".." to %u for negative bignum,
but not "-". fixed: [ruby-core:08167] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10604 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'sprintf.c')
-rw-r--r--sprintf.c34
1 files changed, 16 insertions, 18 deletions
diff --git a/sprintf.c b/sprintf.c
index a85595f3cc..264b17c6b9 100644
--- a/sprintf.c
+++ b/sprintf.c
@@ -625,25 +625,23 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
if (base == 10) {
rb_warning("negative number for %%u specifier");
}
- 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);
- s = RSTRING(tmp)->ptr;
+ 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);
+ s = RSTRING(tmp)->ptr;
}
}
}