diff --git a/array.c b/array.c index ee69729e3b..90acbce6e2 100644 --- a/array.c +++ b/array.c @@ -292,7 +292,7 @@ rb_ary_store(ary, idx, val) if (idx < 0) { idx += RARRAY(ary)->len; if (idx < 0) { - rb_raise(rb_eIndexError, "index %d out of array", + rb_raise(rb_eIndexError, "index %ld out of array", idx - RARRAY(ary)->len); } } @@ -563,7 +563,7 @@ rb_ary_fetch(argc, argv, ary) return rb_yield(pos); } if (argc == 1) { - rb_raise(rb_eIndexError, "index %d out of array", idx); + rb_raise(rb_eIndexError, "index %ld out of array", idx); } return ifnone; } @@ -642,12 +642,12 @@ rb_ary_update(ary, beg, len, rpl) rpl = rb_ary_to_ary(rpl); rlen = RARRAY(rpl)->len; - if (len < 0) rb_raise(rb_eIndexError, "negative length (%d)", len); + if (len < 0) rb_raise(rb_eIndexError, "negative length (%ld)", len); if (beg < 0) { beg += RARRAY(ary)->len; if (beg < 0) { beg -= RARRAY(ary)->len; - rb_raise(rb_eIndexError, "index %d out of array", beg); + rb_raise(rb_eIndexError, "index %ld out of array", beg); } } if (beg + len > RARRAY(ary)->len) { diff --git a/class.c b/class.c index 1ead9b0027..962a9abefc 100644 --- a/class.c +++ b/class.c @@ -694,7 +694,7 @@ rb_singleton_class(obj) SPECIAL_SINGLETON(Qnil, rb_cNilClass); SPECIAL_SINGLETON(Qfalse, rb_cFalseClass); SPECIAL_SINGLETON(Qtrue, rb_cTrueClass); - rb_bug("unknown immediate %d", obj); + rb_bug("unknown immediate %ld", obj); } DEFER_INTS; diff --git a/eval.c b/eval.c index 6e91a68734..3f793f18c5 100644 --- a/eval.c +++ b/eval.c @@ -3778,13 +3778,13 @@ rb_yield_0(val, self, klass, pcall) if ((state = EXEC_TAG()) == 0) { if (block->var == (NODE*)1) { if (pcall && RARRAY(val)->len != 0) { - rb_raise(rb_eArgError, "wrong number of arguments (%d for 0)", + rb_raise(rb_eArgError, "wrong number of arguments (%ld for 0)", RARRAY(val)->len); } } else if (block->var == (NODE*)2) { if (TYPE(val) == T_ARRAY && RARRAY(val)->len != 0) { - rb_raise(rb_eArgError, "wrong number of arguments (%d for 0)", + rb_raise(rb_eArgError, "wrong number of arguments (%ld for 0)", RARRAY(val)->len); } } @@ -3906,7 +3906,7 @@ massign(self, node, val, pcall) int pcall; { NODE *list; - int i = 0, len; + long i = 0, len; if (!pcall) { val = svalue_to_mvalue(val); @@ -3945,7 +3945,7 @@ massign(self, node, val, pcall) i++; list = list->nd_next; } - rb_raise(rb_eArgError, "wrong number of arguments (%d for %d)", len, i); + rb_raise(rb_eArgError, "wrong number of arguments (%ld for %ld)", len, i); } static void diff --git a/numeric.c b/numeric.c index 2cdb2640ad..2b9d6f5767 100644 --- a/numeric.c +++ b/numeric.c @@ -891,7 +891,7 @@ rb_num2int(val) long num = rb_num2long(val); if (num < INT_MIN || INT_MAX < num) { - rb_raise(rb_eRangeError, "integer %d too big to convert to `int'", num); + rb_raise(rb_eRangeError, "integer %ld too big to convert to `int'", num); } return (int)num; } @@ -903,7 +903,7 @@ rb_fix2int(val) long num = FIXNUM_P(val)?FIX2LONG(val):rb_num2long(val); if (num < INT_MIN || INT_MAX < num) { - rb_raise(rb_eRangeError, "integer %d too big to convert to `int'", num); + rb_raise(rb_eRangeError, "integer %ld too big to convert to `int'", num); } return (int)num; } @@ -933,7 +933,7 @@ rb_num2fix(val) v = rb_num2long(val); if (!FIXABLE(v)) - rb_raise(rb_eRangeError, "integer %d out of range of fixnum", v); + rb_raise(rb_eRangeError, "integer %ld out of range of fixnum", v); return INT2FIX(v); } @@ -1027,7 +1027,7 @@ int_chr(num) long i = NUM2LONG(num); if (i < 0 || 0xff < i) - rb_raise(rb_eRangeError, "%d out of char range", i); + rb_raise(rb_eRangeError, "%ld out of char range", i); c = i; return rb_str_new(&c, 1); } diff --git a/pack.c b/pack.c index 60b44d4ba8..f43b74822d 100644 --- a/pack.c +++ b/pack.c @@ -338,7 +338,7 @@ pack_pack(ary, fmt) char *p, *pend; VALUE res, from, associates = 0; char type; - int items, len, idx; + long items, len, idx; char *ptr; int plen; #ifdef NATINT_PACK @@ -825,7 +825,7 @@ pack_pack(ary, fmt) if (!NIL_P(from)) { StringValue(from); if (RSTRING(from)->len < len) { - rb_raise(rb_eArgError, "too short buffer for P(%d for %d)", + rb_raise(rb_eArgError, "too short buffer for P(%ld for %ld)", RSTRING(from)->len, len); } } diff --git a/parse.y b/parse.y index 64a70d7de4..52d0f2a139 100644 --- a/parse.y +++ b/parse.y @@ -4947,7 +4947,7 @@ arg_prepend(node1, node2) return node2; default: - rb_bug("unknown nodetype(%d) for arg_prepend"); + rb_bug("unknown nodetype(%d) for arg_prepend", nodetype(node2)); } return 0; /* not reached */ } diff --git a/range.c b/range.c index a9abb245f6..248c11b562 100644 --- a/range.c +++ b/range.c @@ -401,7 +401,7 @@ rb_range_beg_len(range, begp, lenp, len, err) out_of_range: if (err) { - rb_raise(rb_eRangeError, "%d..%s%d out of range", + rb_raise(rb_eRangeError, "%ld..%s%ld out of range", b, EXCL(range)? "." : "", e); } return Qnil; diff --git a/string.c b/string.c index 399f04c859..fd587503b6 100644 --- a/string.c +++ b/string.c @@ -1198,10 +1198,10 @@ rb_str_update(str, beg, len, val) long len; VALUE val; { - if (len < 0) rb_raise(rb_eIndexError, "negative length %d", len); + if (len < 0) rb_raise(rb_eIndexError, "negative length %ld", len); if (RSTRING(str)->len < beg) { out_of_range: - rb_raise(rb_eIndexError, "index %d out of string", beg); + rb_raise(rb_eIndexError, "index %ld out of string", beg); } if (beg < 0) { if (-beg > RSTRING(str)->len) { @@ -1282,7 +1282,7 @@ rb_str_aset(str, indx, val) idx = NUM2INT(indx); if (RSTRING(str)->len <= idx) { out_of_range: - rb_raise(rb_eIndexError, "index %d out of string", idx); + rb_raise(rb_eIndexError, "index %ld out of string", idx); } if (idx < 0) { if (-idx > RSTRING(str)->len) diff --git a/util.c b/util.c index e37d0adcbc..98d161935f 100644 --- a/util.c +++ b/util.c @@ -169,7 +169,7 @@ ruby_add_suffix(str, suffix) char buf[1024]; if (RSTRING(str)->len > 1000) - rb_fatal("Cannot do inplace edit on long filename (%d characters)", + rb_fatal("Cannot do inplace edit on long filename (%ld characters)", RSTRING(str)->len); #if defined(DJGPP) || defined(__CYGWIN32__) || defined(NT)