提交 7f4e6479 编写于 作者: B Bernard Xiong

Merge remote-tracking branch 'upstream/master'

......@@ -234,7 +234,11 @@ int fd_is_open(const char *pathname)
mountpath = fullpath + strlen(fs->path);
dfs_lock();
#ifdef DFS_USING_STDIO
for (index = 3; index < DFS_FD_MAX+3; index++)
#else
for (index = 0; index < DFS_FD_MAX; index++)
#endif
{
fd = &(fd_table[index]);
if (fd->fs == RT_NULL)
......
......@@ -100,13 +100,13 @@ rt_size_t rt_ringbuffer_put_force(struct rt_ringbuffer *rb,
const rt_uint8_t *ptr,
rt_uint16_t length)
{
enum rt_ringbuffer_state old_state;
rt_uint16_t space_length;
RT_ASSERT(rb != RT_NULL);
old_state = rt_ringbuffer_status(rb);
space_length = rt_ringbuffer_space_len(rb);
if (length > rb->buffer_size)
if (length > space_length)
length = rb->buffer_size;
if (rb->buffer_size - rb->write_index > length)
......@@ -117,7 +117,7 @@ rt_size_t rt_ringbuffer_put_force(struct rt_ringbuffer *rb,
* length of data in current mirror */
rb->write_index += length;
if (old_state == RT_RINGBUFFER_FULL)
if (length > space_length)
rb->read_index = rb->write_index;
return length;
......@@ -134,7 +134,7 @@ rt_size_t rt_ringbuffer_put_force(struct rt_ringbuffer *rb,
rb->write_mirror = ~rb->write_mirror;
rb->write_index = length - (rb->buffer_size - rb->write_index);
if (old_state == RT_RINGBUFFER_FULL)
if (length > space_length)
{
rb->read_mirror = ~rb->read_mirror;
rb->read_index = rb->write_index;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册