net/socket: Fix compiler warning (regression for MinGW)
Commit213fd5087e
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> (cherry picked from commit73062dfe6b
) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
This commit is contained in:
parent
61dea8e914
commit
d4413913e1
|
@ -131,9 +131,9 @@ static ssize_t net_socket_receive_dgram(NetClientState *nc, const uint8_t *buf,
|
||||||
ssize_t ret;
|
ssize_t ret;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
ret = sendto(s->fd, buf, size, 0,
|
ret = qemu_sendto(s->fd, buf, size, 0,
|
||||||
(struct sockaddr *)&s->dgram_dst,
|
(struct sockaddr *)&s->dgram_dst,
|
||||||
sizeof(s->dgram_dst));
|
sizeof(s->dgram_dst));
|
||||||
} while (ret == -1 && errno == EINTR);
|
} while (ret == -1 && errno == EINTR);
|
||||||
|
|
||||||
if (ret == -1 && errno == EAGAIN) {
|
if (ret == -1 && errno == EAGAIN) {
|
||||||
|
|
|
@ -223,9 +223,14 @@ int qemu_pipe(int pipefd[2]);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
#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_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
|
#else
|
||||||
#define qemu_recv(sockfd, buf, len, flags) recv(sockfd, buf, len, flags)
|
#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
|
#endif
|
||||||
|
|
||||||
/* Error handling. */
|
/* Error handling. */
|
||||||
|
|
Loading…
Reference in New Issue