diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-07-26 08:29:21 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-07-26 08:29:21 +0000 |
commit | 1bc1c9f103c60fed79a1aac57da3323ad5e18ba4 (patch) | |
tree | 480f836a634d952b98a1285a5e17b505ca49b555 /sprintf.c | |
parent | 63b2b93950f9b0038927537578aff87aff4a1ece (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.c | 35 |
1 files changed, 16 insertions, 19 deletions
@@ -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; |