ruby-changes:11261
From: nobu <ko1@a...>
Date: Tue, 10 Mar 2009 14:44:24 +0900 (JST)
Subject: [ruby-changes:11261] Ruby:r22872 (trunk): * array.c, bignum.c, gc.c, numeric.c, string.c, util.c, insns.def,
nobu 2009-03-10 14:43:14 +0900 (Tue, 10 Mar 2009) New Revision: 22872 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=22872 Log: * array.c, bignum.c, gc.c, numeric.c, string.c, util.c, insns.def, missing/crypt.c, missing/vsnprintf.c, : suppress warnings. Modified files: trunk/ChangeLog trunk/array.c trunk/bignum.c trunk/gc.c trunk/insns.def trunk/missing/crypt.c trunk/missing/vsnprintf.c trunk/numeric.c trunk/string.c trunk/util.c Index: array.c =================================================================== --- array.c (revision 22871) +++ array.c (revision 22872) @@ -3383,7 +3383,7 @@ rb_ary_modify(ary); while (i) { - long j = rb_genrand_real()*i; + long j = (long)(rb_genrand_real()*i); VALUE tmp = RARRAY_PTR(ary)[--i]; RARRAY_PTR(ary)[i] = RARRAY_PTR(ary)[j]; RARRAY_PTR(ary)[j] = tmp; @@ -3432,7 +3432,7 @@ len = RARRAY_LEN(ary); if (argc == 0) { if (len == 0) return Qnil; - i = len == 1 ? 0 : rb_genrand_real()*len; + i = len == 1 ? 0 : (long)(rb_genrand_real()*len); return RARRAY_PTR(ary)[i]; } rb_scan_args(argc, argv, "1", &nv); @@ -3445,14 +3445,14 @@ case 1: return rb_ary_new4(1, &ptr[(long)(rb_genrand_real()*len)]); case 2: - i = rb_genrand_real()*len; - j = rb_genrand_real()*(len-1); + i = (long)(rb_genrand_real()*len); + j = (long)(rb_genrand_real()*(len-1)); if (j >= i) j++; return rb_ary_new3(2, ptr[i], ptr[j]); case 3: - i = rb_genrand_real()*len; - j = rb_genrand_real()*(len-1); - k = rb_genrand_real()*(len-2); + i = (long)(rb_genrand_real()*len); + j = (long)(rb_genrand_real()*(len-1)); + k = (long)(rb_genrand_real()*(len-2)); { long l = j, g = i; if (j >= i) l = i, g = ++j; @@ -3462,9 +3462,9 @@ } if (n < sizeof(idx)/sizeof(idx[0])) { long sorted[sizeof(idx)/sizeof(idx[0])]; - sorted[0] = idx[0] = rb_genrand_real()*len; + sorted[0] = idx[0] = (long)(rb_genrand_real()*len); for (i=1; i<n; i++) { - k = rb_genrand_real()*--len; + k = (long)(rb_genrand_real()*--len); for (j = 0; j < i; ++j) { if (k < sorted[j]) break; ++k; Index: insns.def =================================================================== --- insns.def (revision 22871) +++ insns.def (revision 22872) @@ -977,7 +977,7 @@ send (ID op_id, rb_num_t op_argc, ISEQ blockiseq, rb_num_t op_flag, IC ic) (...) -(VALUE val) // inc += - (op_argc + ((op_flag & VM_CALL_ARGS_BLOCKARG_BIT) ? 1 : 0)); +(VALUE val) // inc += - (int)(op_argc + ((op_flag & VM_CALL_ARGS_BLOCKARG_BIT) ? 1 : 0)); { NODE *mn; VALUE recv, klass; @@ -1011,7 +1011,7 @@ invokesuper (rb_num_t op_argc, ISEQ blockiseq, rb_num_t op_flag) (...) -(VALUE val) // inc += - (op_argc + ((op_flag & VM_CALL_ARGS_BLOCKARG_BIT) ? 1 : 0)); +(VALUE val) // inc += - (int)(op_argc + ((op_flag & VM_CALL_ARGS_BLOCKARG_BIT) ? 1 : 0)); { rb_block_t *blockptr = !(op_flag & VM_CALL_ARGS_BLOCKARG_BIT) ? GET_BLOCK_PTR() : 0; int num = caller_setup_args(th, GET_CFP(), op_flag, op_argc, blockiseq, &blockptr); Index: ChangeLog =================================================================== --- ChangeLog (revision 22871) +++ ChangeLog (revision 22872) @@ -1,3 +1,8 @@ +Tue Mar 10 14:43:16 2009 Nobuyoshi Nakada <nobu@r...> + + * array.c, bignum.c, gc.c, numeric.c, string.c, util.c, insns.def, + missing/crypt.c, missing/vsnprintf.c, : suppress warnings. + Tue Mar 10 13:45:54 2009 Nobuyoshi Nakada <nobu@r...> * win32/Makefile.sub (LDFLAGS): moved -link to TRY_LINK, LINK_SO Index: string.c =================================================================== --- string.c (revision 22871) +++ string.c (revision 22872) @@ -4872,7 +4872,7 @@ } } else { - int clen, tlen, max = RSTRING_LEN(str) * 1.2; + int clen, tlen, max = (int)(RSTRING_LEN(str) * 1.2); int offset; char *buf = ALLOC_N(char, max), *t = buf; Index: gc.c =================================================================== --- gc.c (revision 22871) +++ gc.c (revision 22872) @@ -937,7 +937,7 @@ static void set_heaps_increment(rb_objspace_t *objspace) { - size_t next_heaps_length = heaps_used * 1.8; + size_t next_heaps_length = (size_t)(heaps_used * 1.8); heaps_inc = next_heaps_length - heaps_used; if (next_heaps_length > heaps_length) { @@ -1712,8 +1712,8 @@ size_t i; size_t live = 0, free_min = 0, do_heap_free = 0; - do_heap_free = (heaps_used * HEAP_OBJ_LIMIT) * 0.65; - free_min = (heaps_used * HEAP_OBJ_LIMIT) * 0.2; + do_heap_free = (size_t)((heaps_used * HEAP_OBJ_LIMIT) * 0.65); + free_min = (size_t)((heaps_used * HEAP_OBJ_LIMIT) * 0.2); if (free_min < FREE_MIN) { do_heap_free = heaps_used * HEAP_OBJ_LIMIT; @@ -1776,7 +1776,7 @@ } GC_PROF_SET_MALLOC_INFO; if (malloc_increase > malloc_limit) { - malloc_limit += (malloc_increase - malloc_limit) * (double)live / (live + freed); + malloc_limit += (size_t)((malloc_increase - malloc_limit) * (double)live / (live + freed)); if (malloc_limit < GC_MALLOC_LIMIT) malloc_limit = GC_MALLOC_LIMIT; } malloc_increase = 0; Index: util.c =================================================================== --- util.c (revision 22871) +++ util.c (revision 22872) @@ -162,7 +162,7 @@ } if (sign < 0) { - ret = -ret; + ret = (unsigned long)(-(long)ret); return ret; } else { @@ -2821,7 +2821,7 @@ #ifdef Avoid_Underflow if (scale && y <= 2*P*Exp_msk1) { if (aadj <= 0x7fffffff) { - if ((z = aadj) <= 0) + if ((z = (int)aadj) <= 0) z = 1; aadj = z; dval(aadj1) = dsign ? aadj : -aadj; @@ -3428,7 +3428,7 @@ */ dval(eps) = 0.5/tens[ilim-1] - dval(eps); for (i = 0;;) { - L = dval(d); + L = (int)dval(d); dval(d) -= L; *s++ = '0' + (int)L; if (dval(d) < dval(eps)) Index: numeric.c =================================================================== --- numeric.c (revision 22871) +++ numeric.c (revision 22872) @@ -1272,7 +1272,7 @@ if (!FIXABLE(f)) { return rb_dbl2big(f); } - val = f; + val = (long)f; return LONG2FIX(val); } @@ -1298,7 +1298,7 @@ if (!FIXABLE(f)) { return rb_dbl2big(f); } - val = f; + val = (long)f; return LONG2FIX(val); } @@ -1347,7 +1347,7 @@ if (!FIXABLE(number)) { return rb_dbl2big(number); } - val = number; + val = (long)number; return LONG2FIX(val); } @@ -1372,7 +1372,7 @@ if (!FIXABLE(f)) { return rb_dbl2big(f); } - val = f; + val = (long)f; return LONG2FIX(val); } Index: bignum.c =================================================================== --- bignum.c (revision 22871) +++ bignum.c (revision 22872) @@ -1025,7 +1025,7 @@ { VALUE num = big2ulong(x, "unsigned long", Qfalse); if (!RBIGNUM_SIGN(x)) { - return -num; + return (VALUE)(-(SIGNED_VALUE)num); } return num; } @@ -1039,7 +1039,7 @@ if ((SIGNED_VALUE)num < 0) { rb_raise(rb_eRangeError, "bignum out of range of unsigned long"); } - return -num; + return (VALUE)(-(SIGNED_VALUE)num); } return num; } @@ -1082,7 +1082,8 @@ { unsigned LONG_LONG num = big2ull(x, "unsigned long long"); - if (!RBIGNUM_SIGN(x)) return -num; + if (!RBIGNUM_SIGN(x)) + return (VALUE)(-(SIGNED_VALUE)num); return num; } Index: missing/crypt.c =================================================================== --- missing/crypt.c (revision 22871) +++ missing/crypt.c (revision 22872) @@ -680,13 +680,13 @@ if (num_iter >= 0) { /* encryption */ kp = &KS[0]; - ks_inc = sizeof(*kp); + ks_inc = (int)sizeof(*kp); } else { /* decryption */ num_iter = -num_iter; kp = &KS[KS_SIZE-1]; - ks_inc = -sizeof(*kp); + ks_inc = -(int)sizeof(*kp); } while (--num_iter >= 0) { Index: missing/vsnprintf.c =================================================================== --- missing/vsnprintf.c (revision 22871) +++ missing/vsnprintf.c (revision 22872) @@ -750,7 +750,7 @@ { ulval = SARG(); if ((long)ulval < 0) { - ulval = -ulval; + ulval = (u_long)(-(long)ulval); sign = '-'; } } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/