зеркало из https://github.com/github/ruby.git
* sprintf.c (rb_str_format): fix for left justify flag.
* sprintf.c (rb_str_format): zero-precision zero bug revised. [ruby-dev:33419] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15281 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
fc208c1bd5
Коммит
b980803a6e
|
@ -1,3 +1,10 @@
|
|||
Sun Jan 27 23:33:35 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* sprintf.c (rb_str_format): fix for left justify flag.
|
||||
|
||||
* sprintf.c (rb_str_format): zero-precision zero bug revised.
|
||||
[ruby-dev:33419]
|
||||
|
||||
Sun Jan 27 23:20:54 2008 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* include/ruby/oniguruma.h: precise mbclen API redesigned to avoid
|
||||
|
|
|
@ -699,12 +699,15 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
|
|||
if (prefix) {
|
||||
width -= strlen(prefix);
|
||||
}
|
||||
if ((flags&(FZERO|FPREC)) == FZERO) {
|
||||
if ((flags & (FZERO|FMINUS|FPREC)) == FZERO) {
|
||||
prec = width;
|
||||
width = 0;
|
||||
}
|
||||
else {
|
||||
if (prec < len) prec = len;
|
||||
if (prec < len) {
|
||||
if ((flags & FPREC) && len == 1 && *s == '0') len = 0;
|
||||
else prec = len;
|
||||
}
|
||||
width -= prec;
|
||||
}
|
||||
if (!(flags&FMINUS)) {
|
||||
|
@ -726,7 +729,7 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
|
|||
buf[blen++] = c;
|
||||
}
|
||||
}
|
||||
else {
|
||||
else if ((flags & (FMINUS|FPREC)) != FMINUS) {
|
||||
char c;
|
||||
|
||||
if (!sign && bignum && !RBIGNUM_SIGN(val))
|
||||
|
|
Загрузка…
Ссылка в новой задаче