From: nobu.nokada@... Date: 2002-08-23T08:47:10+09:00 Subject: Re: [Cleanup] Int vs Long #3 Hi, At Fri, 23 Aug 2002 01:16:15 +0900, Michal Rokos wrote: > Index: file.c > =================================================================== > RCS file: /src/ruby/file.c,v > retrieving revision 1.105 > diff -u -r1.105 file.c > --- file.c 2002/08/21 15:47:54 1.105 > +++ file.c 2002/08/22 16:07:28 > @@ -79,7 +79,7 @@ > VALUE rb_mFileTest; > static VALUE rb_cStat; > > -static int > +static long > apply2files(func, vargs, arg) > void (*func)(); > VALUE vargs; > Index: io.c > =================================================================== > RCS file: /src/ruby/io.c,v > retrieving revision 1.148 > diff -u -r1.148 io.c > --- io.c 2002/08/21 15:47:54 1.148 > +++ io.c 2002/08/22 16:07:41 > @@ -555,7 +555,7 @@ > > while (n > 0) { > #ifdef READ_DATA_PENDING_COUNT > - int i = READ_DATA_PENDING_COUNT(f); > + long i = READ_DATA_PENDING_COUNT(f); > if (i <= 0) { > rb_thread_wait_fd(fileno(f)); > i = READ_DATA_PENDING_COUNT(f); Although I doubt if they can exceed INT limit, well, no problem. > Index: numeric.c > =================================================================== > RCS file: /src/ruby/numeric.c,v > retrieving revision 1.56 > diff -u -r1.56 numeric.c > --- numeric.c 2002/08/21 15:47:54 1.56 > +++ numeric.c 2002/08/22 16:07:44 > @@ -1022,7 +1022,7 @@ > { > if (FIXNUM_P(num)) { > long i = FIX2LONG(num) + 1; > - return rb_int2inum(i); > + return LONG2FIX(i); > } > return rb_funcall(num, '+', 1, INT2FIX(1)); > } This arithmetic operation may overflow. You might intended LONG2NUM() here too? # I'd like you to use -p option. -- Nobu Nakada