mirror of
https://github.com/jerryscript-project/jerryscript.git
synced 2025-12-15 16:29:21 +00:00
Fix LLVM/clang conversion errors (#2473)
This fixes some conversion errors one gets when compiling with LLVM/clang. Most of them are caused when a bit-specific type (i.e. `uint16_t`) is implicitly cast to an `enum` of smaller value range. The fix is just an explicit casting of those types to the desired target type. JerryScript-DCO-1.0-Signed-off-by: Martine Lenders m.lenders@fu-berlin.de
This commit is contained in:
parent
505dace719
commit
851f4f0b89
@ -735,12 +735,12 @@ ecma_builtin_try_to_instantiate_property (ecma_object_t *object_p, /**< object *
|
||||
}
|
||||
case ECMA_BUILTIN_PROPERTY_STRING:
|
||||
{
|
||||
value = ecma_make_magic_string_value (curr_property_p->value);
|
||||
value = ecma_make_magic_string_value ((lit_magic_string_id_t) curr_property_p->value);
|
||||
break;
|
||||
}
|
||||
case ECMA_BUILTIN_PROPERTY_OBJECT:
|
||||
{
|
||||
value = ecma_make_object_value (ecma_builtin_get (curr_property_p->value));
|
||||
value = ecma_make_object_value (ecma_builtin_get ((ecma_builtin_id_t) curr_property_p->value));
|
||||
break;
|
||||
}
|
||||
case ECMA_BUILTIN_PROPERTY_ROUTINE:
|
||||
@ -878,15 +878,15 @@ ecma_builtin_list_lazy_property_names (ecma_object_t *object_p, /**< a built-in
|
||||
index = 0;
|
||||
}
|
||||
|
||||
ecma_string_t *name_p = ecma_get_magic_string (curr_property_p->magic_string_id);
|
||||
ecma_string_t *name_p = ecma_get_magic_string ((lit_magic_string_id_t) curr_property_p->magic_string_id);
|
||||
|
||||
uint32_t bit_for_index = (uint32_t) 1u << index;
|
||||
|
||||
if (!(*bitset_p & bit_for_index) || ecma_op_object_has_own_property (object_p, name_p))
|
||||
{
|
||||
ecma_append_to_values_collection (for_non_enumerable_p,
|
||||
ecma_make_magic_string_value (curr_property_p->magic_string_id),
|
||||
0);
|
||||
ecma_value_t name = ecma_make_magic_string_value ((lit_magic_string_id_t) curr_property_p->magic_string_id);
|
||||
|
||||
ecma_append_to_values_collection (for_non_enumerable_p, name, 0);
|
||||
}
|
||||
|
||||
ecma_deref_ecma_string (name_p);
|
||||
|
||||
@ -1775,7 +1775,7 @@ ecma_object_get_class_name (ecma_object_t *obj_p) /**< object */
|
||||
case ECMA_OBJECT_TYPE_CLASS:
|
||||
{
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) obj_p;
|
||||
return ext_object_p->u.class_prop.class_id;
|
||||
return (lit_magic_string_id_t) ext_object_p->u.class_prop.class_id;
|
||||
}
|
||||
case ECMA_OBJECT_TYPE_PSEUDO_ARRAY:
|
||||
{
|
||||
@ -1787,7 +1787,7 @@ ecma_object_get_class_name (ecma_object_t *obj_p) /**< object */
|
||||
case ECMA_PSEUDO_ARRAY_TYPEDARRAY:
|
||||
case ECMA_PSEUDO_ARRAY_TYPEDARRAY_WITH_INFO:
|
||||
{
|
||||
return ext_obj_p->u.pseudo_array.u1.class_id;
|
||||
return (lit_magic_string_id_t) ext_obj_p->u.pseudo_array.u1.class_id;
|
||||
}
|
||||
#endif /* !CONFIG_DISABLE_ES2015_TYPEDARRAY_BUILTIN */
|
||||
default:
|
||||
|
||||
@ -916,7 +916,7 @@ ecma_op_create_typedarray_with_type_and_length (ecma_object_t *obj_p, /**< Typed
|
||||
JERRY_ASSERT (ecma_is_typedarray (ecma_make_object_value (obj_p)));
|
||||
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) obj_p;
|
||||
lit_magic_string_id_t class_id = ext_object_p->u.pseudo_array.u1.class_id;
|
||||
lit_magic_string_id_t class_id = (lit_magic_string_id_t) ext_object_p->u.pseudo_array.u1.class_id;
|
||||
ecma_object_t *proto_p;
|
||||
uint8_t element_size_shift = 0;
|
||||
|
||||
|
||||
@ -204,7 +204,7 @@ lit_is_utf8_string_magic (const lit_utf8_byte_t *string_p, /**< utf-8 string */
|
||||
while (first < last)
|
||||
{
|
||||
lit_utf8_size_t middle = ((first + last) / 2); /**< mid point of search */
|
||||
int compare = memcmp (lit_get_magic_string_utf8 (middle), string_p, string_size);
|
||||
int compare = memcmp (lit_get_magic_string_utf8 ((lit_magic_string_id_t) middle), string_p, string_size);
|
||||
|
||||
if (compare == 0)
|
||||
{
|
||||
@ -249,7 +249,7 @@ lit_is_utf8_string_pair_magic (const lit_utf8_byte_t *string1_p, /**< first utf-
|
||||
while (first < last)
|
||||
{
|
||||
lit_utf8_size_t middle = ((first + last) / 2); /**< mid point of search */
|
||||
const lit_utf8_byte_t *middle_string_p = lit_get_magic_string_utf8 (middle);
|
||||
const lit_utf8_byte_t *middle_string_p = lit_get_magic_string_utf8 ((lit_magic_string_id_t) middle);
|
||||
|
||||
int compare = memcmp (middle_string_p, string1_p, string1_size);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user