mirror of
https://github.com/jerryscript-project/jerryscript.git
synced 2025-12-15 16:29:21 +00:00
Use C type casting instead of static_cast.
JerryScript-DCO-1.0-Signed-off-by: Roland Takacs rtakacs.u-szeged@partner.samsung.com
This commit is contained in:
parent
764d74561d
commit
efc994b112
@ -567,7 +567,7 @@ typedef struct
|
||||
* Description of an ecma-number
|
||||
*/
|
||||
typedef float ecma_number_t;
|
||||
#define DOUBLE_TO_ECMA_NUMBER_T(value) static_cast<ecma_number_t> (value)
|
||||
#define DOUBLE_TO_ECMA_NUMBER_T(value) (ecma_number_t) (value)
|
||||
|
||||
/**
|
||||
* Maximum number of significant digits that ecma-number can store
|
||||
|
||||
@ -460,7 +460,7 @@ jerry_api_convert_api_value_to_ecma_value (ecma_value_t *out_value_p, /**< out:
|
||||
case JERRY_API_DATA_TYPE_FLOAT32:
|
||||
{
|
||||
ecma_number_t *num = ecma_alloc_number ();
|
||||
*num = static_cast<ecma_number_t> (api_value_p->v_float32);
|
||||
*num = (ecma_number_t) (api_value_p->v_float32);
|
||||
|
||||
*out_value_p = ecma_make_number_value (num);
|
||||
|
||||
@ -469,7 +469,7 @@ jerry_api_convert_api_value_to_ecma_value (ecma_value_t *out_value_p, /**< out:
|
||||
case JERRY_API_DATA_TYPE_FLOAT64:
|
||||
{
|
||||
ecma_number_t *num = ecma_alloc_number ();
|
||||
*num = static_cast<ecma_number_t> (api_value_p->v_float64);
|
||||
*num = (ecma_number_t) (api_value_p->v_float64);
|
||||
|
||||
*out_value_p = ecma_make_number_value (num);
|
||||
|
||||
@ -478,7 +478,7 @@ jerry_api_convert_api_value_to_ecma_value (ecma_value_t *out_value_p, /**< out:
|
||||
case JERRY_API_DATA_TYPE_UINT32:
|
||||
{
|
||||
ecma_number_t *num = ecma_alloc_number ();
|
||||
*num = static_cast<ecma_number_t> (api_value_p->v_uint32);
|
||||
*num = (ecma_number_t) (api_value_p->v_uint32);
|
||||
|
||||
*out_value_p = ecma_make_number_value (num);
|
||||
|
||||
|
||||
@ -77,7 +77,7 @@ typedef void (*mem_try_give_memory_back_callback_t) (mem_try_give_memory_back_se
|
||||
* Get value of pointer from specified non-null compressed pointer value
|
||||
*/
|
||||
#define MEM_CP_GET_NON_NULL_POINTER(type, cp_value) \
|
||||
(static_cast<type *> (mem_decompress_pointer (cp_value)))
|
||||
((type *) (mem_decompress_pointer (cp_value)))
|
||||
|
||||
/**
|
||||
* Get value of pointer from specified compressed pointer value
|
||||
|
||||
@ -110,7 +110,7 @@ extern void mem_heap_valgrind_freya_mempool_request (void);
|
||||
#define MEM_DEFINE_LOCAL_ARRAY(var_name, number, type) \
|
||||
{ \
|
||||
size_t var_name ## ___size = (size_t) (number) * sizeof (type); \
|
||||
type *var_name = static_cast <type *> (mem_heap_alloc_block (var_name ## ___size, MEM_HEAP_ALLOC_SHORT_TERM));
|
||||
type *var_name = (type *) (mem_heap_alloc_block (var_name ## ___size, MEM_HEAP_ALLOC_SHORT_TERM));
|
||||
|
||||
/**
|
||||
* Free the previously defined local array variable, freeing corresponding block on the heap,
|
||||
|
||||
@ -61,7 +61,7 @@ static uint8_t *
|
||||
re_realloc_regexp_bytecode_block (re_bytecode_ctx_t *bc_ctx_p) /**< RegExp bytecode context */
|
||||
{
|
||||
JERRY_ASSERT (bc_ctx_p->block_end_p - bc_ctx_p->block_start_p >= 0);
|
||||
size_t old_size = static_cast<size_t> (bc_ctx_p->block_end_p - bc_ctx_p->block_start_p);
|
||||
size_t old_size = (size_t) (bc_ctx_p->block_end_p - bc_ctx_p->block_start_p);
|
||||
|
||||
/* If one of the members of RegExp bytecode context is NULL, then all member should be NULL
|
||||
* (it means first allocation), otherwise all of the members should be a non NULL pointer. */
|
||||
@ -70,13 +70,13 @@ re_realloc_regexp_bytecode_block (re_bytecode_ctx_t *bc_ctx_p) /**< RegExp bytec
|
||||
|
||||
size_t new_block_size = old_size + REGEXP_BYTECODE_BLOCK_SIZE;
|
||||
JERRY_ASSERT (bc_ctx_p->current_p - bc_ctx_p->block_start_p >= 0);
|
||||
size_t current_ptr_offset = static_cast<size_t> (bc_ctx_p->current_p - bc_ctx_p->block_start_p);
|
||||
size_t current_ptr_offset = (size_t) (bc_ctx_p->current_p - bc_ctx_p->block_start_p);
|
||||
|
||||
uint8_t *new_block_start_p = (uint8_t *) mem_heap_alloc_block (new_block_size,
|
||||
MEM_HEAP_ALLOC_SHORT_TERM);
|
||||
if (bc_ctx_p->current_p)
|
||||
{
|
||||
memcpy (new_block_start_p, bc_ctx_p->block_start_p, static_cast<size_t> (current_ptr_offset));
|
||||
memcpy (new_block_start_p, bc_ctx_p->block_start_p, (size_t) (current_ptr_offset));
|
||||
mem_heap_free_block (bc_ctx_p->block_start_p);
|
||||
}
|
||||
bc_ctx_p->block_start_p = new_block_start_p;
|
||||
|
||||
@ -28,10 +28,10 @@
|
||||
|
||||
#define JS_VALUE_TO_NUMBER(val_p) \
|
||||
((val_p)->type == JERRY_API_DATA_TYPE_FLOAT32 ? \
|
||||
static_cast<double>((val_p)->v_float32) : \
|
||||
(double) ((val_p)->v_float32) : \
|
||||
(val_p)->type == JERRY_API_DATA_TYPE_FLOAT64 ? \
|
||||
static_cast<double>((val_p)->v_float64) : \
|
||||
static_cast<double>((val_p)->v_uint32))
|
||||
(double) ((val_p)->v_float64) : \
|
||||
(double) ((val_p)->v_uint32))
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@ -30,10 +30,10 @@
|
||||
|
||||
#define JS_VALUE_TO_NUMBER(val_p) \
|
||||
((val_p)->type == JERRY_API_DATA_TYPE_FLOAT32 ? \
|
||||
static_cast<double>((val_p)->v_float32) : \
|
||||
(double) ((val_p)->v_float32) : \
|
||||
(val_p)->type == JERRY_API_DATA_TYPE_FLOAT64 ? \
|
||||
static_cast<double>((val_p)->v_float64) : \
|
||||
static_cast<double>((val_p)->v_uint32))
|
||||
(double) ((val_p)->v_float64) : \
|
||||
(double) ((val_p)->v_uint32))
|
||||
|
||||
|
||||
void js_register_functions (void);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user