* sprintf.c: fixed type.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25052 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
bb09904691
commit
eb5692ab32
15
sprintf.c
15
sprintf.c
@ -430,7 +430,7 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
|
|||||||
rb_encoding *enc;
|
rb_encoding *enc;
|
||||||
const char *p, *end;
|
const char *p, *end;
|
||||||
char *buf;
|
char *buf;
|
||||||
int blen, bsiz;
|
long blen, bsiz;
|
||||||
VALUE result;
|
VALUE result;
|
||||||
|
|
||||||
long scanned = 0;
|
long scanned = 0;
|
||||||
@ -691,7 +691,7 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
|
|||||||
}
|
}
|
||||||
/* need to adjust multi-byte string pos */
|
/* need to adjust multi-byte string pos */
|
||||||
if ((flags&FWIDTH) && (width > slen)) {
|
if ((flags&FWIDTH) && (width > slen)) {
|
||||||
width -= slen;
|
width -= (int)slen;
|
||||||
if (!(flags&FMINUS)) {
|
if (!(flags&FMINUS)) {
|
||||||
CHECK(width);
|
CHECK(width);
|
||||||
while (width--) {
|
while (width--) {
|
||||||
@ -775,7 +775,7 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
|
|||||||
bignum = 1;
|
bignum = 1;
|
||||||
break;
|
break;
|
||||||
case T_STRING:
|
case T_STRING:
|
||||||
val = rb_str_to_inum(val, 0, Qtrue);
|
val = rb_str_to_inum(val, 0, TRUE);
|
||||||
goto bin_retry;
|
goto bin_retry;
|
||||||
case T_BIGNUM:
|
case T_BIGNUM:
|
||||||
bignum = 1;
|
bignum = 1;
|
||||||
@ -851,6 +851,7 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
len = (int)strlen(s);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (sign) {
|
if (sign) {
|
||||||
@ -893,10 +894,10 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
len = rb_long2int(RSTRING_END(tmp) - s);
|
||||||
}
|
}
|
||||||
|
|
||||||
pos = -1;
|
pos = -1;
|
||||||
len = strlen(s);
|
|
||||||
if (dots) {
|
if (dots) {
|
||||||
prec -= 2;
|
prec -= 2;
|
||||||
width -= 2;
|
width -= 2;
|
||||||
@ -926,7 +927,7 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
|
|||||||
prefix = 0;
|
prefix = 0;
|
||||||
}
|
}
|
||||||
if (prefix) {
|
if (prefix) {
|
||||||
width -= strlen(prefix);
|
width -= (int)strlen(prefix);
|
||||||
}
|
}
|
||||||
if ((flags & (FZERO|FMINUS|FPREC)) == FZERO) {
|
if ((flags & (FZERO|FMINUS|FPREC)) == FZERO) {
|
||||||
prec = width;
|
prec = width;
|
||||||
@ -947,7 +948,7 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
|
|||||||
}
|
}
|
||||||
if (sc) PUSH(&sc, 1);
|
if (sc) PUSH(&sc, 1);
|
||||||
if (prefix) {
|
if (prefix) {
|
||||||
int plen = strlen(prefix);
|
int plen = (int)strlen(prefix);
|
||||||
PUSH(prefix, plen);
|
PUSH(prefix, plen);
|
||||||
}
|
}
|
||||||
CHECK(prec - len);
|
CHECK(prec - len);
|
||||||
@ -998,7 +999,7 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
|
|||||||
else {
|
else {
|
||||||
expr = "Inf";
|
expr = "Inf";
|
||||||
}
|
}
|
||||||
need = strlen(expr);
|
need = (int)strlen(expr);
|
||||||
if ((!isnan(fval) && fval < 0.0) || (flags & FPLUS))
|
if ((!isnan(fval) && fval < 0.0) || (flags & FPLUS))
|
||||||
need++;
|
need++;
|
||||||
if ((flags & FWIDTH) && need < width)
|
if ((flags & FWIDTH) && need < width)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user