1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Int vs Long cleanup #3 (ruby-core:352)

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2754 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
michal 2002-08-28 08:05:23 +00:00
parent 3685a85b3d
commit 0d0ae37e50
13 changed files with 95 additions and 97 deletions

View file

@ -35,10 +35,10 @@ int ruby_nerrs;
static void static void
err_snprintf(buf, len, fmt, args) err_snprintf(buf, len, fmt, args)
char *buf, *fmt; char *buf, *fmt;
int len; long len;
va_list args; va_list args;
{ {
int n; long n;
ruby_set_current_source(); ruby_set_current_source();
if (!ruby_sourcefile) { if (!ruby_sourcefile) {

6
eval.c
View file

@ -1006,7 +1006,7 @@ error_print()
} }
else { else {
char *tail = 0; char *tail = 0;
int len = elen; long len = elen;
if (RSTRING(epath)->ptr[0] == '#') epath = 0; if (RSTRING(epath)->ptr[0] == '#') epath = 0;
if (tail = strchr(einfo, '\n')) { if (tail = strchr(einfo, '\n')) {
@ -3518,12 +3518,12 @@ rb_mod_method_defined(mod, mid)
return Qfalse; return Qfalse;
} }
NORETURN(static void terminate_process _((int, const char*, int))); NORETURN(static void terminate_process _((int, const char*, long)));
static void static void
terminate_process(status, mesg, mlen) terminate_process(status, mesg, mlen)
int status; int status;
const char *mesg; const char *mesg;
int mlen; long mlen;
{ {
VALUE exit = rb_exc_new(rb_eSystemExit, mesg, mlen); VALUE exit = rb_exc_new(rb_eSystemExit, mesg, mlen);

38
file.c
View file

@ -79,7 +79,7 @@ VALUE rb_cFile;
VALUE rb_mFileTest; VALUE rb_mFileTest;
static VALUE rb_cStat; static VALUE rb_cStat;
static int static long
apply2files(func, vargs, arg) apply2files(func, vargs, arg)
void (*func)(); void (*func)();
VALUE vargs; VALUE vargs;
@ -844,7 +844,7 @@ rb_file_s_size(klass, fname)
if (rb_stat(fname, &st) < 0) if (rb_stat(fname, &st) < 0)
rb_sys_fail(RSTRING(fname)->ptr); rb_sys_fail(RSTRING(fname)->ptr);
return rb_int2inum(st.st_size); return OFFT2NUM(st.st_size);
} }
static VALUE static VALUE
@ -994,14 +994,15 @@ rb_file_s_chmod(argc, argv)
{ {
VALUE vmode; VALUE vmode;
VALUE rest; VALUE rest;
int mode, n; int mode;
long n;
rb_secure(2); rb_secure(2);
rb_scan_args(argc, argv, "1*", &vmode, &rest); rb_scan_args(argc, argv, "1*", &vmode, &rest);
mode = NUM2INT(vmode); mode = NUM2INT(vmode);
n = apply2files(chmod_internal, rest, mode); n = apply2files(chmod_internal, rest, mode);
return INT2FIX(n); return LONG2FIX(n);
} }
static VALUE static VALUE
@ -1044,14 +1045,15 @@ rb_file_s_lchmod(argc, argv)
{ {
VALUE vmode; VALUE vmode;
VALUE rest; VALUE rest;
int mode, n; int mode;
long n;
rb_secure(2); rb_secure(2);
rb_scan_args(argc, argv, "1*", &vmode, &rest); rb_scan_args(argc, argv, "1*", &vmode, &rest);
mode = NUM2INT(vmode); mode = NUM2INT(vmode);
n = apply2files(lchmod_internal, rest, mode); n = apply2files(lchmod_internal, rest, mode);
return INT2FIX(n); return LONG2FIX(n);
} }
#else #else
static VALUE static VALUE
@ -1083,7 +1085,7 @@ rb_file_s_chown(argc, argv)
{ {
VALUE o, g, rest; VALUE o, g, rest;
struct chown_args arg; struct chown_args arg;
int n; long n;
rb_secure(2); rb_secure(2);
rb_scan_args(argc, argv, "2*", &o, &g, &rest); rb_scan_args(argc, argv, "2*", &o, &g, &rest);
@ -1101,7 +1103,7 @@ rb_file_s_chown(argc, argv)
} }
n = apply2files(chown_internal, rest, &arg); n = apply2files(chown_internal, rest, &arg);
return INT2FIX(n); return LONG2FIX(n);
} }
static VALUE static VALUE
@ -1141,7 +1143,7 @@ rb_file_s_lchown(argc, argv)
{ {
VALUE o, g, rest; VALUE o, g, rest;
struct chown_args arg; struct chown_args arg;
int n; long n;
rb_secure(2); rb_secure(2);
rb_scan_args(argc, argv, "2*", &o, &g, &rest); rb_scan_args(argc, argv, "2*", &o, &g, &rest);
@ -1159,7 +1161,7 @@ rb_file_s_lchown(argc, argv)
} }
n = apply2files(lchown_internal, rest, &arg); n = apply2files(lchown_internal, rest, &arg);
return INT2FIX(n); return LONG2FIX(n);
} }
#else #else
static VALUE static VALUE
@ -1191,7 +1193,7 @@ rb_file_s_utime(argc, argv)
{ {
VALUE atime, mtime, rest; VALUE atime, mtime, rest;
struct timeval tvp[2]; struct timeval tvp[2];
int n; long n;
rb_scan_args(argc, argv, "2*", &atime, &mtime, &rest); rb_scan_args(argc, argv, "2*", &atime, &mtime, &rest);
@ -1199,7 +1201,7 @@ rb_file_s_utime(argc, argv)
tvp[1] = rb_time_timeval(mtime); tvp[1] = rb_time_timeval(mtime);
n = apply2files(utime_internal, rest, tvp); n = apply2files(utime_internal, rest, tvp);
return INT2FIX(n); return LONG2FIX(n);
} }
#else #else
@ -1237,7 +1239,7 @@ rb_file_s_utime(argc, argv)
VALUE *argv; VALUE *argv;
{ {
VALUE atime, mtime, rest; VALUE atime, mtime, rest;
int n; long n;
struct timeval tv; struct timeval tv;
struct utimbuf utbuf; struct utimbuf utbuf;
@ -1249,7 +1251,7 @@ rb_file_s_utime(argc, argv)
utbuf.modtime = tv.tv_sec; utbuf.modtime = tv.tv_sec;
n = apply2files(utime_internal, rest, &utbuf); n = apply2files(utime_internal, rest, &utbuf);
return INT2FIX(n); return LONG2FIX(n);
} }
#endif #endif
@ -1322,11 +1324,11 @@ static VALUE
rb_file_s_unlink(klass, args) rb_file_s_unlink(klass, args)
VALUE klass, args; VALUE klass, args;
{ {
int n; long n;
rb_secure(2); rb_secure(2);
n = apply2files(unlink_internal, args, 0); n = apply2files(unlink_internal, args, 0);
return INT2FIX(n); return LONG2FIX(n);
} }
static VALUE static VALUE
@ -2266,10 +2268,10 @@ static VALUE
rb_stat_s(obj) rb_stat_s(obj)
VALUE obj; VALUE obj;
{ {
int size = get_stat(obj)->st_size; off_t size = get_stat(obj)->st_size;
if (size == 0) return Qnil; if (size == 0) return Qnil;
return INT2FIX(size); return OFFT2NUM(size);
} }
static VALUE static VALUE

4
gc.c
View file

@ -777,7 +777,7 @@ rb_gc_mark_children(ptr)
case T_ARRAY: case T_ARRAY:
{ {
int i, len = obj->as.array.len; long i, len = obj->as.array.len;
VALUE *ptr = obj->as.array.ptr; VALUE *ptr = obj->as.array.ptr;
for (i=0; i < len; i++) for (i=0; i < len; i++)
@ -839,7 +839,7 @@ rb_gc_mark_children(ptr)
case T_STRUCT: case T_STRUCT:
{ {
int i, len = obj->as.rstruct.len; long i, len = obj->as.rstruct.len;
VALUE *ptr = obj->as.rstruct.ptr; VALUE *ptr = obj->as.rstruct.ptr;
for (i=0; i < len; i++) for (i=0; i < len; i++)

7
io.c
View file

@ -555,7 +555,7 @@ rb_io_fread(ptr, len, f)
while (n > 0) { while (n > 0) {
#ifdef READ_DATA_PENDING_COUNT #ifdef READ_DATA_PENDING_COUNT
int i = READ_DATA_PENDING_COUNT(f); long i = READ_DATA_PENDING_COUNT(f);
if (i <= 0) { if (i <= 0) {
rb_thread_wait_fd(fileno(f)); rb_thread_wait_fd(fileno(f));
i = READ_DATA_PENDING_COUNT(f); i = READ_DATA_PENDING_COUNT(f);
@ -599,7 +599,6 @@ rb_io_fread(ptr, len, f)
*ptr++ = c; *ptr++ = c;
n--; n--;
} }
return len - n; return len - n;
} }
@ -724,7 +723,7 @@ appendline(fptr, delim, strp)
do { do {
#ifdef READ_DATA_PENDING_PTR #ifdef READ_DATA_PENDING_PTR
int pending = READ_DATA_PENDING_COUNT(f); long pending = READ_DATA_PENDING_COUNT(f);
if (pending > 0) { if (pending > 0) {
const char *p = READ_DATA_PENDING_PTR(f); const char *p = READ_DATA_PENDING_PTR(f);
const char *e = memchr(p, delim, pending); const char *e = memchr(p, delim, pending);
@ -798,7 +797,7 @@ swallow(fptr, term)
do { do {
#ifdef READ_DATA_PENDING_PTR #ifdef READ_DATA_PENDING_PTR
int cnt; long cnt;
while ((cnt = READ_DATA_PENDING_COUNT(f)) > 0) { while ((cnt = READ_DATA_PENDING_COUNT(f)) > 0) {
char buf[1024]; char buf[1024];
const char *p = READ_DATA_PENDING_PTR(f); const char *p = READ_DATA_PENDING_PTR(f);

View file

@ -1022,7 +1022,7 @@ int_succ(num)
{ {
if (FIXNUM_P(num)) { if (FIXNUM_P(num)) {
long i = FIX2LONG(num) + 1; long i = FIX2LONG(num) + 1;
return rb_int2inum(i); return LONG2NUM(i);
} }
return rb_funcall(num, '+', 1, INT2FIX(1)); return rb_funcall(num, '+', 1, INT2FIX(1));
} }
@ -1083,7 +1083,7 @@ static VALUE
fix_uminus(num) fix_uminus(num)
VALUE num; VALUE num;
{ {
return rb_int2inum(-FIX2LONG(num)); return LONG2NUM(-FIX2LONG(num));
} }
VALUE VALUE
@ -1385,7 +1385,7 @@ fix_rev(num)
long val = FIX2LONG(num); long val = FIX2LONG(num);
val = ~val; val = ~val;
return rb_int2inum(val); return LONG2NUM(val);
} }
static VALUE static VALUE
@ -1398,7 +1398,7 @@ fix_and(x, y)
return rb_big_and(y, x); return rb_big_and(y, x);
} }
val = FIX2LONG(x) & NUM2LONG(y); val = FIX2LONG(x) & NUM2LONG(y);
return rb_int2inum(val); return LONG2NUM(val);
} }
static VALUE static VALUE
@ -1411,7 +1411,7 @@ fix_or(x, y)
return rb_big_or(y, x); return rb_big_or(y, x);
} }
val = FIX2LONG(x) | NUM2LONG(y); val = FIX2LONG(x) | NUM2LONG(y);
return rb_int2inum(val); return LONG2NUM(val);
} }
static VALUE static VALUE
@ -1424,7 +1424,7 @@ fix_xor(x, y)
return rb_big_xor(y, x); return rb_big_xor(y, x);
} }
val = FIX2LONG(x) ^ NUM2LONG(y); val = FIX2LONG(x) ^ NUM2LONG(y);
return rb_int2inum(val); return LONG2NUM(val);
} }
static VALUE fix_rshift _((VALUE, VALUE)); static VALUE fix_rshift _((VALUE, VALUE));
@ -1444,7 +1444,7 @@ fix_lshift(x, y)
return rb_big_lshift(rb_int2big(val), y); return rb_big_lshift(rb_int2big(val), y);
} }
val = val << width; val = val << width;
return rb_int2inum(val); return LONG2NUM(val);
} }
static VALUE static VALUE
@ -1512,7 +1512,7 @@ fix_abs(fix)
if (i < 0) i = -i; if (i < 0) i = -i;
return rb_int2inum(i); return LONG2NUM(i);
} }
static VALUE static VALUE

68
pack.c
View file

@ -323,11 +323,11 @@ typedef unsigned int U32;
#endif #endif
static char *toofew = "too few arguments"; static char *toofew = "too few arguments";
static void encodes _((VALUE,char*,int,int)); static void encodes _((VALUE,char*,long,int));
static void qpencode _((VALUE,VALUE,int)); static void qpencode _((VALUE,VALUE,long));
static int uv_to_utf8 _((char*,unsigned long)); static int uv_to_utf8 _((char*,unsigned long));
static unsigned long utf8_to_uv _((char*,int*)); static unsigned long utf8_to_uv _((char*,long*));
static VALUE static VALUE
pack_pack(ary, fmt) pack_pack(ary, fmt)
@ -431,7 +431,7 @@ pack_pack(ary, fmt)
case 'b': case 'b':
{ {
int byte = 0; int byte = 0;
int i, j = 0; long i, j = 0;
if (len > plen) { if (len > plen) {
j = (len - plen + 1)/2; j = (len - plen + 1)/2;
@ -461,7 +461,7 @@ pack_pack(ary, fmt)
case 'B': case 'B':
{ {
int byte = 0; int byte = 0;
int i, j = 0; long i, j = 0;
if (len > plen) { if (len > plen) {
j = (len - plen + 1)/2; j = (len - plen + 1)/2;
@ -490,7 +490,7 @@ pack_pack(ary, fmt)
case 'h': case 'h':
{ {
int byte = 0; int byte = 0;
int i, j = 0; long i, j = 0;
if (len > plen) { if (len > plen) {
j = (len - plen + 1)/2; j = (len - plen + 1)/2;
@ -520,7 +520,7 @@ pack_pack(ary, fmt)
case 'H': case 'H':
{ {
int byte = 0; int byte = 0;
int i, j = 0; long i, j = 0;
if (len > plen) { if (len > plen) {
j = (len - plen + 1)/2; j = (len - plen + 1)/2;
@ -800,7 +800,7 @@ pack_pack(ary, fmt)
else else
len = len / 3 * 3; len = len / 3 * 3;
while (plen > 0) { while (plen > 0) {
int todo; long todo;
if (plen > len) if (plen > len)
todo = len; todo = len;
@ -915,11 +915,11 @@ static void
encodes(str, s, len, type) encodes(str, s, len, type)
VALUE str; VALUE str;
char *s; char *s;
int len; long len;
int type; int type;
{ {
char *buff = ALLOCA_N(char, len * 4 / 3 + 6); char *buff = ALLOCA_N(char, len * 4 / 3 + 6);
int i = 0; long i = 0;
char *trans = type == 'u' ? uu_table : b64_table; char *trans = type == 'u' ? uu_table : b64_table;
int padding; int padding;
@ -959,10 +959,10 @@ static char hex_table[] = "0123456789ABCDEF";
static void static void
qpencode(str, from, len) qpencode(str, from, len)
VALUE str, from; VALUE str, from;
int len; long len;
{ {
char buff[1024]; char buff[1024];
int i = 0, n = 0, prev = EOF; long i = 0, n = 0, prev = EOF;
unsigned char *s = (unsigned char*)RSTRING(from)->ptr; unsigned char *s = (unsigned char*)RSTRING(from)->ptr;
unsigned char *send = s + RSTRING(from)->len; unsigned char *send = s + RSTRING(from)->len;
@ -1136,7 +1136,7 @@ pack_unpack(str, fmt)
case 'A': case 'A':
if (len > send - s) len = send - s; if (len > send - s) len = send - s;
{ {
int end = len; long end = len;
char *t = s + len - 1; char *t = s + len - 1;
while (t >= s) { while (t >= s) {
@ -1151,7 +1151,7 @@ pack_unpack(str, fmt)
case 'Z': case 'Z':
if (len > send - s) len = send - s; if (len > send - s) len = send - s;
{ {
int end = len; long end = len;
char *t = s + len - 1; char *t = s + len - 1;
while (t >= s) { while (t >= s) {
@ -1174,7 +1174,8 @@ pack_unpack(str, fmt)
{ {
VALUE bitstr; VALUE bitstr;
char *t; char *t;
int bits, i; int bits;
long i;
if (p[-1] == '*' || len > (send - s) * 8) if (p[-1] == '*' || len > (send - s) * 8)
len = (send - s) * 8; len = (send - s) * 8;
@ -1193,7 +1194,8 @@ pack_unpack(str, fmt)
{ {
VALUE bitstr; VALUE bitstr;
char *t; char *t;
int bits, i; int bits;
long i;
if (p[-1] == '*' || len > (send - s) * 8) if (p[-1] == '*' || len > (send - s) * 8)
len = (send - s) * 8; len = (send - s) * 8;
@ -1212,7 +1214,8 @@ pack_unpack(str, fmt)
{ {
VALUE bitstr; VALUE bitstr;
char *t; char *t;
int bits, i; int bits;
long i;
if (p[-1] == '*' || len > (send - s) * 2) if (p[-1] == '*' || len > (send - s) * 2)
len = (send - s) * 2; len = (send - s) * 2;
@ -1233,7 +1236,8 @@ pack_unpack(str, fmt)
{ {
VALUE bitstr; VALUE bitstr;
char *t; char *t;
int bits, i; int bits;
long i;
if (p[-1] == '*' || len > (send - s) * 2) if (p[-1] == '*' || len > (send - s) * 2)
len = (send - s) * 2; len = (send - s) * 2;
@ -1297,7 +1301,7 @@ pack_unpack(str, fmt)
int tmp; int tmp;
memcpy(&tmp, s, sizeof(int)); memcpy(&tmp, s, sizeof(int));
s += sizeof(int); s += sizeof(int);
rb_ary_push(ary, rb_int2inum(tmp)); rb_ary_push(ary, INT2NUM(tmp));
} }
PACK_ITEM_ADJUST(); PACK_ITEM_ADJUST();
break; break;
@ -1308,7 +1312,7 @@ pack_unpack(str, fmt)
unsigned int tmp; unsigned int tmp;
memcpy(&tmp, s, sizeof(unsigned int)); memcpy(&tmp, s, sizeof(unsigned int));
s += sizeof(unsigned int); s += sizeof(unsigned int);
rb_ary_push(ary, rb_uint2inum(tmp)); rb_ary_push(ary, UINT2NUM(tmp));
} }
PACK_ITEM_ADJUST(); PACK_ITEM_ADJUST();
break; break;
@ -1319,7 +1323,7 @@ pack_unpack(str, fmt)
long tmp = 0; long tmp = 0;
memcpy(OFF32(&tmp), s, NATINT_LEN(long,4)); memcpy(OFF32(&tmp), s, NATINT_LEN(long,4));
s += NATINT_LEN(long,4); s += NATINT_LEN(long,4);
rb_ary_push(ary, rb_int2inum(tmp)); rb_ary_push(ary, LONG2NUM(tmp));
} }
PACK_ITEM_ADJUST(); PACK_ITEM_ADJUST();
break; break;
@ -1330,7 +1334,7 @@ pack_unpack(str, fmt)
unsigned long tmp = 0; unsigned long tmp = 0;
memcpy(OFF32(&tmp), s, NATINT_LEN(unsigned long,4)); memcpy(OFF32(&tmp), s, NATINT_LEN(unsigned long,4));
s += NATINT_LEN(unsigned long,4); s += NATINT_LEN(unsigned long,4);
rb_ary_push(ary, rb_uint2inum(tmp)); rb_ary_push(ary, ULONG2NUM(tmp));
} }
PACK_ITEM_ADJUST(); PACK_ITEM_ADJUST();
break; break;
@ -1359,7 +1363,7 @@ pack_unpack(str, fmt)
unsigned short tmp = 0; unsigned short tmp = 0;
memcpy(OFF16B(&tmp), s, NATINT_LEN(unsigned short,2)); memcpy(OFF16B(&tmp), s, NATINT_LEN(unsigned short,2));
s += NATINT_LEN(unsigned short,2); s += NATINT_LEN(unsigned short,2);
rb_ary_push(ary, rb_uint2inum(ntohs(tmp))); rb_ary_push(ary, UINT2NUM(ntohs(tmp)));
} }
PACK_ITEM_ADJUST(); PACK_ITEM_ADJUST();
break; break;
@ -1370,7 +1374,7 @@ pack_unpack(str, fmt)
unsigned long tmp = 0; unsigned long tmp = 0;
memcpy(OFF32B(&tmp), s, NATINT_LEN(unsigned long,4)); memcpy(OFF32B(&tmp), s, NATINT_LEN(unsigned long,4));
s += NATINT_LEN(unsigned long,4); s += NATINT_LEN(unsigned long,4);
rb_ary_push(ary, rb_uint2inum(ntohl(tmp))); rb_ary_push(ary, ULONG2NUM(ntohl(tmp)));
} }
PACK_ITEM_ADJUST(); PACK_ITEM_ADJUST();
break; break;
@ -1381,7 +1385,7 @@ pack_unpack(str, fmt)
unsigned short tmp = 0; unsigned short tmp = 0;
memcpy(OFF16(&tmp), s, NATINT_LEN(unsigned short,2)); memcpy(OFF16(&tmp), s, NATINT_LEN(unsigned short,2));
s += NATINT_LEN(unsigned short,2); s += NATINT_LEN(unsigned short,2);
rb_ary_push(ary, rb_uint2inum(vtohs(tmp))); rb_ary_push(ary, UINT2NUM(vtohs(tmp)));
} }
PACK_ITEM_ADJUST(); PACK_ITEM_ADJUST();
break; break;
@ -1392,7 +1396,7 @@ pack_unpack(str, fmt)
unsigned long tmp = 0; unsigned long tmp = 0;
memcpy(OFF32(&tmp), s, NATINT_LEN(long,4)); memcpy(OFF32(&tmp), s, NATINT_LEN(long,4));
s += NATINT_LEN(long,4); s += NATINT_LEN(long,4);
rb_ary_push(ary, rb_uint2inum(vtohl(tmp))); rb_ary_push(ary, ULONG2NUM(vtohl(tmp)));
} }
PACK_ITEM_ADJUST(); PACK_ITEM_ADJUST();
break; break;
@ -1480,12 +1484,12 @@ pack_unpack(str, fmt)
case 'U': case 'U':
if (len > send - s) len = send - s; if (len > send - s) len = send - s;
while (len > 0 && s < send) { while (len > 0 && s < send) {
int alen = send - s; long alen = send - s;
unsigned long l; unsigned long l;
l = utf8_to_uv(s, &alen); l = utf8_to_uv(s, &alen);
s += alen; len--; s += alen; len--;
rb_ary_push(ary, rb_uint2inum(l)); rb_ary_push(ary, ULONG2NUM(l));
} }
break; break;
@ -1508,7 +1512,7 @@ pack_unpack(str, fmt)
} }
while (len > 0) { while (len > 0) {
int mlen = len > 3 ? 3 : len; long mlen = len > 3 ? 3 : len;
if (s < send && *s >= ' ') if (s < send && *s >= ' ')
a = (*s++ - ' ') & 077; a = (*s++ - ' ') & 077;
@ -1718,7 +1722,7 @@ pack_unpack(str, fmt)
ul <<= 7; ul <<= 7;
ul |= (*s & 0x7f); ul |= (*s & 0x7f);
if (!(*s++ & 0x80)) { if (!(*s++ & 0x80)) {
rb_ary_push(ary, rb_uint2inum(ul)); rb_ary_push(ary, ULONG2NUM(ul));
len--; len--;
ul = 0; ul = 0;
} }
@ -1814,11 +1818,11 @@ uv_to_utf8(buf, uv)
static unsigned long static unsigned long
utf8_to_uv(p, lenp) utf8_to_uv(p, lenp)
char *p; char *p;
int *lenp; long *lenp;
{ {
int c = (*p++)&0xff; int c = (*p++)&0xff;
unsigned long uv; unsigned long uv;
int n = 1; long n = 1;
if (c < 0xc0) n = 1; if (c < 0xc0) n = 1;
else if (c < 0xe0) n = 2; else if (c < 0xe0) n = 2;

View file

@ -831,8 +831,7 @@ rb_f_system(argc, argv)
if (status == 0) return Qtrue; if (status == 0) return Qtrue;
return Qfalse; return Qfalse;
#else #elif defined(DJGPP)
#ifdef DJGPP
VALUE cmd; VALUE cmd;
int status; int status;
@ -855,10 +854,8 @@ rb_f_system(argc, argv)
if (status == 0) return Qtrue; if (status == 0) return Qtrue;
return Qfalse; return Qfalse;
#else #elif defined(__human68k__)
#if defined(__human68k__)
VALUE prog = 0; VALUE prog = 0;
int i;
int status; int status;
fflush(stdin); fflush(stdin);
@ -885,8 +882,7 @@ rb_f_system(argc, argv)
} }
last_status_set(status == -1 ? 127 : status); last_status_set(status == -1 ? 127 : status);
return status == 0 ? Qtrue : Qfalse; return status == 0 ? Qtrue : Qfalse;
#else #elif defined(__VMS)
#if defined(__VMS)
VALUE cmd; VALUE cmd;
int status; int status;
@ -962,10 +958,7 @@ rb_f_system(argc, argv)
if (NUM2INT(rb_last_status) == 0) if (NUM2INT(rb_last_status) == 0)
return Qtrue; return Qtrue;
return Qfalse; return Qfalse;
#endif /* __VMS */ #endif
#endif /* __human68k__ */
#endif /* DJGPP */
#endif /* NT */
} }
static VALUE static VALUE

10
re.c
View file

@ -782,7 +782,7 @@ rb_reg_nth_match(nth, match)
VALUE match; VALUE match;
{ {
VALUE str; VALUE str;
int start, end, len; long start, end, len;
if (NIL_P(match)) return Qnil; if (NIL_P(match)) return Qnil;
if (nth >= RMATCH(match)->regs->num_regs) { if (nth >= RMATCH(match)->regs->num_regs) {
@ -1094,7 +1094,7 @@ VALUE
rb_reg_match(re, str) rb_reg_match(re, str)
VALUE re, str; VALUE re, str;
{ {
int start; long start;
if (NIL_P(str)) { if (NIL_P(str)) {
rb_backref_set(Qnil); rb_backref_set(Qnil);
@ -1105,14 +1105,14 @@ rb_reg_match(re, str)
if (start < 0) { if (start < 0) {
return Qnil; return Qnil;
} }
return INT2FIX(start); return LONG2FIX(start);
} }
VALUE VALUE
rb_reg_match2(re) rb_reg_match2(re)
VALUE re; VALUE re;
{ {
int start; long start;
VALUE line = rb_lastline_get(); VALUE line = rb_lastline_get();
if (TYPE(line) != T_STRING) { if (TYPE(line) != T_STRING) {
@ -1124,7 +1124,7 @@ rb_reg_match2(re)
if (start < 0) { if (start < 0) {
return Qnil; return Qnil;
} }
return INT2FIX(start); return LONG2FIX(start);
} }
static VALUE static VALUE

View file

@ -26,7 +26,7 @@ remove_sign_bits(str, base)
int base; int base;
{ {
char *s, *t, *end; char *s, *t, *end;
int len; unsigned long len;
s = t = str; s = t = str;
len = strlen(str); len = strlen(str);

View file

@ -1016,7 +1016,7 @@ rb_str_succ(orig)
VALUE str; VALUE str;
char *sbeg, *s; char *sbeg, *s;
int c = -1; int c = -1;
int n = 0; long n = 0;
str = rb_str_new5(orig,RSTRING(orig)->ptr, RSTRING(orig)->len); str = rb_str_new5(orig,RSTRING(orig)->ptr, RSTRING(orig)->len);
OBJ_INFECT(str, orig); OBJ_INFECT(str, orig);
@ -1216,7 +1216,7 @@ rb_str_subpat_set(str, re, nth, val)
VALUE val; VALUE val;
{ {
VALUE match; VALUE match;
int start, end, len; long start, end, len;
if (rb_reg_search(re, str, 0, 0) < 0) { if (rb_reg_search(re, str, 0, 0) < 0) {
rb_raise(rb_eIndexError, "regexp not matched"); rb_raise(rb_eIndexError, "regexp not matched");
@ -2999,7 +2999,7 @@ rb_str_sum(argc, argv, str)
VALUE str; VALUE str;
{ {
VALUE vbits; VALUE vbits;
int bits; int bits;
char *p, *pend; char *p, *pend;
if (rb_scan_args(argc, argv, "01", &vbits) == 0) { if (rb_scan_args(argc, argv, "01", &vbits) == 0) {

4
time.c
View file

@ -1193,7 +1193,7 @@ time_utc_offset(time)
#else #else
struct tm *u, *l; struct tm *u, *l;
time_t t; time_t t;
int off; long off;
l = &tobj->tm; l = &tobj->tm;
t = tobj->tv.tv_sec; t = tobj->tv.tv_sec;
u = gmtime(&t); u = gmtime(&t);
@ -1210,7 +1210,7 @@ time_utc_offset(time)
off = off * 24 + l->tm_hour - u->tm_hour; off = off * 24 + l->tm_hour - u->tm_hour;
off = off * 60 + l->tm_min - u->tm_min; off = off * 60 + l->tm_min - u->tm_min;
off = off * 60 + l->tm_sec - u->tm_sec; off = off * 60 + l->tm_sec - u->tm_sec;
return INT2FIX(off); return LONG2FIX(off);
#endif #endif
} }
} }

12
util.c
View file

@ -27,9 +27,9 @@ char *strchr _((char*,char));
unsigned long unsigned long
scan_oct(start, len, retlen) scan_oct(start, len, retlen)
const char *start; const char *start;
int len; int len;
int *retlen; int *retlen;
{ {
register const char *s = start; register const char *s = start;
register unsigned long retval = 0; register unsigned long retval = 0;
@ -44,9 +44,9 @@ int *retlen;
unsigned long unsigned long
scan_hex(start, len, retlen) scan_hex(start, len, retlen)
const char *start; const char *start;
int len; int len;
int *retlen; int *retlen;
{ {
static char hexdigit[] = "0123456789abcdef0123456789ABCDEF"; static char hexdigit[] = "0123456789abcdef0123456789ABCDEF";
register const char *s = start; register const char *s = start;