[前][次][番号順一覧][スレッド一覧]

ruby-changes:13289

From: nobu <ko1@a...>
Date: Wed, 23 Sep 2009 13:17:46 +0900 (JST)
Subject: [ruby-changes:13289] Ruby:r25052 (trunk): * sprintf.c: fixed type.

nobu	2009-09-23 13:17:16 +0900 (Wed, 23 Sep 2009)

  New Revision: 25052

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=25052

  Log:
    * sprintf.c: fixed type.

  Modified files:
    trunk/sprintf.c

Index: sprintf.c
===================================================================
--- sprintf.c	(revision 25051)
+++ sprintf.c	(revision 25052)
@@ -430,7 +430,7 @@
     rb_encoding *enc;
     const char *p, *end;
     char *buf;
-    int blen, bsiz;
+    long blen, bsiz;
     VALUE result;
 
     long scanned = 0;
@@ -691,7 +691,7 @@
 		    }
 		    /* need to adjust multi-byte string pos */
 		    if ((flags&FWIDTH) && (width > slen)) {
-			width -= slen;
+			width -= (int)slen;
 			if (!(flags&FMINUS)) {
 			    CHECK(width);
 			    while (width--) {
@@ -775,7 +775,7 @@
 		    bignum = 1;
 		    break;
 		  case T_STRING:
-		    val = rb_str_to_inum(val, 0, Qtrue);
+		    val = rb_str_to_inum(val, 0, TRUE);
 		    goto bin_retry;
 		  case T_BIGNUM:
 		    bignum = 1;
@@ -851,6 +851,7 @@
 			    }
 			}
 		    }
+		    len = (int)strlen(s);
 		}
 		else {
 		    if (sign) {
@@ -893,10 +894,10 @@
 			    }
 			}
 		    }
+		    len = rb_long2int(RSTRING_END(tmp) - s);
 		}
 
 		pos = -1;
-		len = strlen(s);
 		if (dots) {
 		    prec -= 2;
 		    width -= 2;
@@ -926,7 +927,7 @@
 		    prefix = 0;
 		}
 		if (prefix) {
-		    width -= strlen(prefix);
+		    width -= (int)strlen(prefix);
 		}
 		if ((flags & (FZERO|FMINUS|FPREC)) == FZERO) {
 		    prec = width;
@@ -947,7 +948,7 @@
 		}
 		if (sc) PUSH(&sc, 1);
 		if (prefix) {
-		    int plen = strlen(prefix);
+		    int plen = (int)strlen(prefix);
 		    PUSH(prefix, plen);
 		}
 		CHECK(prec - len);
@@ -998,7 +999,7 @@
 		    else {
 			expr = "Inf";
 		    }
-		    need = strlen(expr);
+		    need = (int)strlen(expr);
 		    if ((!isnan(fval) && fval < 0.0) || (flags & FPLUS))
 			need++;
 		    if ((flags & FWIDTH) && need < width)

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]