Fix implicit 'double' conversion reported by Clang 12.0.0 (#4288)
JerryScript-DCO-1.0-Signed-off-by: Adam Kallai kadam@inf.u-szeged.hu
This commit is contained in:
@@ -561,7 +561,7 @@ ecma_new_ecma_string_from_length (ecma_length_t number) /**< property length */
|
||||
}
|
||||
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
JERRY_ASSERT (number <= ECMA_NUMBER_MAX_SAFE_INTEGER);
|
||||
JERRY_ASSERT ((ecma_number_t) number <= ECMA_NUMBER_MAX_SAFE_INTEGER);
|
||||
|
||||
if (JERRY_UNLIKELY (number > UINT32_MAX))
|
||||
{
|
||||
@@ -2968,7 +2968,7 @@ ecma_op_advance_string_index (ecma_string_t *str_p, /**< input string */
|
||||
bool is_unicode) /**< true - if regexp object's "unicode" flag is set
|
||||
false - otherwise */
|
||||
{
|
||||
JERRY_ASSERT (index <= ECMA_NUMBER_MAX_SAFE_INTEGER);
|
||||
JERRY_ASSERT ((ecma_number_t) index <= ECMA_NUMBER_MAX_SAFE_INTEGER);
|
||||
ecma_length_t next_index = index + 1;
|
||||
|
||||
if (!is_unicode)
|
||||
|
||||
@@ -474,7 +474,7 @@ ecma_builtin_array_prototype_object_push (const ecma_value_t *argument_list_p, /
|
||||
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
/* 5. */
|
||||
if (length + arguments_number > ECMA_NUMBER_MAX_SAFE_INTEGER)
|
||||
if ((ecma_number_t) (length + arguments_number) > ECMA_NUMBER_MAX_SAFE_INTEGER)
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Pushing element over 2**53-1 length is disallowed"));
|
||||
}
|
||||
@@ -1563,7 +1563,7 @@ ecma_builtin_array_prototype_object_unshift (const ecma_value_t args[], /**< arg
|
||||
{
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
/* ES11:4.a. */
|
||||
if (len + args_number > ECMA_NUMBER_MAX_SAFE_INTEGER)
|
||||
if ((ecma_number_t) (len + args_number) > ECMA_NUMBER_MAX_SAFE_INTEGER)
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Unshift elements over 2**53-1 length is disallowed"));
|
||||
}
|
||||
@@ -1661,7 +1661,7 @@ ecma_builtin_array_prototype_object_index_of (const ecma_value_t args[], /**< ar
|
||||
}
|
||||
|
||||
/* 6. */
|
||||
if (idx >= len)
|
||||
if (idx >= (ecma_number_t) len)
|
||||
{
|
||||
return ecma_make_number_value (-1);
|
||||
}
|
||||
|
||||
@@ -367,7 +367,7 @@ ecma_builtin_helper_array_concat_value (ecma_object_t *array_obj_p, /**< array *
|
||||
}
|
||||
|
||||
/* 4 . */
|
||||
if (*length_p + arg_len > ECMA_NUMBER_MAX_SAFE_INTEGER)
|
||||
if ((ecma_number_t) (*length_p + arg_len) > ECMA_NUMBER_MAX_SAFE_INTEGER)
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Invalid array length."));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user