qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Stefan Weil <sw@weilnetz.de>
Cc: qemu-trivial <qemu-trivial@nongnu.org>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] slirp: Fix compiler warning for w64
Date: Tue, 13 Mar 2012 10:51:28 +0100	[thread overview]
Message-ID: <4F5F18A0.8080700@siemens.com> (raw)
In-Reply-To: <1331410853-23217-1-git-send-email-sw@weilnetz.de>

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 <jan.kiszka@siemens.com>
> Signed-off-by: Stefan Weil <sw@weilnetz.de>
> ---
>  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

      reply	other threads:[~2012-03-13  9:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-10 20:20 [Qemu-devel] [PATCH] slirp: Fix compiler warning for w64 Stefan Weil
2012-03-13  9:51 ` Jan Kiszka [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F5F18A0.8080700@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=sw@weilnetz.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).