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:
parent
3738fe3333
commit
bc65dbcdeb
@ -1079,11 +1079,12 @@ gen_ivtbl_dup(const struct gen_ivtbl *orig)
|
|||||||
static uint32_t
|
static uint32_t
|
||||||
iv_index_tbl_newsize(struct ivar_update *ivup)
|
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 &&
|
if (!ivup->iv_extended &&
|
||||||
ivup->u.iv_index_tbl->num_entries < (st_index_t)newsize) {
|
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;
|
return newsize;
|
||||||
}
|
}
|
||||||
@ -1381,7 +1382,7 @@ rb_ivar_set(VALUE obj, ID id, VALUE val)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
VALUE *newptr;
|
VALUE *newptr;
|
||||||
long newsize = iv_index_tbl_newsize(&ivup);
|
uint32_t newsize = iv_index_tbl_newsize(&ivup);
|
||||||
|
|
||||||
if (RBASIC(obj)->flags & ROBJECT_EMBED) {
|
if (RBASIC(obj)->flags & ROBJECT_EMBED) {
|
||||||
newptr = ALLOC_N(VALUE, newsize);
|
newptr = ALLOC_N(VALUE, newsize);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user