From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:60177) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TFV8v-0007e0-90 for qemu-devel@nongnu.org; Sat, 22 Sep 2012 15:13:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TFV8u-0006dQ-17 for qemu-devel@nongnu.org; Sat, 22 Sep 2012 15:13:33 -0400 From: Stefan Weil Date: Sat, 22 Sep 2012 21:13:28 +0200 Message-Id: <1348341208-23260-1-git-send-email-sw@weilnetz.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH] net/socket: Fix compiler warning (regression for MinGW) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Blue Swirl , qemu-trivial@nongnu.org, qemu-devel@nongnu.org, Stefan Weil Commit 213fd5087e2e4e2da10ad266df0ba950cf7618bf removed a type cast which is needed for MinGW: net/socket.c:136: warning: pointer targets in passing argument 2 of =E2=80=98sendto=E2=80=99 differ= in signedness /usr/lib/gcc/amd64-mingw32msvc/4.4.4/../../../../amd64-mingw32msvc/includ= e/winsock2.h:1313: note: expected =E2=80=98const char *=E2=80=99 but argument is of type =E2=80=98= const uint8_t *=E2=80=99 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 --- I hope the modifications are trivial enough to justify that I did not split this in two patches. =20 Regards Stefan W. net/socket.c | 6 +++--- qemu-common.h | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/net/socket.c b/net/socket.c index 69aad03..ce4f980 100644 --- a/net/socket.c +++ b/net/socket.c @@ -131,9 +131,9 @@ static ssize_t net_socket_receive_dgram(NetClientStat= e *nc, const uint8_t *buf, ssize_t ret; =20 do { - ret =3D sendto(s->fd, buf, size, 0, - (struct sockaddr *)&s->dgram_dst, - sizeof(s->dgram_dst)); + ret =3D qemu_sendto(s->fd, buf, size, 0, + (struct sockaddr *)&s->dgram_dst, + sizeof(s->dgram_dst)); } while (ret =3D=3D -1 && errno =3D=3D EINTR); =20 if (ret =3D=3D -1 && errno =3D=3D EAGAIN) { diff --git a/qemu-common.h b/qemu-common.h index 2f00c15..4f0ed9e 100644 --- a/qemu-common.h +++ b/qemu-common.h @@ -225,9 +225,14 @@ int qemu_pipe(int pipefd[2]); #endif =20 #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 =20 /* Error handling. */ --=20 1.7.10