Skip to content

Commit

Permalink
fix warnings on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
wenyongh committed Oct 14, 2024
1 parent ac40329 commit 6966450
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
3 changes: 2 additions & 1 deletion core/iwasm/common/wasm_runtime_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -3592,7 +3592,8 @@ wasm_runtime_init_wasi(WASMModuleInstanceCommon *module_inst,
char mapping_copy_buf[256];
char *mapping_copy = mapping_copy_buf;
char *map_mapped = NULL, *map_host = NULL;
const unsigned long max_len = strlen(map_dir_list[i]) * 2 + 3;
const unsigned long max_len =
(unsigned long)strlen(map_dir_list[i]) * 2 + 3;

/* Allocation limit for runtime environments with reduced stack size */
if (max_len > 256) {
Expand Down
9 changes: 5 additions & 4 deletions core/iwasm/libraries/libc-wasi/libc_wasi_wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -1022,8 +1022,8 @@ execute_interruptible_poll_oneoff(
uint32 i;

const __wasi_timestamp_t timeout = get_timeout_for_poll_oneoff(
in, nsubscriptions),
time_quant = 1e9;
in, (uint32)nsubscriptions),
time_quant = (__wasi_timestamp_t)1e9;
const uint64 size_to_copy =
nsubscriptions * (uint64)sizeof(wasi_subscription_t);
__wasi_subscription_t *in_copy = NULL;
Expand All @@ -1034,12 +1034,13 @@ execute_interruptible_poll_oneoff(
return __WASI_ENOMEM;
}

bh_memcpy_s(in_copy, size_to_copy, in, size_to_copy);
bh_memcpy_s(in_copy, (uint32)size_to_copy, in, (uint32)size_to_copy);

while (timeout == (__wasi_timestamp_t)-1 || elapsed <= timeout) {
/* update timeout for clock subscription events */
update_clock_subscription_data(
in_copy, nsubscriptions, min_uint64(time_quant, timeout - elapsed));
in_copy, (uint32)nsubscriptions,
min_uint64(time_quant, timeout - elapsed));
err = wasmtime_ssp_poll_oneoff(exec_env, curfds, in_copy, out,
nsubscriptions, nevents);
elapsed += time_quant;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3130,7 +3130,7 @@ compare_address(const struct addr_pool *addr_pool_entry,
}
addr_size = 16;
}
max_addr_mask = addr_size * 8;
max_addr_mask = (uint8)(addr_size * 8);

/* IPv4 0.0.0.0 or IPv6 :: means any address */
if (basebuf[0] == 0 && !memcmp(basebuf, basebuf + 1, addr_size - 1)) {
Expand Down
2 changes: 1 addition & 1 deletion core/shared/platform/windows/win_clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ os_clock_res_get(__wasi_clockid_t clock_id, __wasi_timestamp_t *resolution)
case __WASI_CLOCK_PROCESS_CPUTIME_ID:
case __WASI_CLOCK_THREAD_CPUTIME_ID:
{
#if WINAPI_PARTITION_DESKTOP
#if WINAPI_PARTITION_DESKTOP && WASM_ENABLE_WAMR_COMPILER == 0
ULONG maximum_time;
ULONG minimum_time;
ULONG current_time;
Expand Down

0 comments on commit 6966450

Please sign in to comment.