From 547647af1336578bac599207d8ac00a1075b5d49 Mon Sep 17 00:00:00 2001 From: chokobole Date: Fri, 23 Sep 2016 16:47:13 +0900 Subject: [PATCH] Type cast according to format string (#1368) JerryScript-DCO-1.0-Signed-off-by: wonyong.kim wonyong.kim@samsung.com --- .../ecma/builtin-objects/ecma-builtin-global.c | 2 +- jerry-core/ecma/operations/ecma-regexp-object.c | 13 +++++++------ jerry-core/parser/regexp/re-compiler.c | 11 ++++++----- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-global.c b/jerry-core/ecma/builtin-objects/ecma-builtin-global.c index ba37e43a0..e2ca19a8f 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-global.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-global.c @@ -113,7 +113,7 @@ ecma_builtin_global_object_print (ecma_value_t this_arg, /**< this argument */ 0, JERRY_BITSINBYTE); - jerry_port_console ("\\u%02x%02x", byte_high, byte_low); + jerry_port_console ("\\u%02x%02x", (unsigned int) byte_high, (unsigned int) byte_low); } } diff --git a/jerry-core/ecma/operations/ecma-regexp-object.c b/jerry-core/ecma/operations/ecma-regexp-object.c index 735fd4846..db7f4572b 100644 --- a/jerry-core/ecma/operations/ecma-regexp-object.c +++ b/jerry-core/ecma/operations/ecma-regexp-object.c @@ -415,7 +415,7 @@ re_match_regexp (re_matcher_ctx_t *re_ctx_p, /**< RegExp matcher context */ } ecma_char_t ch = lit_utf8_read_next (&str_curr_p); - JERRY_TRACE_MSG ("Period matching '.' to %d: ", (uint32_t) ch); + JERRY_TRACE_MSG ("Period matching '.' to %u: ", (unsigned int) ch); if (lit_char_is_line_terminator (ch)) { @@ -608,8 +608,9 @@ re_match_regexp (re_matcher_ctx_t *re_ctx_p, /**< RegExp matcher context */ { ecma_char_t ch1 = re_canonicalize (re_get_char (&bc_p), is_ignorecase); ecma_char_t ch2 = re_canonicalize (re_get_char (&bc_p), is_ignorecase); - JERRY_TRACE_MSG ("num_of_ranges=%d, ch1=%d, ch2=%d, curr_ch=%d; ", - num_of_ranges, ch1, ch2, curr_ch); + JERRY_TRACE_MSG ("num_of_ranges=%u, ch1=%u, ch2=%u, curr_ch=%u; ", + (unsigned int) num_of_ranges, (unsigned int) ch1, + (unsigned int) ch2, (unsigned int) curr_ch); if (curr_ch >= ch1 && curr_ch <= ch2) { @@ -644,7 +645,7 @@ re_match_regexp (re_matcher_ctx_t *re_ctx_p, /**< RegExp matcher context */ uint32_t backref_idx; backref_idx = re_get_value (&bc_p); - JERRY_TRACE_MSG ("Execute RE_OP_BACKREFERENCE (idx: %d): ", backref_idx); + JERRY_TRACE_MSG ("Execute RE_OP_BACKREFERENCE (idx: %u): ", (unsigned int) backref_idx); backref_idx *= 2; /* backref n -> saved indices [n*2, n*2+1] */ JERRY_ASSERT (backref_idx >= 2 && backref_idx + 1 < re_ctx_p->num_of_captures); @@ -729,7 +730,7 @@ re_match_regexp (re_matcher_ctx_t *re_ctx_p, /**< RegExp matcher context */ while (*bc_p == RE_OP_ALTERNATIVE) { - JERRY_TRACE_MSG (", jump: %d", offset); + JERRY_TRACE_MSG (", jump: %u", (unsigned int) offset); bc_p++; offset = re_get_value (&bc_p); bc_p += offset; @@ -1148,7 +1149,7 @@ re_match_regexp (re_matcher_ctx_t *re_ctx_p, /**< RegExp matcher context */ } default: { - JERRY_TRACE_MSG ("UNKNOWN opcode (%d)!\n", (uint32_t) op); + JERRY_TRACE_MSG ("UNKNOWN opcode (%u)!\n", (unsigned int) op); return ecma_raise_common_error (ECMA_ERR_MSG ("")); } } diff --git a/jerry-core/parser/regexp/re-compiler.c b/jerry-core/parser/regexp/re-compiler.c index 475568377..f5df456df 100644 --- a/jerry-core/parser/regexp/re-compiler.c +++ b/jerry-core/parser/regexp/re-compiler.c @@ -237,7 +237,7 @@ re_parse_alternative (re_compiler_ctx_t *re_ctx_p, /**< RegExp compiler context case RE_TOK_START_CAPTURE_GROUP: { idx = re_ctx_p->num_of_captures++; - JERRY_TRACE_MSG ("Compile a capture group start (idx: %d)\n", idx); + JERRY_TRACE_MSG ("Compile a capture group start (idx: %u)\n", (unsigned int) idx); ret_value = re_parse_alternative (re_ctx_p, false); @@ -251,7 +251,7 @@ re_parse_alternative (re_compiler_ctx_t *re_ctx_p, /**< RegExp compiler context case RE_TOK_START_NON_CAPTURE_GROUP: { idx = re_ctx_p->num_of_non_captures++; - JERRY_TRACE_MSG ("Compile a non-capture group start (idx: %d)\n", idx); + JERRY_TRACE_MSG ("Compile a non-capture group start (idx: %u)\n", (unsigned int) idx); ret_value = re_parse_alternative (re_ctx_p, false); @@ -264,8 +264,9 @@ re_parse_alternative (re_compiler_ctx_t *re_ctx_p, /**< RegExp compiler context } case RE_TOK_CHAR: { - JERRY_TRACE_MSG ("Compile character token: %c, qmin: %d, qmax: %d\n", - re_ctx_p->current_token.value, re_ctx_p->current_token.qmin, re_ctx_p->current_token.qmax); + JERRY_TRACE_MSG ("Compile character token: %c, qmin: %u, qmax: %u\n", + (char) re_ctx_p->current_token.value, (unsigned int) re_ctx_p->current_token.qmin, + (unsigned int) re_ctx_p->current_token.qmax); re_append_opcode (bc_ctx_p, RE_OP_CHAR); re_append_char (bc_ctx_p, re_canonicalize ((ecma_char_t) re_ctx_p->current_token.value, @@ -364,7 +365,7 @@ re_parse_alternative (re_compiler_ctx_t *re_ctx_p, /**< RegExp compiler context re_ctx_p->highest_backref = backref; } - JERRY_TRACE_MSG ("Compile a backreference: %d\n", backref); + JERRY_TRACE_MSG ("Compile a backreference: %u\n", (unsigned int) backref); re_append_opcode (bc_ctx_p, RE_OP_BACKREFERENCE); re_append_u32 (bc_ctx_p, backref);