diff --git a/lib/lws-plat-win.c b/lib/lws-plat-win.c index b33f79c25..0a7124a0a 100644 --- a/lib/lws-plat-win.c +++ b/lib/lws-plat-win.c @@ -140,7 +140,7 @@ lws_plat_service(struct libwebsocket_context *context, int timeout_ms) return -1; } - pfd->revents = networkevents.lNetworkEvents; + pfd->revents = (SHORT)networkevents.lNetworkEvents; if (pfd->revents & LWS_POLLOUT) context->lws_lookup[pfd->fd]->sock_send_blocking = FALSE; diff --git a/lib/output.c b/lib/output.c index cd8da351e..04a9a7f1d 100644 --- a/lib/output.c +++ b/lib/output.c @@ -342,7 +342,7 @@ LWS_VISIBLE int libwebsocket_write(struct libwebsocket *wsi, unsigned char *buf, /* reason codes count as data bytes */ buf -= 2; buf[0] = wsi->u.ws.close_reason >> 8; - buf[1] = wsi->u.ws.close_reason; + buf[1] = (unsigned char)wsi->u.ws.close_reason; len += 2; } break; diff --git a/test-server/test-fraggle.c b/test-server/test-fraggle.c index f2ea1e01a..0c5853b40 100644 --- a/test-server/test-fraggle.c +++ b/test-server/test-fraggle.c @@ -185,9 +185,9 @@ callback_fraggle(struct libwebsocket_context *context, psf->total_message, psf->sum); bp[0] = psf->sum >> 24; - bp[1] = psf->sum >> 16; - bp[2] = psf->sum >> 8; - bp[3] = psf->sum; + bp[1] = 0xff & (psf->sum >> 16); + bp[2] = 0xff & (psf->sum >> 8); + bp[3] = 0xff & (psf->sum); n = libwebsocket_write(wsi, (unsigned char *)bp, 4, LWS_WRITE_BINARY); diff --git a/test-server/test-ping.c b/test-server/test-ping.c index fb7bff5b9..0d5291d3a 100644 --- a/test-server/test-ping.c +++ b/test-server/test-ping.c @@ -226,7 +226,7 @@ callback_lws_mirror(struct libwebsocket_context * this, /* 64-bit ping index in network byte order */ while (shift >= 0) { - *p++ = psd->ping_index >> shift; + *p++ = (unsigned char)psd->ping_index >> shift; shift -= 8; } @@ -375,7 +375,7 @@ int main(int argc, char **argv) protocols[PROTOCOL_LWS_MIRROR].name = protocol_name; break; case 'i': - interval_us = 1000000.0 * atof(optarg); + interval_us = (unsigned int)(1000000.0 * atof(optarg)); break; case 's': size = atoi(optarg);