提交 2d26512b 编写于 作者: S Stefan Weil 提交者: Jan Kiszka

slirp: Fix compiler warning for w64

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: NStefan Weil <sw@weilnetz.de>
Signed-off-by: NJan Kiszka <jan.kiszka@siemens.com>
上级 a68adc22
...@@ -75,7 +75,7 @@ int cksum(struct mbuf *m, int len) ...@@ -75,7 +75,7 @@ int cksum(struct mbuf *m, int len)
/* /*
* Force to even boundary. * Force to even boundary.
*/ */
if ((1 & (long) w) && (mlen > 0)) { if ((1 & (uintptr_t)w) && (mlen > 0)) {
REDUCE; REDUCE;
sum <<= 8; sum <<= 8;
s_util.c[0] = *(uint8_t *)w; s_util.c[0] = *(uint8_t *)w;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册