]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
include: fix void pointer arithmetics warnings
authorSami Kerola <kerolasa@iki.fi>
Sun, 10 Jun 2012 14:49:51 +0000 (16:49 +0200)
committerSami Kerola <kerolasa@iki.fi>
Mon, 11 Jun 2012 17:51:35 +0000 (19:51 +0200)
all-io.h:18:9: warning: pointer of type 'void *' used in arithmetic [-pedantic]
all-io.h:38:9: warning: pointer of type 'void *' used in arithmetic [-pedantic]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
include/all-io.h

index b79d702bd5460fe0e978e88e62f9c7973f5f2368..38a760ff6b42052e15e6c76ce764f74cbe02b095 100644 (file)
@@ -15,7 +15,7 @@ static inline int write_all(int fd, const void *buf, size_t count)
                if (tmp > 0) {
                        count -= tmp;
                        if (count)
-                               buf += tmp;
+                               buf = (void *) ((char *) buf + tmp);
                } else if (errno != EINTR && errno != EAGAIN)
                        return -1;
                if (errno == EAGAIN)    /* Try later, *sigh* */
@@ -35,7 +35,7 @@ static inline int fwrite_all(const void *ptr, size_t size,
                if (tmp > 0) {
                        nmemb -= tmp;
                        if (nmemb)
-                               ptr += (tmp * size);
+                               ptr = (void *) ((char *) ptr + (tmp * size));
                } else if (errno != EINTR && errno != EAGAIN)
                        return -1;
                if (errno == EAGAIN)    /* Try later, *sigh* */