summaryrefslogtreecommitdiff
path: root/components/drivers/src
diff options
context:
space:
mode:
authorheyuanjie <[email protected]>2018-05-02 09:47:57 +0800
committerheyuanjie <[email protected]>2018-05-02 09:47:57 +0800
commit313920126ba1bfaa7fb833860536c03f78f436fb (patch)
tree54b011f26104ae478323cc33709e9f9622023662 /components/drivers/src
parentaa86f7f7bb78443780a71486a66c2f339243484f (diff)
parent795f9873ccd1fc71497d5c2d96fb870ea17fe67b (diff)
Merge branch 'master' of https://github.com/RT-Thread/rt-thread into imx1050
Diffstat (limited to 'components/drivers/src')
-rw-r--r--components/drivers/src/pipe.c4
-rw-r--r--components/drivers/src/ringbuffer.c5
2 files changed, 6 insertions, 3 deletions
diff --git a/components/drivers/src/pipe.c b/components/drivers/src/pipe.c
index 61b8a5db6b..ee9c8ba02a 100644
--- a/components/drivers/src/pipe.c
+++ b/components/drivers/src/pipe.c
@@ -358,7 +358,7 @@ rt_err_t rt_pipe_close (rt_device_t device)
rt_size_t rt_pipe_read (rt_device_t device, rt_off_t pos, void *buffer, rt_size_t count)
{
uint8_t *pbuf;
- int read_bytes = 0;
+ rt_size_t read_bytes = 0;
rt_pipe_t *pipe = (rt_pipe_t *)device;
if (device == RT_NULL)
@@ -386,7 +386,7 @@ rt_size_t rt_pipe_read (rt_device_t device, rt_off_t pos, void *buffer, rt_siz
rt_size_t rt_pipe_write (rt_device_t device, rt_off_t pos, const void *buffer, rt_size_t count)
{
uint8_t *pbuf;
- int write_bytes = 0;
+ rt_size_t write_bytes = 0;
rt_pipe_t *pipe = (rt_pipe_t *)device;
if (device == RT_NULL)
diff --git a/components/drivers/src/ringbuffer.c b/components/drivers/src/ringbuffer.c
index baeeea0e50..48bf590f8c 100644
--- a/components/drivers/src/ringbuffer.c
+++ b/components/drivers/src/ringbuffer.c
@@ -119,8 +119,11 @@ rt_size_t rt_ringbuffer_put_force(struct rt_ringbuffer *rb,
space_length = rt_ringbuffer_space_len(rb);
- if (length > space_length)
+ if (length > rb->buffer_size)
+ {
+ ptr = &ptr[length - rb->buffer_size];
length = rb->buffer_size;
+ }
if (rb->buffer_size - rb->write_index > length)
{