From dd922bedb7c3e85fbbe1eed10e371aec47138a1d Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Tue, 18 Aug 2009 15:23:35 +0200 Subject: [PATCH] build: don't perform arithmetic on void* pointers * src/guestfs.c (receive_file_data_sync, xread, xwrite): Use char*. --- src/guestfs.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/guestfs.c b/src/guestfs.c index 1cd4f9e..6eae692 100644 --- a/src/guestfs.c +++ b/src/guestfs.c @@ -540,8 +540,9 @@ guestfs_safe_memdup (guestfs_h *g, void *ptr, size_t size) } static int -xwrite (int fd, const void *buf, size_t len) +xwrite (int fd, const void *v_buf, size_t len) { + const char *buf = v_buf; int r; while (len > 0) { @@ -557,8 +558,9 @@ xwrite (int fd, const void *buf, size_t len) } static int -xread (int fd, void *buf, size_t len) +xread (int fd, void *v_buf, size_t len) { + char *buf = v_buf; int r; while (len > 0) { @@ -2515,7 +2517,7 @@ receive_file_data_sync (guestfs_h *g, void **buf, size_t *len_r) if (buf) { *buf = safe_realloc (g, *buf, len + ctx.chunks[i].data.data_len); - memcpy (*buf+len, ctx.chunks[i].data.data_val, + memcpy (((char *)*buf)+len, ctx.chunks[i].data.data_val, ctx.chunks[i].data.data_len); } len += ctx.chunks[i].data.data_len; -- 1.8.3.1