Skip to content

Commit efc994b

Browse files
Roland TakacsLaszloLango
authored andcommitted
Use C type casting instead of static_cast.
JerryScript-DCO-1.0-Signed-off-by: Roland Takacs rtakacs.u-szeged@partner.samsung.com
1 parent 764d745 commit efc994b

File tree

7 files changed

+15
-15
lines changed

7 files changed

+15
-15
lines changed

jerry-core/ecma/base/ecma-globals.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ typedef struct
567567
* Description of an ecma-number
568568
*/
569569
typedef float ecma_number_t;
570-
#define DOUBLE_TO_ECMA_NUMBER_T(value) static_cast<ecma_number_t> (value)
570+
#define DOUBLE_TO_ECMA_NUMBER_T(value) (ecma_number_t) (value)
571571

572572
/**
573573
* Maximum number of significant digits that ecma-number can store

jerry-core/jerry.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ jerry_api_convert_api_value_to_ecma_value (ecma_value_t *out_value_p, /**< out:
460460
case JERRY_API_DATA_TYPE_FLOAT32:
461461
{
462462
ecma_number_t *num = ecma_alloc_number ();
463-
*num = static_cast<ecma_number_t> (api_value_p->v_float32);
463+
*num = (ecma_number_t) (api_value_p->v_float32);
464464

465465
*out_value_p = ecma_make_number_value (num);
466466

@@ -469,7 +469,7 @@ jerry_api_convert_api_value_to_ecma_value (ecma_value_t *out_value_p, /**< out:
469469
case JERRY_API_DATA_TYPE_FLOAT64:
470470
{
471471
ecma_number_t *num = ecma_alloc_number ();
472-
*num = static_cast<ecma_number_t> (api_value_p->v_float64);
472+
*num = (ecma_number_t) (api_value_p->v_float64);
473473

474474
*out_value_p = ecma_make_number_value (num);
475475

@@ -478,7 +478,7 @@ jerry_api_convert_api_value_to_ecma_value (ecma_value_t *out_value_p, /**< out:
478478
case JERRY_API_DATA_TYPE_UINT32:
479479
{
480480
ecma_number_t *num = ecma_alloc_number ();
481-
*num = static_cast<ecma_number_t> (api_value_p->v_uint32);
481+
*num = (ecma_number_t) (api_value_p->v_uint32);
482482

483483
*out_value_p = ecma_make_number_value (num);
484484

jerry-core/mem/mem-allocator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ typedef void (*mem_try_give_memory_back_callback_t) (mem_try_give_memory_back_se
7777
* Get value of pointer from specified non-null compressed pointer value
7878
*/
7979
#define MEM_CP_GET_NON_NULL_POINTER(type, cp_value) \
80-
(static_cast<type *> (mem_decompress_pointer (cp_value)))
80+
((type *) (mem_decompress_pointer (cp_value)))
8181

8282
/**
8383
* Get value of pointer from specified compressed pointer value

jerry-core/mem/mem-heap.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ extern void mem_heap_valgrind_freya_mempool_request (void);
110110
#define MEM_DEFINE_LOCAL_ARRAY(var_name, number, type) \
111111
{ \
112112
size_t var_name ## ___size = (size_t) (number) * sizeof (type); \
113-
type *var_name = static_cast <type *> (mem_heap_alloc_block (var_name ## ___size, MEM_HEAP_ALLOC_SHORT_TERM));
113+
type *var_name = (type *) (mem_heap_alloc_block (var_name ## ___size, MEM_HEAP_ALLOC_SHORT_TERM));
114114

115115
/**
116116
* Free the previously defined local array variable, freeing corresponding block on the heap,

jerry-core/parser/regexp/re-compiler.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ static uint8_t *
6161
re_realloc_regexp_bytecode_block (re_bytecode_ctx_t *bc_ctx_p) /**< RegExp bytecode context */
6262
{
6363
JERRY_ASSERT (bc_ctx_p->block_end_p - bc_ctx_p->block_start_p >= 0);
64-
size_t old_size = static_cast<size_t> (bc_ctx_p->block_end_p - bc_ctx_p->block_start_p);
64+
size_t old_size = (size_t) (bc_ctx_p->block_end_p - bc_ctx_p->block_start_p);
6565

6666
/* If one of the members of RegExp bytecode context is NULL, then all member should be NULL
6767
* (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
7070

7171
size_t new_block_size = old_size + REGEXP_BYTECODE_BLOCK_SIZE;
7272
JERRY_ASSERT (bc_ctx_p->current_p - bc_ctx_p->block_start_p >= 0);
73-
size_t current_ptr_offset = static_cast<size_t> (bc_ctx_p->current_p - bc_ctx_p->block_start_p);
73+
size_t current_ptr_offset = (size_t) (bc_ctx_p->current_p - bc_ctx_p->block_start_p);
7474

7575
uint8_t *new_block_start_p = (uint8_t *) mem_heap_alloc_block (new_block_size,
7676
MEM_HEAP_ALLOC_SHORT_TERM);
7777
if (bc_ctx_p->current_p)
7878
{
79-
memcpy (new_block_start_p, bc_ctx_p->block_start_p, static_cast<size_t> (current_ptr_offset));
79+
memcpy (new_block_start_p, bc_ctx_p->block_start_p, (size_t) (current_ptr_offset));
8080
mem_heap_free_block (bc_ctx_p->block_start_p);
8181
}
8282
bc_ctx_p->block_start_p = new_block_start_p;

targets/esp8266/include/jerry_extapi.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@
2828

2929
#define JS_VALUE_TO_NUMBER(val_p) \
3030
((val_p)->type == JERRY_API_DATA_TYPE_FLOAT32 ? \
31-
static_cast<double>((val_p)->v_float32) : \
31+
(double) ((val_p)->v_float32) : \
3232
(val_p)->type == JERRY_API_DATA_TYPE_FLOAT64 ? \
33-
static_cast<double>((val_p)->v_float64) : \
34-
static_cast<double>((val_p)->v_uint32))
33+
(double) ((val_p)->v_float64) : \
34+
(double) ((val_p)->v_uint32))
3535

3636

3737
#ifdef __cplusplus

targets/mbedk64f/source/jerry_extapi.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@
3030

3131
#define JS_VALUE_TO_NUMBER(val_p) \
3232
((val_p)->type == JERRY_API_DATA_TYPE_FLOAT32 ? \
33-
static_cast<double>((val_p)->v_float32) : \
33+
(double) ((val_p)->v_float32) : \
3434
(val_p)->type == JERRY_API_DATA_TYPE_FLOAT64 ? \
35-
static_cast<double>((val_p)->v_float64) : \
36-
static_cast<double>((val_p)->v_uint32))
35+
(double) ((val_p)->v_float64) : \
36+
(double) ((val_p)->v_uint32))
3737

3838

3939
void js_register_functions (void);

0 commit comments

Comments
 (0)