Commit c5b76b381081680633e2e0a91216507430409fb2

Authored by Blue Swirl
1 parent 487fefdb

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>
... ... @@ -665,7 +665,9 @@ static const char *slirp_smb_export;
665 665 #endif
666 666 static VLANClientState *slirp_vc;
667 667  
  668 +#ifndef _WIN32
668 669 static void slirp_smb(const char *exported_dir);
  670 +#endif
669 671 static void slirp_redirection(Monitor *mon, const char *redir_str);
670 672  
671 673 int slirp_can_output(void)
... ... @@ -1505,7 +1507,7 @@ static ssize_t net_socket_receive_dgram(VLANClientState *vc, const uint8_t *buf,
1505 1507 {
1506 1508 NetSocketState *s = vc->opaque;
1507 1509  
1508   - return sendto(s->fd, buf, size, 0,
  1510 + return sendto(s->fd, (void *)buf, size, 0,
1509 1511 (struct sockaddr *)&s->dgram_dst, sizeof(s->dgram_dst));
1510 1512 }
1511 1513  
... ... @@ -1517,7 +1519,7 @@ static void net_socket_send(void *opaque)
1517 1519 uint8_t buf1[4096];
1518 1520 const uint8_t *buf;
1519 1521  
1520   - size = recv(s->fd, buf1, sizeof(buf1), 0);
  1522 + size = recv(s->fd, (void *)buf1, sizeof(buf1), 0);
1521 1523 if (size < 0) {
1522 1524 err = socket_error();
1523 1525 if (err != EWOULDBLOCK)
... ... @@ -1579,7 +1581,7 @@ static void net_socket_send_dgram(void *opaque)
1579 1581 NetSocketState *s = opaque;
1580 1582 int size;
1581 1583  
1582   - size = recv(s->fd, s->buf, sizeof(s->buf), 0);
  1584 + size = recv(s->fd, (void *)s->buf, sizeof(s->buf), 0);
1583 1585 if (size < 0)
1584 1586 return;
1585 1587 if (size == 0) {
... ...
qemu-char.c
... ... @@ -1708,7 +1708,7 @@ static int udp_chr_write(CharDriverState *chr, const uint8_t *buf, int len)
1708 1708 {
1709 1709 NetCharDriver *s = chr->opaque;
1710 1710  
1711   - return sendto(s->fd, buf, len, 0,
  1711 + return sendto(s->fd, (void *)buf, len, 0,
1712 1712 (struct sockaddr *)&s->daddr, sizeof(struct sockaddr_in));
1713 1713 }
1714 1714  
... ... @@ -1737,7 +1737,7 @@ static void udp_chr_read(void *opaque)
1737 1737  
1738 1738 if (s->max_size == 0)
1739 1739 return;
1740   - s->bufcnt = recv(s->fd, s->buf, sizeof(s->buf), 0);
  1740 + s->bufcnt = recv(s->fd, (void *)s->buf, sizeof(s->buf), 0);
1741 1741 s->bufptr = s->bufcnt;
1742 1742 if (s->bufcnt <= 0)
1743 1743 return;
... ... @@ -1913,7 +1913,7 @@ static void tcp_chr_read(void *opaque)
1913 1913 len = sizeof(buf);
1914 1914 if (len > s->max_size)
1915 1915 len = s->max_size;
1916   - size = recv(s->fd, buf, len, 0);
  1916 + size = recv(s->fd, (void *)buf, len, 0);
1917 1917 if (size == 0) {
1918 1918 /* connection closed */
1919 1919 s->connected = 0;
... ...
savevm.c
... ... @@ -190,7 +190,7 @@ static int socket_get_buffer(void *opaque, uint8_t *buf, int64_t pos, int size)
190 190 ssize_t len;
191 191  
192 192 do {
193   - len = recv(s->fd, buf, size, 0);
  193 + len = recv(s->fd, (void *)buf, size, 0);
194 194 } while (len == -1 && socket_error() == EINTR);
195 195  
196 196 if (len == -1)
... ...
slirp/misc.c
... ... @@ -778,7 +778,7 @@ fd_nonblock(int fd)
778 778 {
779 779 #ifdef FIONBIO
780 780 #ifdef _WIN32
781   - long opt = 1;
  781 + unsigned long opt = 1;
782 782 #else
783 783 int opt = 1;
784 784 #endif
... ... @@ -797,7 +797,11 @@ void
797 797 fd_block(int fd)
798 798 {
799 799 #ifdef FIONBIO
  800 +#ifdef _WIN32
  801 + unsigned long opt = 0;
  802 +#else
800 803 int opt = 0;
  804 +#endif
801 805  
802 806 ioctlsocket(fd, FIONBIO, &opt);
803 807 #else
... ...
slirp/socket.c
... ... @@ -474,7 +474,12 @@ sorecvfrom(struct socket *so)
474 474 udp_detach(so);
475 475 } else { /* A "normal" UDP packet */
476 476 struct mbuf *m;
477   - int len, n;
  477 + int len;
  478 +#ifdef _WIN32
  479 + unsigned long n;
  480 +#else
  481 + int n;
  482 +#endif
478 483  
479 484 if (!(m = m_get())) return;
480 485 m->m_data += IF_MAXLINKHDR;
... ...
target-ppc/op_helper.c
... ... @@ -1974,7 +1974,21 @@ target_ulong helper_dlmzb (target_ulong high, target_ulong low, uint32_t update_
1974 1974 SATCVT(sh, sb, int16_t, int8_t, INT8_MIN, INT8_MAX, 1, 1)
1975 1975 SATCVT(sw, sh, int32_t, int16_t, INT16_MIN, INT16_MAX, 1, 1)
1976 1976 SATCVT(sd, sw, int64_t, int32_t, INT32_MIN, INT32_MAX, 1, 1)
1977   -SATCVT(uh, ub, uint16_t, uint8_t, 0, UINT8_MAX, 0, 1)
  1977 +
  1978 +/* Work around gcc problems with the macro version */
  1979 +static always_inline uint8_t cvtuhub(uint16_t x, int *sat)
  1980 +{
  1981 + uint8_t r;
  1982 +
  1983 + if (x > UINT8_MAX) {
  1984 + r = UINT8_MAX;
  1985 + *sat = 1;
  1986 + } else {
  1987 + r = x;
  1988 + }
  1989 + return r;
  1990 +}
  1991 +//SATCVT(uh, ub, uint16_t, uint8_t, 0, UINT8_MAX, 0, 1)
1978 1992 SATCVT(uw, uh, uint32_t, uint16_t, 0, UINT16_MAX, 0, 1)
1979 1993 SATCVT(ud, uw, uint64_t, uint32_t, 0, UINT32_MAX, 0, 1)
1980 1994 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)
961 961 }
962 962 } else
963 963 #endif /* CONFIG_VNC_TLS */
964   - ret = send(vs->csock, data, datalen, 0);
  964 + ret = send(vs->csock, (void *)data, datalen, 0);
965 965 VNC_DEBUG("Wrote wire %p %zd -> %ld\n", data, datalen, ret);
966 966 return vnc_client_io_error(vs, ret, socket_error());
967 967 }
... ... @@ -1066,7 +1066,7 @@ long vnc_client_read_buf(VncState *vs, uint8_t *data, size_t datalen)
1066 1066 }
1067 1067 } else
1068 1068 #endif /* CONFIG_VNC_TLS */
1069   - ret = recv(vs->csock, data, datalen, 0);
  1069 + ret = recv(vs->csock, (void *)data, datalen, 0);
1070 1070 VNC_DEBUG("Read wire %p %zd -> %ld\n", data, datalen, ret);
1071 1071 return vnc_client_io_error(vs, ret, socket_error());
1072 1072 }
... ...