mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* struct.c (struct_member_pos): avoid implicit conversion loses
integer precision: 'long' to 'int'. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51080 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b49075cdf1
commit
f91a556340
2 changed files with 8 additions and 3 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Wed Jul 1 08:47:24 2015 NARUSE, Yui <naruse@ruby-lang.org>
|
||||||
|
|
||||||
|
* struct.c (struct_member_pos): avoid implicit conversion loses
|
||||||
|
integer precision: 'long' to 'int'.
|
||||||
|
|
||||||
Wed Jul 1 05:57:03 2015 Eric Wong <e@80x24.org>
|
Wed Jul 1 05:57:03 2015 Eric Wong <e@80x24.org>
|
||||||
|
|
||||||
* vm_method.c (rb_add_method_iseq): add RB_GC_GUARD
|
* vm_method.c (rb_add_method_iseq): add RB_GC_GUARD
|
||||||
|
|
6
struct.c
6
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 back = struct_ivar_get(rb_obj_class(s), id_back_members);
|
||||||
VALUE const * p;
|
VALUE const * p;
|
||||||
long j, mask;
|
int j, mask;
|
||||||
|
|
||||||
if (UNLIKELY(NIL_P(back))) {
|
if (UNLIKELY(NIL_P(back))) {
|
||||||
rb_raise(rb_eTypeError, "uninitialized struct");
|
rb_raise(rb_eTypeError, "uninitialized struct");
|
||||||
|
@ -141,12 +141,12 @@ struct_member_pos(VALUE s, VALUE name)
|
||||||
}
|
}
|
||||||
|
|
||||||
p = RARRAY_CONST_PTR(back);
|
p = RARRAY_CONST_PTR(back);
|
||||||
mask = RARRAY_LEN(back);
|
mask = RARRAY_LENINT(back);
|
||||||
|
|
||||||
if (mask <= AREF_HASH_THRESHOLD) {
|
if (mask <= AREF_HASH_THRESHOLD) {
|
||||||
if (UNLIKELY(RSTRUCT_LEN(s) != RARRAY_LEN(back))) {
|
if (UNLIKELY(RSTRUCT_LEN(s) != RARRAY_LEN(back))) {
|
||||||
rb_raise(rb_eTypeError,
|
rb_raise(rb_eTypeError,
|
||||||
"struct size differs (%ld required %ld given)",
|
"struct size differs (%d required %ld given)",
|
||||||
mask, RSTRUCT_LEN(s));
|
mask, RSTRUCT_LEN(s));
|
||||||
}
|
}
|
||||||
for (j = 0; j < mask; j++) {
|
for (j = 0; j < mask; j++) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue