mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-05-11 12:11:14 +00:00
Fix a few signedness warnings (#1095)
Fix compile warnings in libc-wasi posix.c: ``` posix.c:880:41: warning: comparison of integers of different signs: 'unsigned long' and 'ssize_t' (aka 'long') [-Wsign-compare] if (bufoff + iov[i].buf_len < len) { posix.c:1359:32: warning: comparison of integers of different signs: 'off_t' (aka 'long long') and 'unsigned long long' [-Wsign-compare] if (ret == 0 && sb.st_size < offset + len) ```
This commit is contained in:
parent
8589ed155d
commit
2366e8c493
|
@ -877,7 +877,7 @@ wasmtime_ssp_fd_pread(
|
|||
// Copy data back to vectors.
|
||||
size_t bufoff = 0;
|
||||
for (size_t i = 0; i < iovcnt; ++i) {
|
||||
if (bufoff + iov[i].buf_len < len) {
|
||||
if (bufoff + iov[i].buf_len < (size_t)len) {
|
||||
bh_memcpy_s(iov[i].buf, iov[i].buf_len, buf + bufoff,
|
||||
iov[i].buf_len);
|
||||
bufoff += iov[i].buf_len;
|
||||
|
@ -1356,8 +1356,9 @@ wasmtime_ssp_fd_allocate(
|
|||
// conditions. We may end up shrinking the file right now.
|
||||
struct stat sb;
|
||||
int ret = fstat(fd_number(fo), &sb);
|
||||
if (ret == 0 && sb.st_size < offset + len)
|
||||
ret = ftruncate(fd_number(fo), offset + len);
|
||||
off_t newsize = (off_t)(offset + len);
|
||||
if (ret == 0 && sb.st_size < newsize)
|
||||
ret = ftruncate(fd_number(fo), newsize);
|
||||
#endif
|
||||
|
||||
fd_object_release(fo);
|
||||
|
|
Loading…
Reference in New Issue
Block a user