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

variable.c: fix implicit conversion

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54701 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2016-04-22 10:04:47 +00:00
parent 3738fe3333
commit bc65dbcdeb

View file

@ -1079,11 +1079,12 @@ gen_ivtbl_dup(const struct gen_ivtbl *orig)
static uint32_t
iv_index_tbl_newsize(struct ivar_update *ivup)
{
uint32_t newsize = (ivup->index+1) + (ivup->index+1)/4; /* (index+1)*1.25 */
uint32_t index = (uint32_t)ivup->index; /* should not overflow */
uint32_t newsize = (index+1) + (index+1)/4; /* (index+1)*1.25 */
if (!ivup->iv_extended &&
ivup->u.iv_index_tbl->num_entries < (st_index_t)newsize) {
newsize = ivup->u.iv_index_tbl->num_entries;
newsize = (uint32_t)ivup->u.iv_index_tbl->num_entries;
}
return newsize;
}
@ -1381,7 +1382,7 @@ rb_ivar_set(VALUE obj, ID id, VALUE val)
}
else {
VALUE *newptr;
long newsize = iv_index_tbl_newsize(&ivup);
uint32_t newsize = iv_index_tbl_newsize(&ivup);
if (RBASIC(obj)->flags & ROBJECT_EMBED) {
newptr = ALLOC_N(VALUE, newsize);