#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)
{
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));
}
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)
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) {
{
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));
}
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;
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;
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)
{
#ifdef FIONBIO
#ifdef _WIN32
- long opt = 1;
+ unsigned long opt = 1;
#else
int opt = 1;
#endif
fd_block(int fd)
{
#ifdef FIONBIO
+#ifdef _WIN32
+ unsigned long opt = 0;
+#else
int opt = 0;
+#endif
ioctlsocket(fd, FIONBIO, &opt);
#else
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;
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)
}
} 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());
}
}
} 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());
}