summaryrefslogtreecommitdiff
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
parenta6024d4bf8868b88eb516d7322e5739742a9c688 (diff)
downloadfuse-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.
-rw-r--r--lib/buffer.c12
-rw-r--r--lib/fuse_lowlevel.c2
-rw-r--r--lib/fuse_opt.c2
3 files changed, 8 insertions, 8 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)
diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c
index ec0daaf..c96e211 100644
--- a/lib/fuse_lowlevel.c
+++ b/lib/fuse_lowlevel.c
@@ -2566,7 +2566,7 @@ void fuse_session_process_buf_int(struct fuse_session *se,
mbuf = newmbuf;
tmpbuf = FUSE_BUFVEC_INIT(buf->size - write_header_size);
- tmpbuf.buf[0].mem = mbuf + write_header_size;
+ tmpbuf.buf[0].mem = (char *)mbuf + write_header_size;
res = fuse_ll_copy_from_pipe(&tmpbuf, &bufv);
err = -res;
diff --git a/lib/fuse_opt.c b/lib/fuse_opt.c
index 3d4a3dd..f6cae4f 100644
--- a/lib/fuse_opt.c
+++ b/lib/fuse_opt.c
@@ -232,7 +232,7 @@ static int process_opt(struct fuse_opt_context *ctx,
if (call_proc(ctx, arg, opt->value, iso) == -1)
return -1;
} else {
- void *var = ctx->data + opt->offset;
+ void *var = (char *)ctx->data + opt->offset;
if (sep && opt->templ[sep + 1]) {
const char *param = arg + sep;
if (opt->templ[sep] == '=')