Skip to content

Commit 22dcc88

Browse files
committed
* ext/tk/tkutil/tkutil.c: fix shorten-64-to-32 warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33798 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent be276c1 commit 22dcc88

File tree

1 file changed

+23
-17
lines changed

1 file changed

+23
-17
lines changed

ext/tk/tkutil/tkutil.c

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include "ruby.h"
1313

1414
#ifdef RUBY_VM
15-
static VALUE rb_thread_critical; /* dummy */
15+
static int rb_thread_critical; /* dummy */
1616
#else
1717
/* On Ruby 1.8.x, use rb_thread_critical (defined at rubysig.h) */
1818
#include "rubysig.h"
@@ -202,8 +202,8 @@ tk_uninstall_cmd(self, cmd_id)
202202
VALUE self;
203203
VALUE cmd_id;
204204
{
205-
int head_len = strlen(cmd_id_head);
206-
int prefix_len = strlen(cmd_id_prefix);
205+
size_t head_len = strlen(cmd_id_head);
206+
size_t prefix_len = strlen(cmd_id_prefix);
207207

208208
StringValue(cmd_id);
209209
if (strncmp(cmd_id_head, RSTRING_PTR(cmd_id), head_len) != 0) {
@@ -298,7 +298,8 @@ ary2list(ary, enc_flag, self)
298298
VALUE enc_flag;
299299
VALUE self;
300300
{
301-
int idx, idx2, size, size2, req_chk_flag;
301+
long idx, idx2, size, size2;
302+
int req_chk_flag;
302303
volatile VALUE val, val2, str_val;
303304
volatile VALUE dst;
304305
volatile VALUE sys_enc, dst_enc, str_enc;
@@ -451,7 +452,8 @@ ary2list2(ary, enc_flag, self)
451452
VALUE enc_flag;
452453
VALUE self;
453454
{
454-
int idx, size, req_chk_flag;
455+
long idx, size;
456+
int req_chk_flag;
455457
volatile VALUE val, str_val;
456458
volatile VALUE dst;
457459
volatile VALUE sys_enc, dst_enc, str_enc;
@@ -551,7 +553,7 @@ assoc2kv(assoc, ary, self)
551553
VALUE ary;
552554
VALUE self;
553555
{
554-
int i, j, len;
556+
long i, j, len;
555557
volatile VALUE pair;
556558
volatile VALUE val;
557559
volatile VALUE dst = rb_ary_new2(2 * RARRAY_LEN(assoc));
@@ -599,7 +601,7 @@ assoc2kv_enc(assoc, ary, self)
599601
VALUE ary;
600602
VALUE self;
601603
{
602-
int i, j, len;
604+
long i, j, len;
603605
volatile VALUE pair;
604606
volatile VALUE val;
605607
volatile VALUE dst = rb_ary_new2(2 * RARRAY_LEN(assoc));
@@ -1079,7 +1081,7 @@ tkstr_to_str(value)
10791081
VALUE value;
10801082
{
10811083
char * ptr;
1082-
int len;
1084+
long len;
10831085

10841086
ptr = RSTRING_PTR(value);
10851087
len = RSTRING_LEN(value);
@@ -1134,7 +1136,7 @@ tcl2rb_num_or_nil(self, value)
11341136
#define CBSUBST_TBL_MAX (256)
11351137
struct cbsubst_info {
11361138
int full_subst_length;
1137-
int keylen[CBSUBST_TBL_MAX];
1139+
long keylen[CBSUBST_TBL_MAX];
11381140
char *key[CBSUBST_TBL_MAX];
11391141
char type[CBSUBST_TBL_MAX];
11401142
ID ivar[CBSUBST_TBL_MAX];
@@ -1300,7 +1302,8 @@ cbsubst_sym_to_subst(self, sym)
13001302
struct cbsubst_info *inf;
13011303
const char *str;
13021304
char *buf, *ptr;
1303-
int idx, len;
1305+
int idx;
1306+
long len;
13041307
ID id;
13051308
volatile VALUE ret;
13061309

@@ -1354,7 +1357,8 @@ cbsubst_get_subst_arg(argc, argv, self)
13541357
struct cbsubst_info *inf;
13551358
const char *str;
13561359
char *buf, *ptr;
1357-
int i, idx, len;
1360+
int i, idx;
1361+
long len;
13581362
ID id;
13591363
volatile VALUE arg_sym, ret;
13601364

@@ -1422,7 +1426,8 @@ cbsubst_get_subst_key(self, str)
14221426
volatile VALUE list;
14231427
volatile VALUE ret;
14241428
VALUE keyval;
1425-
int i, len, keylen, idx;
1429+
long i, len, keylen;
1430+
int idx;
14261431
char *buf, *ptr, *key;
14271432

14281433
list = rb_funcall(cTclTkLib, ID_split_tklist, 1, str);
@@ -1473,7 +1478,8 @@ cbsubst_get_all_subst_keys(self)
14731478
struct cbsubst_info *inf;
14741479
char *buf, *ptr;
14751480
char *keys_buf, *keys_ptr;
1476-
int idx, len;
1481+
int idx;
1482+
long len;
14771483
volatile VALUE ret;
14781484

14791485
Data_Get_Struct(rb_const_get(self, ID_SUBST_INFO),
@@ -1525,7 +1531,7 @@ cbsubst_table_setup(argc, argv, self)
15251531
VALUE inf;
15261532
ID id;
15271533
struct cbsubst_info *subst_inf;
1528-
int idx, len;
1534+
long idx, len;
15291535
unsigned char chr;
15301536

15311537
/* accept (key_inf, proc_inf) or (key_inf, longkey_inf, procinf) */
@@ -1646,10 +1652,10 @@ cbsubst_scan_args(self, arg_key, val_ary)
16461652
VALUE val_ary;
16471653
{
16481654
struct cbsubst_info *inf;
1649-
int idx;
1655+
long idx;
16501656
unsigned char *keyptr = (unsigned char*)RSTRING_PTR(arg_key);
1651-
int keylen = RSTRING_LEN(arg_key);
1652-
int vallen = RARRAY_LEN(val_ary);
1657+
long keylen = RSTRING_LEN(arg_key);
1658+
long vallen = RARRAY_LEN(val_ary);
16531659
unsigned char type_chr;
16541660
volatile VALUE dst = rb_ary_new2(vallen);
16551661
volatile VALUE proc;

0 commit comments

Comments
 (0)