ruby-changes:38999
From: naruse <ko1@a...>
Date: Wed, 1 Jul 2015 08:48:36 +0900 (JST)
Subject: [ruby-changes:38999] naruse:r51080 (trunk): * struct.c (struct_member_pos): avoid implicit conversion loses
naruse 2015-07-01 08:48:21 +0900 (Wed, 01 Jul 2015) New Revision: 51080 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=51080 Log: * struct.c (struct_member_pos): avoid implicit conversion loses integer precision: 'long' to 'int'. Modified files: trunk/ChangeLog trunk/struct.c Index: ChangeLog =================================================================== --- ChangeLog (revision 51079) +++ ChangeLog (revision 51080) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Wed Jul 1 08:47:24 2015 NARUSE, Yui <naruse@r...> + + * struct.c (struct_member_pos): avoid implicit conversion loses + integer precision: 'long' to 'int'. + Wed Jul 1 05:57:03 2015 Eric Wong <e@8...> * vm_method.c (rb_add_method_iseq): add RB_GC_GUARD Index: struct.c =================================================================== --- struct.c (revision 51079) +++ struct.c (revision 51080) @@ -131,7 +131,7 @@ struct_member_pos(VALUE s, VALUE name) https://github.com/ruby/ruby/blob/trunk/struct.c#L131 { 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) https://github.com/ruby/ruby/blob/trunk/struct.c#L141 } 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++) { -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/