Browse Source

Fix type cast warnings

pull/514/head
Sami Vaarala 9 years ago
parent
commit
3fc88286dd
  1. 4
      src/duk_api_stack.c
  2. 8
      src/duk_bi_buffer.c
  3. 2
      src/duk_hobject.h
  4. 4
      src/duk_js_compiler.c
  5. 2
      src/duk_js_executor.c
  6. 2
      src/duk_numconv.c

4
src/duk_api_stack.c

@ -3735,7 +3735,7 @@ DUK_LOCAL duk_idx_t duk__push_c_function_raw(duk_context *ctx, duk_c_function fu
duk_hnativefunction *obj; duk_hnativefunction *obj;
duk_idx_t ret; duk_idx_t ret;
duk_tval *tv_slot; duk_tval *tv_slot;
duk_uint16_t func_nargs; duk_int16_t func_nargs;
DUK_ASSERT_CTX_VALID(ctx); DUK_ASSERT_CTX_VALID(ctx);
@ -3747,7 +3747,7 @@ DUK_LOCAL duk_idx_t duk__push_c_function_raw(duk_context *ctx, duk_c_function fu
goto api_error; goto api_error;
} }
if (nargs >= 0 && nargs < DUK_HNATIVEFUNCTION_NARGS_MAX) { if (nargs >= 0 && nargs < DUK_HNATIVEFUNCTION_NARGS_MAX) {
func_nargs = (duk_uint16_t) nargs; func_nargs = (duk_int16_t) nargs;
} else if (nargs == DUK_VARARGS) { } else if (nargs == DUK_VARARGS) {
func_nargs = DUK_HNATIVEFUNCTION_NARGS_VARARGS; func_nargs = DUK_HNATIVEFUNCTION_NARGS_VARARGS;
} else { } else {

8
src/duk_bi_buffer.c

@ -866,8 +866,8 @@ DUK_INTERNAL duk_ret_t duk_bi_typedarray_constructor(duk_context *ctx) {
DUK_HBUFFER_INCREF(thr, h_val); DUK_HBUFFER_INCREF(thr, h_val);
h_bufobj->offset = h_bufarg->offset + byte_offset; h_bufobj->offset = h_bufarg->offset + byte_offset;
h_bufobj->length = byte_length; h_bufobj->length = byte_length;
h_bufobj->shift = shift; h_bufobj->shift = (duk_uint8_t) shift;
h_bufobj->elem_type = elem_type; h_bufobj->elem_type = (duk_uint8_t) elem_type;
h_bufobj->is_view = 1; h_bufobj->is_view = 1;
DUK_ASSERT_HBUFFEROBJECT_VALID(h_bufobj); DUK_ASSERT_HBUFFEROBJECT_VALID(h_bufobj);
@ -970,8 +970,8 @@ DUK_INTERNAL duk_ret_t duk_bi_typedarray_constructor(duk_context *ctx) {
DUK_HBUFFER_INCREF(thr, h_val); DUK_HBUFFER_INCREF(thr, h_val);
DUK_ASSERT(h_bufobj->offset == 0); DUK_ASSERT(h_bufobj->offset == 0);
h_bufobj->length = byte_length; h_bufobj->length = byte_length;
h_bufobj->shift = shift; h_bufobj->shift = (duk_uint8_t) shift;
h_bufobj->elem_type = elem_type; h_bufobj->elem_type = (duk_uint8_t) elem_type;
h_bufobj->is_view = 1; h_bufobj->is_view = 1;
DUK_ASSERT_HBUFFEROBJECT_VALID(h_bufobj); DUK_ASSERT_HBUFFEROBJECT_VALID(h_bufobj);

2
src/duk_hobject.h

@ -492,7 +492,7 @@
DUK_HOBJECT_E_GET_VALUE((heap), (h), (i)).a.set = (v); \ DUK_HOBJECT_E_GET_VALUE((heap), (h), (i)).a.set = (v); \
} while (0) } while (0)
#define DUK_HOBJECT_E_SET_FLAGS(heap,h,i,f) do { \ #define DUK_HOBJECT_E_SET_FLAGS(heap,h,i,f) do { \
DUK_HOBJECT_E_GET_FLAGS((heap), (h), (i)) = (f); \ DUK_HOBJECT_E_GET_FLAGS((heap), (h), (i)) = (duk_uint8_t) (f); \
} while (0) } while (0)
#define DUK_HOBJECT_A_SET_VALUE(heap,h,i,v) do { \ #define DUK_HOBJECT_A_SET_VALUE(heap,h,i,v) do { \
DUK_HOBJECT_A_GET_VALUE((heap), (h), (i)) = (v); \ DUK_HOBJECT_A_GET_VALUE((heap), (h), (i)) = (v); \

4
src/duk_js_compiler.c

@ -920,8 +920,8 @@ DUK_LOCAL void duk__convert_to_func_template(duk_compiler_ctx *comp_ctx, duk_boo
*/ */
DUK_ASSERT(func->temp_max >= 0); DUK_ASSERT(func->temp_max >= 0);
h_res->nregs = func->temp_max; h_res->nregs = (duk_uint16_t) func->temp_max;
h_res->nargs = duk_hobject_get_length(thr, func->h_argnames); h_res->nargs = (duk_uint16_t) duk_hobject_get_length(thr, func->h_argnames);
DUK_ASSERT(h_res->nregs >= h_res->nargs); /* pass2 allocation handles this */ DUK_ASSERT(h_res->nregs >= h_res->nargs); /* pass2 allocation handles this */
#if defined(DUK_USE_DEBUGGER_SUPPORT) #if defined(DUK_USE_DEBUGGER_SUPPORT)
h_res->start_line = (duk_uint32_t) func->min_line; h_res->start_line = (duk_uint32_t) func->min_line;

2
src/duk_js_executor.c

@ -476,7 +476,7 @@ DUK_LOCAL void duk__vm_arith_unary_op(duk_hthread *thr, duk_tval *tv_x, duk_idx_
#endif #endif
} }
DUK_LOCAL void duk__vm_bitwise_not(duk_hthread *thr, duk_tval *tv_x, duk_small_uint_fast_t idx_z) { DUK_LOCAL void duk__vm_bitwise_not(duk_hthread *thr, duk_tval *tv_x, duk_uint_fast_t idx_z) {
/* /*
* E5 Section 11.4.8 * E5 Section 11.4.8
*/ */

2
src/duk_numconv.c

@ -1183,7 +1183,7 @@ DUK_LOCAL duk_small_int_t duk__dragon4_fixed_format_round(duk__numconv_stringify
DUK_DDD(DUK_DDDPRINT("digit before carry: %ld", (long) t)); DUK_DDD(DUK_DDDPRINT("digit before carry: %ld", (long) t));
if (++t < nc_ctx->B) { if (++t < nc_ctx->B) {
DUK_DDD(DUK_DDDPRINT("rounding carry terminated")); DUK_DDD(DUK_DDDPRINT("rounding carry terminated"));
*p = t; *p = (duk_uint8_t) t;
break; break;
} }

Loading…
Cancel
Save