mirror of
https://github.com/apache/nuttx.git
synced 2026-06-04 23:03:27 +08:00
mm/circbuf: fix minor issue about update buffer head
update head pointer with skip before write buffer. Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
This commit is contained in:
@@ -526,6 +526,7 @@ ssize_t circbuf_overwrite(FAR struct circbuf_s *circ,
|
||||
overwrite = bytes - space + skip;
|
||||
}
|
||||
|
||||
circ->head += skip;
|
||||
off = circ->head % circ->size;
|
||||
space = circ->size - off;
|
||||
if (bytes < space)
|
||||
@@ -535,7 +536,7 @@ ssize_t circbuf_overwrite(FAR struct circbuf_s *circ,
|
||||
|
||||
memcpy((FAR char *)circ->base + off, src, space);
|
||||
memcpy(circ->base, (FAR char *)src + space, bytes - space);
|
||||
circ->head += bytes + skip;
|
||||
circ->head += bytes;
|
||||
circ->tail += overwrite;
|
||||
|
||||
return overwrite;
|
||||
|
||||
Reference in New Issue
Block a user