From 687238b79b06254238926d02739a5670d4d00c94 Mon Sep 17 00:00:00 2001 From: Alan Barr Date: Sat, 13 Oct 2018 16:49:41 +0100 Subject: [PATCH] Typecast void* before doing pointer arithmetic Caught by cppcheck --- libi3/safewrappers.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libi3/safewrappers.c b/libi3/safewrappers.c index 04bbda44..1802b327 100644 --- a/libi3/safewrappers.c +++ b/libi3/safewrappers.c @@ -70,7 +70,7 @@ ssize_t writeall(int fd, const void *buf, size_t count) { size_t written = 0; while (written < count) { - const ssize_t n = write(fd, buf + written, count - written); + const ssize_t n = write(fd, ((char *)buf) + written, count - written); if (n == -1) { if (errno == EINTR || errno == EAGAIN) continue; @@ -86,7 +86,7 @@ ssize_t writeall_nonblock(int fd, const void *buf, size_t count) { size_t written = 0; while (written < count) { - const ssize_t n = write(fd, buf + written, count - written); + const ssize_t n = write(fd, ((char *)buf) + written, count - written); if (n == -1) { if (errno == EAGAIN) { return written;