ext: adjust index type

* ext: use long for index instead of int and RARRAY_LENINT.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2015-11-04 07:18:01 +00:00
parent c8803b10d1
commit 52912db4a8
12 changed files with 32 additions and 28 deletions

View File

@ -3723,7 +3723,8 @@ static VALUE
rt_complete_frags(VALUE klass, VALUE hash) rt_complete_frags(VALUE klass, VALUE hash)
{ {
static VALUE tab = Qnil; static VALUE tab = Qnil;
int g, e; int g;
long e;
VALUE k, a, d; VALUE k, a, d;
if (NIL_P(tab)) { if (NIL_P(tab)) {
@ -3820,18 +3821,18 @@ rt_complete_frags(VALUE klass, VALUE hash)
} }
{ {
int i, eno = 0, idx = 0; long i, eno = 0, idx = 0;
for (i = 0; i < RARRAY_LENINT(tab); i++) { for (i = 0; i < RARRAY_LEN(tab); i++) {
VALUE x, a; VALUE x, a;
x = RARRAY_PTR(tab)[i]; x = RARRAY_PTR(tab)[i];
a = RARRAY_PTR(x)[1]; a = RARRAY_PTR(x)[1];
{ {
int j, n = 0; long j, n = 0;
for (j = 0; j < RARRAY_LENINT(a); j++) for (j = 0; j < RARRAY_LEN(a); j++)
if (!NIL_P(ref_hash0(RARRAY_PTR(a)[j]))) if (!NIL_P(ref_hash0(RARRAY_PTR(a)[j])))
n++; n++;
if (n > eno) { if (n > eno) {
@ -3852,7 +3853,7 @@ rt_complete_frags(VALUE klass, VALUE hash)
d = Qnil; d = Qnil;
if (g && !NIL_P(k) && (RARRAY_LENINT(a) - e)) { if (g && !NIL_P(k) && (RARRAY_LEN(a) - e)) {
if (k == sym("ordinal")) { if (k == sym("ordinal")) {
if (NIL_P(ref_hash("year"))) { if (NIL_P(ref_hash("year"))) {
if (NIL_P(d)) if (NIL_P(d))
@ -3863,9 +3864,9 @@ rt_complete_frags(VALUE klass, VALUE hash)
set_hash("yday", INT2FIX(1)); set_hash("yday", INT2FIX(1));
} }
else if (k == sym("civil")) { else if (k == sym("civil")) {
int i; long i;
for (i = 0; i < RARRAY_LENINT(a); i++) { for (i = 0; i < RARRAY_LEN(a); i++) {
VALUE e = RARRAY_PTR(a)[i]; VALUE e = RARRAY_PTR(a)[i];
if (!NIL_P(ref_hash0(e))) if (!NIL_P(ref_hash0(e)))
@ -3880,9 +3881,9 @@ rt_complete_frags(VALUE klass, VALUE hash)
set_hash("mday", INT2FIX(1)); set_hash("mday", INT2FIX(1));
} }
else if (k == sym("commercial")) { else if (k == sym("commercial")) {
int i; long i;
for (i = 0; i < RARRAY_LENINT(a); i++) { for (i = 0; i < RARRAY_LEN(a); i++) {
VALUE e = RARRAY_PTR(a)[i]; VALUE e = RARRAY_PTR(a)[i];
if (!NIL_P(ref_hash0(e))) if (!NIL_P(ref_hash0(e)))
@ -3904,9 +3905,9 @@ rt_complete_frags(VALUE klass, VALUE hash)
ref_hash("wday")))); ref_hash("wday"))));
} }
else if (k == sym("wnum0")) { else if (k == sym("wnum0")) {
int i; long i;
for (i = 0; i < RARRAY_LENINT(a); i++) { for (i = 0; i < RARRAY_LEN(a); i++) {
VALUE e = RARRAY_PTR(a)[i]; VALUE e = RARRAY_PTR(a)[i];
if (!NIL_P(ref_hash0(e))) if (!NIL_P(ref_hash0(e)))
@ -3921,9 +3922,9 @@ rt_complete_frags(VALUE klass, VALUE hash)
set_hash("wday", INT2FIX(0)); set_hash("wday", INT2FIX(0));
} }
else if (k == sym("wnum1")) { else if (k == sym("wnum1")) {
int i; long i;
for (i = 0; i < RARRAY_LENINT(a); i++) { for (i = 0; i < RARRAY_LEN(a); i++) {
VALUE e = RARRAY_PTR(a)[i]; VALUE e = RARRAY_PTR(a)[i];
if (!NIL_P(ref_hash0(e))) if (!NIL_P(ref_hash0(e)))

View File

@ -508,8 +508,8 @@ fdbm_delete_if(VALUE obj)
DBM *dbm; DBM *dbm;
VALUE keystr, valstr; VALUE keystr, valstr;
VALUE ret, ary = rb_ary_tmp_new(0); VALUE ret, ary = rb_ary_tmp_new(0);
int i, status = 0; int status = 0;
long n; long i, n;
fdbm_modify(obj); fdbm_modify(obj);
GetDBM2(obj, dbmp, dbm); GetDBM2(obj, dbmp, dbm);

View File

@ -90,7 +90,7 @@ initialize(int argc, VALUE argv[], VALUE self)
ffi_type **arg_types; ffi_type **arg_types;
ffi_status result; ffi_status result;
VALUE ptr, args, ret_type, abi, kwds; VALUE ptr, args, ret_type, abi, kwds;
int i; long i;
rb_scan_args(argc, argv, "31:", &ptr, &args, &ret_type, &abi, &kwds); rb_scan_args(argc, argv, "31:", &ptr, &args, &ret_type, &abi, &kwds);
if(NIL_P(abi)) abi = INT2NUM(FFI_DEFAULT_ABI); if(NIL_P(abi)) abi = INT2NUM(FFI_DEFAULT_ABI);

View File

@ -614,7 +614,8 @@ fgdbm_delete_if(VALUE obj)
GDBM_FILE dbm; GDBM_FILE dbm;
VALUE keystr, valstr; VALUE keystr, valstr;
VALUE ret, ary = rb_ary_tmp_new(0); VALUE ret, ary = rb_ary_tmp_new(0);
int i, status = 0, n; long i;
int status = 0, n;
rb_gdbm_modify(obj); rb_gdbm_modify(obj);
GetDBM2(obj, dbmp, dbm); GetDBM2(obj, dbmp, dbm);

View File

@ -671,9 +671,9 @@ ossl_ocspbres_add_status(VALUE self, VALUE cid, VALUE status,
OCSP_BASICRESP *bs; OCSP_BASICRESP *bs;
OCSP_SINGLERESP *single; OCSP_SINGLERESP *single;
OCSP_CERTID *id; OCSP_CERTID *id;
int st, rsn;
ASN1_TIME *ths, *nxt, *rev; ASN1_TIME *ths, *nxt, *rev;
int error, i, rstatus = 0; int st, rsn, error, rstatus = 0;
long i;
VALUE tmp; VALUE tmp;
st = NUM2INT(status); st = NUM2INT(status);

View File

@ -701,7 +701,8 @@ ossl_sslctx_setup(VALUE self)
X509_STORE *store; X509_STORE *store;
EVP_PKEY *key = NULL; EVP_PKEY *key = NULL;
char *ca_path = NULL, *ca_file = NULL; char *ca_path = NULL, *ca_file = NULL;
int i, verify_mode; int verify_mode;
long i;
VALUE val; VALUE val;
if(OBJ_FROZEN(self)) return Qnil; if(OBJ_FROZEN(self)) return Qnil;

View File

@ -663,7 +663,7 @@ ossl_x509_set_extensions(VALUE self, VALUE ary)
{ {
X509 *x509; X509 *x509;
X509_EXTENSION *ext; X509_EXTENSION *ext;
int i; long i;
Check_Type(ary, T_ARRAY); Check_Type(ary, T_ARRAY);
/* All ary's members should be X509Extension */ /* All ary's members should be X509Extension */

View File

@ -302,7 +302,7 @@ ossl_x509crl_set_revoked(VALUE self, VALUE ary)
{ {
X509_CRL *crl; X509_CRL *crl;
X509_REVOKED *rev; X509_REVOKED *rev;
int i; long i;
Check_Type(ary, T_ARRAY); Check_Type(ary, T_ARRAY);
/* All ary members should be X509 Revoked */ /* All ary members should be X509 Revoked */
@ -476,7 +476,7 @@ ossl_x509crl_set_extensions(VALUE self, VALUE ary)
{ {
X509_CRL *crl; X509_CRL *crl;
X509_EXTENSION *ext; X509_EXTENSION *ext;
int i; long i;
Check_Type(ary, T_ARRAY); Check_Type(ary, T_ARRAY);
/* All ary members should be X509 Extensions */ /* All ary members should be X509 Extensions */

View File

@ -418,7 +418,7 @@ ossl_x509req_set_attributes(VALUE self, VALUE ary)
{ {
X509_REQ *req; X509_REQ *req;
X509_ATTRIBUTE *attr; X509_ATTRIBUTE *attr;
int i; long i;
VALUE item; VALUE item;
Check_Type(ary, T_ARRAY); Check_Type(ary, T_ARRAY);

View File

@ -188,7 +188,7 @@ ossl_x509revoked_set_extensions(VALUE self, VALUE ary)
{ {
X509_REVOKED *rev; X509_REVOKED *rev;
X509_EXTENSION *ext; X509_EXTENSION *ext;
int i; long i;
VALUE item; VALUE item;
Check_Type(ary, T_ARRAY); Check_Type(ary, T_ARRAY);

View File

@ -159,7 +159,7 @@ static VALUE start_document(VALUE self, VALUE version, VALUE tags, VALUE imp)
} }
if(RTEST(tags)) { if(RTEST(tags)) {
int i = 0; long i = 0;
#ifdef HAVE_RUBY_ENCODING_H #ifdef HAVE_RUBY_ENCODING_H
rb_encoding * encoding = rb_utf8_encoding(); rb_encoding * encoding = rb_utf8_encoding();
#endif #endif

View File

@ -512,7 +512,8 @@ fsdbm_delete_if(VALUE obj)
DBM *dbm; DBM *dbm;
VALUE keystr, valstr; VALUE keystr, valstr;
VALUE ret, ary = rb_ary_new(); VALUE ret, ary = rb_ary_new();
int i, status = 0, n; long i;
int status = 0, n;
fdbm_modify(obj); fdbm_modify(obj);
GetDBM2(obj, dbmp, dbm); GetDBM2(obj, dbmp, dbm);