aboutsummaryrefslogtreecommitdiff
path: root/qemu-common.h
diff options
context:
space:
mode:
authorStefan Weil <sw@weilnetz.de>2012-09-22 21:13:28 +0200
committerStefan Hajnoczi <stefanha@gmail.com>2012-09-23 07:37:41 +0100
commit73062dfe6be0050dbd43ce3516e935ebb2545add (patch)
tree5127bbaa8b51c71100b1bc34edb90b6b9d3fa606 /qemu-common.h
parentad11ad77748bdd8016370db210751683dc038dd6 (diff)
net/socket: Fix compiler warning (regression for MinGW)
Commit 213fd5087e2e4e2da10ad266df0ba950cf7618bf removed a type cast which is needed for MinGW: 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 *’ Add a 'qemu_sendto' macro which provides that type cast where needed and use the new macro instead of 'sendto'. Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Diffstat (limited to 'qemu-common.h')
-rw-r--r--qemu-common.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/qemu-common.h b/qemu-common.h
index e5c2bcd204..15d9e4ed71 100644
--- a/qemu-common.h
+++ b/qemu-common.h
@@ -223,9 +223,14 @@ int qemu_pipe(int pipefd[2]);
#endif
#ifdef _WIN32
+/* MinGW needs a type cast for the 'buf' argument. */
#define qemu_recv(sockfd, buf, len, flags) recv(sockfd, (void *)buf, len, flags)
+#define qemu_sendto(sockfd, buf, len, flags, destaddr, addrlen) \
+ sendto(sockfd, (const void *)buf, len, flags, destaddr, addrlen)
#else
#define qemu_recv(sockfd, buf, len, flags) recv(sockfd, buf, len, flags)
+#define qemu_sendto(sockfd, buf, len, flags, destaddr, addrlen) \
+ sendto(sockfd, buf, len, flags, destaddr, addrlen)
#endif
/* Error handling. */