From 453a8713244880962cd4489e133bfde590ddc576 Mon Sep 17 00:00:00 2001 From: Jenny Wong Date: Thu, 6 Aug 2015 10:02:35 -0700 Subject: [PATCH] Fix void* arithmetic warning (-Wpointer-arith) https://gcc.gnu.org/onlinedocs/gcc/Pointer-Arith.html gcc will assume sizeof(void) == 1 when doing pointer arithmetic on void*s, but other compilers may not. --- src/network.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/network.c b/src/network.c index 91690006..84e13a90 100644 --- a/src/network.c +++ b/src/network.c @@ -1368,7 +1368,7 @@ static int parse_part_encr_aes256 (sockent_t *se, /* {{{ */ warning_has_been_printed = 1; } - *ret_buffer += ph_length; + *ret_buffer = (void *) (((char *) *ret_buffer) + ph_length); *ret_buffer_size -= ph_length; return (0); @@ -1407,7 +1407,7 @@ static int parse_packet (sockent_t *se, /* {{{ */ (void *) buffer, sizeof (pkg_type)); memcpy ((void *) &pkg_length, - (void *) (buffer + sizeof (pkg_type)), + (void *) (((char *) buffer) + sizeof (pkg_type)), sizeof (pkg_length)); pkg_length = ntohs (pkg_length); -- 2.11.0