From 229497871de3e7287cf85d5beab5aab7ec2adf74 Mon Sep 17 00:00:00 2001 From: Milan Broz Date: Sun, 3 Jan 2016 16:05:17 +0100 Subject: [PATCH] Fix write_lseek prototype and avoid using void in arithmetic warning. --- lib/internal.h | 2 +- lib/utils.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/internal.h b/lib/internal.h index 16368cb0..3d626c96 100644 --- a/lib/internal.h +++ b/lib/internal.h @@ -102,7 +102,7 @@ ssize_t write_buffer(int fd, const void *buf, size_t count); ssize_t read_buffer(int fd, void *buf, size_t count); ssize_t write_blockwise(int fd, int bsize, void *buf, size_t count); ssize_t read_blockwise(int fd, int bsize, void *buf, size_t count); -ssize_t write_lseek_blockwise(int fd, int bsize, char *buf, size_t count, off_t offset); +ssize_t write_lseek_blockwise(int fd, int bsize, void *buf, size_t count, off_t offset); ssize_t read_lseek_blockwise(int fd, int bsize, void *buf, size_t count, off_t offset); unsigned crypt_getpagesize(void); diff --git a/lib/utils.c b/lib/utils.c index 010c1f7c..7a52f558 100644 --- a/lib/utils.c +++ b/lib/utils.c @@ -224,7 +224,7 @@ out: * is implicitly included in the read/write offset, which can not be set to non-aligned * boundaries. Hence, we combine llseek with write. */ -ssize_t write_lseek_blockwise(int fd, int bsize, char *buf, size_t count, off_t offset) +ssize_t write_lseek_blockwise(int fd, int bsize, void *buf, size_t count, off_t offset) { char *frontPadBuf; void *frontPadBuf_base = NULL; @@ -263,7 +263,7 @@ ssize_t write_lseek_blockwise(int fd, int bsize, char *buf, size_t count, off_t if (r < 0 || r != bsize) goto out; - buf += innerCount; + buf = (char*)buf + innerCount; count -= innerCount; } @@ -309,7 +309,7 @@ ssize_t read_lseek_blockwise(int fd, int bsize, void *buf, size_t count, off_t o memcpy(buf, frontPadBuf + frontHang, innerCount); - buf += innerCount; + buf = (char*)buf + innerCount; count -= innerCount; }