Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions core/iwasm/libraries/lib-wasi-threads/tid_allocator.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
#include "bh_log.h"

bh_static_assert(TID_MIN <= TID_MAX);
/* Some platforms, like Zephyr, have already defined MIN at this point */
#ifndef MIN
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#endif

bool
tid_allocator_init(TidAllocator *tid_allocator)
Expand Down
20 changes: 12 additions & 8 deletions core/shared/platform/zephyr/zephyr_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -594,8 +594,9 @@ os_preadv(os_file_handle handle, const struct __wasi_iovec_t *iov, int iovcnt,

total_read += bytes_read;

// If we read less than we asked for, stop reading
if (bytes_read < iov[i].buf_len) {
/* If we read less than we asked for, stop reading
bytes_read being a non-negative value was already checked */
if ((size_t)bytes_read < iov[i].buf_len) {
break;
}
}
Expand Down Expand Up @@ -630,8 +631,9 @@ os_pwritev(os_file_handle handle, const struct __wasi_ciovec_t *iov, int iovcnt,

total_written += bytes_written;

// If we wrote less than we asked for, stop writing
if (bytes_written < iov[i].buf_len) {
/* If we wrote less than we asked for, stop writing
bytes_read being a non-negative value was already checked */
if ((size_t)bytes_written < iov[i].buf_len) {
break;
}
}
Expand Down Expand Up @@ -660,8 +662,9 @@ os_readv(os_file_handle handle, const struct __wasi_iovec_t *iov, int iovcnt,

total_read += bytes_read;

// If we read less than we asked for, stop reading
if (bytes_read < iov[i].buf_len) {
/* If we read less than we asked for, stop reading
bytes_read being a non-negative value was already checked */
if ((size_t)bytes_read < iov[i].buf_len) {
break;
}
}
Expand Down Expand Up @@ -705,8 +708,9 @@ os_writev(os_file_handle handle, const struct __wasi_ciovec_t *iov, int iovcnt,

total_written += bytes_written;

// If we wrote less than we asked for, stop writing
if (bytes_written < iov[i].buf_len) {
/* If we wrote less than we asked for, stop writing
bytes_read being a non-negative value was already checked */
if ((size_t)bytes_written < iov[i].buf_len) {
break;
}
}
Expand Down
Loading