sim-card
/
qemu
Archived
10
0
Fork 0

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>
This commit is contained in:
Blue Swirl 2009-06-13 08:44:31 +00:00
parent 487fefdb1e
commit c5b76b3810
7 changed files with 37 additions and 12 deletions

8
net.c
View File

@ -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) {

View File

@ -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;

View File

@ -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)

View File

@ -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

View File

@ -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;

View File

@ -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)

4
vnc.c
View File

@ -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());
}