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

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)
{
static VALUE tab = Qnil;
int g, e;
int g;
long e;
VALUE k, a, d;
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;
x = RARRAY_PTR(tab)[i];
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])))
n++;
if (n > eno) {
@ -3852,7 +3853,7 @@ rt_complete_frags(VALUE klass, VALUE hash)
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 (NIL_P(ref_hash("year"))) {
if (NIL_P(d))
@ -3863,9 +3864,9 @@ rt_complete_frags(VALUE klass, VALUE hash)
set_hash("yday", INT2FIX(1));
}
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];
if (!NIL_P(ref_hash0(e)))
@ -3880,9 +3881,9 @@ rt_complete_frags(VALUE klass, VALUE hash)
set_hash("mday", INT2FIX(1));
}
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];
if (!NIL_P(ref_hash0(e)))
@ -3904,9 +3905,9 @@ rt_complete_frags(VALUE klass, VALUE hash)
ref_hash("wday"))));
}
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];
if (!NIL_P(ref_hash0(e)))
@ -3921,9 +3922,9 @@ rt_complete_frags(VALUE klass, VALUE hash)
set_hash("wday", INT2FIX(0));
}
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];
if (!NIL_P(ref_hash0(e)))

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -663,7 +663,7 @@ ossl_x509_set_extensions(VALUE self, VALUE ary)
{
X509 *x509;
X509_EXTENSION *ext;
int i;
long i;
Check_Type(ary, T_ARRAY);
/* 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_REVOKED *rev;
int i;
long i;
Check_Type(ary, T_ARRAY);
/* All ary members should be X509 Revoked */
@ -476,7 +476,7 @@ ossl_x509crl_set_extensions(VALUE self, VALUE ary)
{
X509_CRL *crl;
X509_EXTENSION *ext;
int i;
long i;
Check_Type(ary, T_ARRAY);
/* 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_ATTRIBUTE *attr;
int i;
long i;
VALUE item;
Check_Type(ary, T_ARRAY);

View file

@ -188,7 +188,7 @@ ossl_x509revoked_set_extensions(VALUE self, VALUE ary)
{
X509_REVOKED *rev;
X509_EXTENSION *ext;
int i;
long i;
VALUE item;
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)) {
int i = 0;
long i = 0;
#ifdef HAVE_RUBY_ENCODING_H
rb_encoding * encoding = rb_utf8_encoding();
#endif

View file

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