diff --git a/ChangeLog b/ChangeLog index 2fec8ddb72..e9821f1290 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Wed Jul 1 08:47:24 2015 NARUSE, Yui + + * struct.c (struct_member_pos): avoid implicit conversion loses + integer precision: 'long' to 'int'. + Wed Jul 1 05:57:03 2015 Eric Wong * vm_method.c (rb_add_method_iseq): add RB_GC_GUARD diff --git a/struct.c b/struct.c index b68f2a8a44..17c4643b72 100644 --- a/struct.c +++ b/struct.c @@ -131,7 +131,7 @@ struct_member_pos(VALUE s, VALUE name) { VALUE back = struct_ivar_get(rb_obj_class(s), id_back_members); VALUE const * p; - long j, mask; + int j, mask; if (UNLIKELY(NIL_P(back))) { rb_raise(rb_eTypeError, "uninitialized struct"); @@ -141,12 +141,12 @@ struct_member_pos(VALUE s, VALUE name) } p = RARRAY_CONST_PTR(back); - mask = RARRAY_LEN(back); + mask = RARRAY_LENINT(back); if (mask <= AREF_HASH_THRESHOLD) { if (UNLIKELY(RSTRUCT_LEN(s) != RARRAY_LEN(back))) { rb_raise(rb_eTypeError, - "struct size differs (%ld required %ld given)", + "struct size differs (%d required %ld given)", mask, RSTRUCT_LEN(s)); } for (j = 0; j < mask; j++) {