qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Weil <weil@mail.berlios.de>
To: QEMU Developers <qemu-devel@nongnu.org>
Subject: [Qemu-devel] [PATCH] Win32: Fix compiler warnings.
Date: Sat, 13 Jun 2009 12:44:48 +0200	[thread overview]
Message-ID: <1244889888-14860-1-git-send-email-weil@mail.berlios.de> (raw)

In Win32 API, the functions send, sendto and recv
expect a (const) char * buffer argument.

QEMU typically uses uint8_t * buffer arguments which must
be casted to avoid this warning from newer gcc versions:

warning: pointer targets in passing argument 2 of ‘sendto’ differ in signedness

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
---
 net.c       |    6 +++---
 qemu-char.c |    6 +++---
 savevm.c    |    2 +-
 vnc.c       |    4 ++--
 4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/net.c b/net.c
index 039f78b..e190865 100644
--- a/net.c
+++ b/net.c
@@ -1505,7 +1505,7 @@ static ssize_t net_socket_receive_dgram(VLANClientState *vc, const uint8_t *buf,
 {
     NetSocketState *s = vc->opaque;
 
-    return sendto(s->fd, buf, size, 0,
+    return sendto(s->fd, (const void *)buf, size, 0,
                   (struct sockaddr *)&s->dgram_dst, sizeof(s->dgram_dst));
 }
 
@@ -1517,7 +1517,7 @@ static void net_socket_send(void *opaque)
     uint8_t buf1[4096];
     const uint8_t *buf;
 
-    size = recv(s->fd, buf1, sizeof(buf1), 0);
+    size = recv(s->fd, (void *)buf1, sizeof(buf1), 0);
     if (size < 0) {
         err = socket_error();
         if (err != EWOULDBLOCK)
@@ -1579,7 +1579,7 @@ static void net_socket_send_dgram(void *opaque)
     NetSocketState *s = opaque;
     int size;
 
-    size = recv(s->fd, s->buf, sizeof(s->buf), 0);
+    size = recv(s->fd, (void *)s->buf, sizeof(s->buf), 0);
     if (size < 0)
         return;
     if (size == 0) {
diff --git a/qemu-char.c b/qemu-char.c
index 1c0c9f5..a8afe94 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -1708,7 +1708,7 @@ static int udp_chr_write(CharDriverState *chr, const uint8_t *buf, int len)
 {
     NetCharDriver *s = chr->opaque;
 
-    return sendto(s->fd, buf, len, 0,
+    return sendto(s->fd, (const void *)buf, len, 0,
                   (struct sockaddr *)&s->daddr, sizeof(struct sockaddr_in));
 }
 
@@ -1737,7 +1737,7 @@ static void udp_chr_read(void *opaque)
 
     if (s->max_size == 0)
         return;
-    s->bufcnt = recv(s->fd, s->buf, sizeof(s->buf), 0);
+    s->bufcnt = recv(s->fd, (void *)s->buf, sizeof(s->buf), 0);
     s->bufptr = s->bufcnt;
     if (s->bufcnt <= 0)
         return;
@@ -1913,7 +1913,7 @@ static void tcp_chr_read(void *opaque)
     len = sizeof(buf);
     if (len > s->max_size)
         len = s->max_size;
-    size = recv(s->fd, buf, len, 0);
+    size = recv(s->fd, (void *)buf, len, 0);
     if (size == 0) {
         /* connection closed */
         s->connected = 0;
diff --git a/savevm.c b/savevm.c
index cae7117..61edd7e 100644
--- a/savevm.c
+++ b/savevm.c
@@ -190,7 +190,7 @@ static int socket_get_buffer(void *opaque, uint8_t *buf, int64_t pos, int size)
     ssize_t len;
 
     do {
-        len = recv(s->fd, buf, size, 0);
+        len = recv(s->fd, (void *)buf, size, 0);
     } while (len == -1 && socket_error() == EINTR);
 
     if (len == -1)
diff --git a/vnc.c b/vnc.c
index dbbeb14..e1ca9f8 100644
--- a/vnc.c
+++ b/vnc.c
@@ -961,7 +961,7 @@ long vnc_client_write_buf(VncState *vs, const uint8_t *data, size_t datalen)
         }
     } else
 #endif /* CONFIG_VNC_TLS */
-        ret = send(vs->csock, data, datalen, 0);
+        ret = send(vs->csock, (const void *)data, datalen, 0);
     VNC_DEBUG("Wrote wire %p %zd -> %ld\n", data, datalen, ret);
     return vnc_client_io_error(vs, ret, socket_error());
 }
@@ -1066,7 +1066,7 @@ long vnc_client_read_buf(VncState *vs, uint8_t *data, size_t datalen)
         }
     } else
 #endif /* CONFIG_VNC_TLS */
-        ret = recv(vs->csock, data, datalen, 0);
+        ret = recv(vs->csock, (void *)data, datalen, 0);
     VNC_DEBUG("Read wire %p %zd -> %ld\n", data, datalen, ret);
     return vnc_client_io_error(vs, ret, socket_error());
 }
-- 
1.5.6.5

                 reply	other threads:[~2009-06-13 10:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1244889888-14860-1-git-send-email-weil@mail.berlios.de \
    --to=weil@mail.berlios.de \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).