mm/circbuf.c: Fix incorrect usage of void* arithmetics

This commit is contained in:
Ville Juven 2022-11-23 12:37:27 +02:00 committed by Xiang Xiao
parent 4781379ee2
commit 39a567db20
1 changed files with 7 additions and 7 deletions

View File

@ -320,8 +320,8 @@ ssize_t circbuf_peekat(FAR struct circbuf_s *circ, size_t pos,
len = bytes;
}
memcpy(dst, circ->base + off, len);
memcpy(dst + len, circ->base, bytes - len);
memcpy(dst, (FAR char *)circ->base + off, len);
memcpy((FAR char *)dst + len, circ->base, bytes - len);
return bytes;
}
@ -468,8 +468,8 @@ ssize_t circbuf_write(FAR struct circbuf_s *circ,
space = bytes;
}
memcpy(circ->base + off, src, space);
memcpy(circ->base, src + space, bytes - space);
memcpy((FAR char *)circ->base + off, src, space);
memcpy(circ->base, (FAR char *)src + space, bytes - space);
circ->head += bytes;
return bytes;
@ -514,7 +514,7 @@ ssize_t circbuf_overwrite(FAR struct circbuf_s *circ,
if (bytes > circ->size)
{
src += bytes - circ->size;
src = (FAR const void *)((FAR char *)src + bytes - circ->size);
bytes = circ->size;
}
@ -531,8 +531,8 @@ ssize_t circbuf_overwrite(FAR struct circbuf_s *circ,
space = bytes;
}
memcpy(circ->base + off, src, space);
memcpy(circ->base, src + space, bytes - space);
memcpy((FAR char *)circ->base + off, src, space);
memcpy(circ->base, (FAR char *)src + space, bytes - space);
circ->head += bytes;
circ->tail += overwrite;