aboutsummaryrefslogtreecommitdiff
path: root/lib/buffer.c
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2019-06-04 12:33:17 -0700
committerNikolaus Rath <Nikolaus@rath.org>2019-06-06 13:31:41 +0100
commit63c11456d48b156b33b8b16cd47759c0d406f5b9 (patch)
tree3bc8b85554865ab7d33ddf743c8e4571636ff9fb /lib/buffer.c
parenta6024d4bf8868b88eb516d7322e5739742a9c688 (diff)
downloadlibfuse-63c11456d48b156b33b8b16cd47759c0d406f5b9.tar.gz
Avoid pointer arithmetic with `void *`
The pointer operand to the binary `+` operator must be to a complete object type. Since we are working with byte sizes, use `char *` instead.
Diffstat (limited to 'lib/buffer.c')
-rw-r--r--lib/buffer.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/buffer.c b/lib/buffer.c
index 85309ac..5ab9b87 100644
--- a/lib/buffer.c
+++ b/lib/buffer.c
@@ -48,10 +48,10 @@ static ssize_t fuse_buf_write(const struct fuse_buf *dst, size_t dst_off,
while (len) {
if (dst->flags & FUSE_BUF_FD_SEEK) {
- res = pwrite(dst->fd, src->mem + src_off, len,
+ res = pwrite(dst->fd, (char *)src->mem + src_off, len,
dst->pos + dst_off);
} else {
- res = write(dst->fd, src->mem + src_off, len);
+ res = write(dst->fd, (char *)src->mem + src_off, len);
}
if (res == -1) {
if (!copied)
@@ -82,10 +82,10 @@ static ssize_t fuse_buf_read(const struct fuse_buf *dst, size_t dst_off,
while (len) {
if (src->flags & FUSE_BUF_FD_SEEK) {
- res = pread(src->fd, dst->mem + dst_off, len,
+ res = pread(src->fd, (char *)dst->mem + dst_off, len,
src->pos + src_off);
} else {
- res = read(src->fd, dst->mem + dst_off, len);
+ res = read(src->fd, (char *)dst->mem + dst_off, len);
}
if (res == -1) {
if (!copied)
@@ -232,8 +232,8 @@ static ssize_t fuse_buf_copy_one(const struct fuse_buf *dst, size_t dst_off,
int dst_is_fd = dst->flags & FUSE_BUF_IS_FD;
if (!src_is_fd && !dst_is_fd) {
- void *dstmem = dst->mem + dst_off;
- void *srcmem = src->mem + src_off;
+ char *dstmem = (char *)dst->mem + dst_off;
+ char *srcmem = (char *)src->mem + src_off;
if (dstmem != srcmem) {
if (dstmem + len <= srcmem || srcmem + len <= dstmem)