From: Sami Liedes Date: Wed, 23 Feb 2011 00:03:13 +0000 (+0200) Subject: Fix compilation on non-32-bit platforms. X-Git-Tag: v1.0a7~18 X-Git-Url: https://git.htl-mechatronik.at/public/?a=commitdiff_plain;h=1d661de0943330b20a0b8dc938d17c0e742a2b89;p=sx%2Fsimavr.git Fix compilation on non-32-bit platforms. The addition of -Werror to the compilation flags broke building on 64-bit hosts because casts between pointers and integers of different sizes cause warnings on gcc -Wall. Fix this by always casting the pointers to intptr_t first. Signed-off-by: Sami Liedes --- diff --git a/simavr/sim/sim_io.c b/simavr/sim/sim_io.c index f3df7a5..2fa455b 100644 --- a/simavr/sim/sim_io.c +++ b/simavr/sim/sim_io.c @@ -24,6 +24,7 @@ #include #include #include +#include #include "sim_io.h" int @@ -81,7 +82,7 @@ _avr_io_mux_write( uint8_t v, void * param) { - int io = (int)param; + int io = (intptr_t)param; for (int i = 0; i < avr->io_shared_io[io].used; i++) { avr_io_write_t c = avr->io_shared_io[io].io[i].c; if (c) @@ -118,10 +119,10 @@ avr_register_io_write( avr->io_shared_io[no].used = 1; avr->io_shared_io[no].io[0].param = avr->io[a].w.param; avr->io_shared_io[no].io[0].c = avr->io[a].w.c; - avr->io[a].w.param = (void*)no; + avr->io[a].w.param = (void*)(intptr_t)no; avr->io[a].w.c = _avr_io_mux_write; } - int no = (int)avr->io[a].w.param; + int no = (intptr_t)avr->io[a].w.param; int d = avr->io_shared_io[no].used++; if (avr->io_shared_io[no].used > 4) { fprintf(stderr,