[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-trivial] [PATCH v2] net/socket: Fix compiler warning (regression f
From: |
Stefan Weil |
Subject: |
[Qemu-trivial] [PATCH v2] net/socket: Fix compiler warning (regression for MinGW) |
Date: |
Sat, 22 Sep 2012 19:21:22 +0200 |
Add a type cast which was removed by commit
213fd5087e2e4e2da10ad266df0ba950cf7618bf again.
Without it, MinGW compilers complain:
net/socket.c:136: warning:
pointer targets in passing argument 2 of ‘sendto’ differ in signedness
/usr/lib/gcc/amd64-mingw32msvc/4.4.4/../../../../amd64-mingw32msvc/include/winsock2.h:1313:
note:
expected ‘const char *’ but argument is of type ‘const uint8_t *’
Signed-off-by: Stefan Weil <address@hidden>
---
v2:
Add comment which explains that the type cast is needed for MinGW.
MinGW tries to be compatible with Microsoft's prototypes here
(and those are _not_ POSIX).
Regards
Stefan
net/socket.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/socket.c b/net/socket.c
index 69aad03..2fefa2e 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -131,7 +131,8 @@ static ssize_t net_socket_receive_dgram(NetClientState *nc,
const uint8_t *buf,
ssize_t ret;
do {
- ret = sendto(s->fd, buf, size, 0,
+ /* MinGW's sendto is not POSIX and needs the type cast for buf! */
+ ret = sendto(s->fd, (const void *)buf, size, 0,
(struct sockaddr *)&s->dgram_dst,
sizeof(s->dgram_dst));
} while (ret == -1 && errno == EINTR);
--
1.7.10
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemu-trivial] [PATCH v2] net/socket: Fix compiler warning (regression for MinGW),
Stefan Weil <=