Received: from eggs.gnu.org ([208.118.235.92]:59790) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S7OOg-00078I-HZ for qemu-devel@nongnu.org; Tue, 13 Mar 2012 05:52:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S7OOE-0001ny-MP for qemu-devel@nongnu.org; Tue, 13 Mar 2012 05:52:02 -0400 Message-ID: <4F5F18A0.8080700@siemens.com> Date: Tue, 13 Mar 2012 10:51:28 +0100 From: Jan Kiszka MIME-Version: 1.0 References: <1331410853-23217-1-git-send-email-sw@weilnetz.de> In-Reply-To: <1331410853-23217-1-git-send-email-sw@weilnetz.de> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] slirp: Fix compiler warning for w64 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Weil Cc: qemu-trivial , "qemu-devel@nongnu.org" On 2012-03-10 21:20, Stefan Weil wrote: > Casting a pointer to an integer value must use uintptr_t or intptr_t > (not long) for portable code. MinGW-w64 requires this because > sizeof(long) != sizeof(void *) for w64 hosts, so casting to long > raises a compiler warning. > > I use uintptr_t instead of intptr_t because changing the sign does not > matter here and casting pointers to unsigned values seems more > reasonable (the unsigned value is a non negative offset. > > Cc: Jan Kiszka > Signed-off-by: Stefan Weil > --- > slirp/cksum.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/slirp/cksum.c b/slirp/cksum.c > index e43867d..6328660 100644 > --- a/slirp/cksum.c > +++ b/slirp/cksum.c > @@ -75,7 +75,7 @@ int cksum(struct mbuf *m, int len) > /* > * Force to even boundary. > */ > - if ((1 & (long) w) && (mlen > 0)) { > + if ((1 & (uintptr_t)w) && (mlen > 0)) { > REDUCE; > sum <<= 8; > s_util.c[0] = *(uint8_t *)w; Thanks, I picked this up for the slirp queue for which I will send a pull request later today. Jan -- Siemens AG, Corporate Technology, CT T DE IT 1 Corporate Competence Center Embedded Linux