зеркало из https://github.com/github/ruby.git
Explicitly cast to uint32_t and suppress warnings by VC
``` ../src/variable.c(1440): warning C4244: 'initializing': conversion from 'double' to 'uint32_t', possible loss of data 242 ../src/variable.c(1470): warning C4244: 'initializing': conversion from 'double' to 'uint32_t', possible loss of data 243 ``` TODO: check for `newsize` overflow
This commit is contained in:
Родитель
7fcad1fa03
Коммит
1e3fa634f7
|
@ -1434,10 +1434,11 @@ rb_ensure_generic_iv_list_size(VALUE obj, uint32_t newsize)
|
|||
return ivtbl;
|
||||
}
|
||||
|
||||
// @note May raise when there are too many instance variables.
|
||||
void
|
||||
rb_init_iv_list(VALUE obj)
|
||||
{
|
||||
uint32_t newsize = rb_shape_get_shape(obj)->iv_count * 2.0;
|
||||
uint32_t newsize = (uint32_t)(rb_shape_get_shape(obj)->iv_count * 2.0);
|
||||
uint32_t len = ROBJECT_NUMIV(obj);
|
||||
rb_ensure_iv_list_size(obj, len, newsize < len ? len : newsize);
|
||||
}
|
||||
|
@ -1467,7 +1468,7 @@ rb_obj_ensure_iv_index_mapping(VALUE obj, ID id)
|
|||
|
||||
uint32_t len = ROBJECT_NUMIV(obj);
|
||||
if (len <= index) {
|
||||
uint32_t newsize = (shape->iv_count + 1) * 1.25;
|
||||
uint32_t newsize = (uint32_t)((shape->iv_count + 1) * 1.25);
|
||||
rb_ensure_iv_list_size(obj, len, newsize);
|
||||
}
|
||||
RUBY_ASSERT(index <= ROBJECT_NUMIV(obj));
|
||||
|
|
Загрузка…
Ссылка в новой задаче