diff options
| author | Tangyuxin <[email protected]> | 2022-09-20 22:31:11 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-09-20 10:31:11 -0400 |
| commit | a4829b1c004015cca489679cc335b6089aa9da31 (patch) | |
| tree | 3e346e76bb1c77b5b189ca28b053daeaea5154e9 /components/drivers/ipc | |
| parent | 746d7a01bdb29c692b696780f938f11253ae1103 (diff) | |
[fix] Fix simulator compilation warnings (#6438)
* [fix] Fix simulator compilation warnings
* Update bsp/simulator/rtconfig_project.h
Co-authored-by: Man, Jianting (Meco) <[email protected]>
Diffstat (limited to 'components/drivers/ipc')
| -rw-r--r-- | components/drivers/ipc/pipe.c | 4 | ||||
| -rw-r--r-- | components/drivers/ipc/ringbuffer.c | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/components/drivers/ipc/pipe.c b/components/drivers/ipc/pipe.c index d7b6c373eb..5483ffa549 100644 --- a/components/drivers/ipc/pipe.c +++ b/components/drivers/ipc/pipe.c @@ -497,7 +497,7 @@ static rt_size_t rt_pipe_read(rt_device_t device, rt_off_t pos, void *buffer, rt while (read_bytes < count) { - int len = rt_ringbuffer_get(pipe->fifo, &pbuf[read_bytes], count - read_bytes); + int len = rt_ringbuffer_get(pipe->fifo, &pbuf[read_bytes], (rt_uint16_t)(count - read_bytes)); if (len <= 0) break; read_bytes += len; @@ -539,7 +539,7 @@ static rt_size_t rt_pipe_write(rt_device_t device, rt_off_t pos, const void *buf while (write_bytes < count) { - int len = rt_ringbuffer_put(pipe->fifo, &pbuf[write_bytes], count - write_bytes); + int len = rt_ringbuffer_put(pipe->fifo, &pbuf[write_bytes], (rt_uint16_t)(count - write_bytes)); if (len <= 0) break; write_bytes += len; diff --git a/components/drivers/ipc/ringbuffer.c b/components/drivers/ipc/ringbuffer.c index fc9e15f996..90632f5884 100644 --- a/components/drivers/ipc/ringbuffer.c +++ b/components/drivers/ipc/ringbuffer.c @@ -192,7 +192,7 @@ rt_size_t rt_ringbuffer_get(struct rt_ringbuffer *rb, /* less data */ if (size < length) - length = size; + length = (rt_uint16_t)size; if (rb->buffer_size - rb->read_index > length) { @@ -248,7 +248,7 @@ rt_size_t rt_ringbuffer_peek(struct rt_ringbuffer *rb, rt_uint8_t **ptr) if ((rt_size_t)(rb->buffer_size - rb->read_index) > size) { - rb->read_index += size; + rb->read_index += (rt_uint16_t)size; return size; } |
