diff options
author | Blue Swirl <blauwirbel@gmail.com> | 2009-06-13 08:44:31 +0000 |
---|---|---|
committer | Blue Swirl <blauwirbel@gmail.com> | 2009-06-13 08:44:31 +0000 |
commit | c5b76b381081680633e2e0a91216507430409fb2 (patch) | |
tree | 193b8be4f6c9dac6664e03c7cdcf2bce8eb3bf16 | |
parent | 487fefdb1e94098ea734cb10e9e17d5860dde2d1 (diff) |
Fix mingw32 build warnings
Work around buffer and ioctlsocket argument type signedness problems
Suppress a prototype which is unused on mingw32
Expand a macro to avoid warnings from some GCC versions
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
-rw-r--r-- | net.c | 8 | ||||
-rw-r--r-- | qemu-char.c | 6 | ||||
-rw-r--r-- | savevm.c | 2 | ||||
-rw-r--r-- | slirp/misc.c | 6 | ||||
-rw-r--r-- | slirp/socket.c | 7 | ||||
-rw-r--r-- | target-ppc/op_helper.c | 16 | ||||
-rw-r--r-- | vnc.c | 4 |
7 files changed, 37 insertions, 12 deletions
@@ -665,7 +665,9 @@ static const char *slirp_smb_export; #endif static VLANClientState *slirp_vc; +#ifndef _WIN32 static void slirp_smb(const char *exported_dir); +#endif static void slirp_redirection(Monitor *mon, const char *redir_str); int slirp_can_output(void) @@ -1505,7 +1507,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, (void *)buf, size, 0, (struct sockaddr *)&s->dgram_dst, sizeof(s->dgram_dst)); } @@ -1517,7 +1519,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 +1581,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 1c0c9f5dff..a63d860b83 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, (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; @@ -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/slirp/misc.c b/slirp/misc.c index 0137e75ed1..1391d491d7 100644 --- a/slirp/misc.c +++ b/slirp/misc.c @@ -778,7 +778,7 @@ fd_nonblock(int fd) { #ifdef FIONBIO #ifdef _WIN32 - long opt = 1; + unsigned long opt = 1; #else int opt = 1; #endif @@ -797,7 +797,11 @@ void fd_block(int fd) { #ifdef FIONBIO +#ifdef _WIN32 + unsigned long opt = 0; +#else int opt = 0; +#endif ioctlsocket(fd, FIONBIO, &opt); #else diff --git a/slirp/socket.c b/slirp/socket.c index 098132a1bb..82d026c703 100644 --- a/slirp/socket.c +++ b/slirp/socket.c @@ -474,7 +474,12 @@ sorecvfrom(struct socket *so) udp_detach(so); } else { /* A "normal" UDP packet */ struct mbuf *m; - int len, n; + int len; +#ifdef _WIN32 + unsigned long n; +#else + int n; +#endif if (!(m = m_get())) return; m->m_data += IF_MAXLINKHDR; diff --git a/target-ppc/op_helper.c b/target-ppc/op_helper.c index 56fab9cb06..94e530327a 100644 --- a/target-ppc/op_helper.c +++ b/target-ppc/op_helper.c @@ -1974,7 +1974,21 @@ target_ulong helper_dlmzb (target_ulong high, target_ulong low, uint32_t update_ SATCVT(sh, sb, int16_t, int8_t, INT8_MIN, INT8_MAX, 1, 1) SATCVT(sw, sh, int32_t, int16_t, INT16_MIN, INT16_MAX, 1, 1) SATCVT(sd, sw, int64_t, int32_t, INT32_MIN, INT32_MAX, 1, 1) -SATCVT(uh, ub, uint16_t, uint8_t, 0, UINT8_MAX, 0, 1) + +/* Work around gcc problems with the macro version */ +static always_inline uint8_t cvtuhub(uint16_t x, int *sat) +{ + uint8_t r; + + if (x > UINT8_MAX) { + r = UINT8_MAX; + *sat = 1; + } else { + r = x; + } + return r; +} +//SATCVT(uh, ub, uint16_t, uint8_t, 0, UINT8_MAX, 0, 1) SATCVT(uw, uh, uint32_t, uint16_t, 0, UINT16_MAX, 0, 1) SATCVT(ud, uw, uint64_t, uint32_t, 0, UINT32_MAX, 0, 1) SATCVT(sh, ub, int16_t, uint8_t, 0, UINT8_MAX, 1, 1) @@ -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, (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()); } |