diff --git a/lib/client.c b/lib/client.c index 2b9a943cc..7d78a0c7f 100755 --- a/lib/client.c +++ b/lib/client.c @@ -23,7 +23,7 @@ int lws_handshake_client(struct libwebsocket *wsi, unsigned char **buf, size_t len) { - int n; + size_t n; switch (wsi->mode) { case LWS_CONNMODE_WS_CLIENT_WAITING_PROXY_REPLY: diff --git a/lib/handshake.c b/lib/handshake.c index d81c1d290..9fdd9c639 100644 --- a/lib/handshake.c +++ b/lib/handshake.c @@ -116,7 +116,7 @@ http_postbody: * what we have in the read buffer (len) * remaining portion of the POST body (content_remain) */ - body_chunk_len = min(wsi->u.http.content_remain,len); + body_chunk_len = min(wsi->u.http.content_remain,(int)len); wsi->u.http.content_remain -= body_chunk_len; len -= body_chunk_len; diff --git a/lib/output.c b/lib/output.c index 04a9a7f1d..4373c30b2 100644 --- a/lib/output.c +++ b/lib/output.c @@ -46,9 +46,9 @@ libwebsocket_0405_frame_mask_generate(struct libwebsocket *wsi) LWS_VISIBLE void lwsl_hexdump(void *vbuf, size_t len) { - int n; - int m; - int start; + size_t n; + size_t m; + size_t start; unsigned char *buf = (unsigned char *)vbuf; char line[80]; char *p; diff --git a/lib/private-libwebsockets.h b/lib/private-libwebsockets.h index 380af8586..1303a8a66 100755 --- a/lib/private-libwebsockets.h +++ b/lib/private-libwebsockets.h @@ -548,7 +548,7 @@ struct _lws_header_related { struct _lws_websocket_related { char *rx_user_buffer; - int rx_user_buffer_head; + size_t rx_user_buffer_head; unsigned char frame_masking_nonce_04[4]; unsigned char frame_mask_index; size_t rx_packet_length; diff --git a/test-server/test-fraggle.c b/test-server/test-fraggle.c index 0c5853b40..be075cbdc 100644 --- a/test-server/test-fraggle.c +++ b/test-server/test-fraggle.c @@ -58,7 +58,8 @@ callback_fraggle(struct libwebsocket_context *context, enum libwebsocket_callback_reasons reason, void *user, void *in, size_t len) { - int n; + int jn; + size_t it; unsigned char buf[LWS_SEND_BUFFER_PRE_PADDING + 8000 + LWS_SEND_BUFFER_POST_PADDING]; struct per_session_data__fraggle *psf = user; @@ -99,8 +100,8 @@ callback_fraggle(struct libwebsocket_context *context, case FRAGSTATE_RANDOM_PAYLOAD: - for (n = 0; n < len; n++) - psf->sum += p[n]; + for (it = 0; it < len; it++) + psf->sum += p[it]; psf->total_message += len; psf->packets_left++; @@ -158,8 +159,8 @@ callback_fraggle(struct libwebsocket_context *context, psf->total_message += chunk; libwebsockets_get_random(context, bp, chunk); - for (n = 0; n < chunk; n++) - psf->sum += bp[n]; + for (jn = 0; jn < chunk; jn++) + psf->sum += bp[jn]; psf->packets_left--; if (psf->packets_left) @@ -167,10 +168,10 @@ callback_fraggle(struct libwebsocket_context *context, else psf->state = FRAGSTATE_POST_PAYLOAD_SUM; - n = libwebsocket_write(wsi, bp, chunk, write_mode); - if (n < 0) + jn = libwebsocket_write(wsi, bp, chunk, write_mode); + if (jn < 0) return -1; - if (n < chunk) { + if (jn < chunk) { lwsl_err("Partial write\n"); return -1; } @@ -189,11 +190,11 @@ callback_fraggle(struct libwebsocket_context *context, bp[2] = 0xff & (psf->sum >> 8); bp[3] = 0xff & (psf->sum); - n = libwebsocket_write(wsi, (unsigned char *)bp, + jn = libwebsocket_write(wsi, (unsigned char *)bp, 4, LWS_WRITE_BINARY); - if (n < 0) + if (jn < 0) return -1; - if (n < 4) { + if (jn < 4) { lwsl_err("Partial write\n"); return -1; } diff --git a/test-server/test-ping.c b/test-server/test-ping.c index 0d5291d3a..de5672f7e 100644 --- a/test-server/test-ping.c +++ b/test-server/test-ping.c @@ -230,7 +230,7 @@ callback_lws_mirror(struct libwebsocket_context * this, shift -= 8; } - while (p - &pingbuf[LWS_SEND_BUFFER_PRE_PADDING] < size) + while (p - &pingbuf[LWS_SEND_BUFFER_PRE_PADDING] < (ptrdiff_t)size) *p++ = 0; gettimeofday(&tv, NULL); @@ -267,13 +267,13 @@ callback_lws_mirror(struct libwebsocket_context * this, if (n < 0) return -1; - if (n < size) { + if (n < (int)size) { lwsl_err("Partial write\n"); return -1; } if (flood && - (psd->ping_index - psd->rx_count) < (screen_width - 1)) + (psd->ping_index - psd->rx_count) < (unsigned long)(screen_width - 1)) fprintf(stderr, "."); break; diff --git a/test-server/test-server.c b/test-server/test-server.c index c43b9c455..9fced8e15 100644 --- a/test-server/test-server.c +++ b/test-server/test-server.c @@ -620,7 +620,7 @@ callback_lws_mirror(struct libwebsocket_context *context, lwsl_err("ERROR %d writing to mirror socket\n", n); return -1; } - if (n < ringbuffer[pss->ringbuffer_tail].len) + if (n < (int)ringbuffer[pss->ringbuffer_tail].len) lwsl_err("mirror partial write %d vs %d\n", n, ringbuffer[pss->ringbuffer_tail].len); diff --git a/win32port/win32helpers/gettimeofday.c b/win32port/win32helpers/gettimeofday.c index 18d5a46d8..72bb668e4 100644 --- a/win32port/win32helpers/gettimeofday.c +++ b/win32port/win32helpers/gettimeofday.c @@ -34,7 +34,7 @@ int gettimeofday(struct timeval *tv, struct timezone *tz) /*converting file time to unix epoch*/ tmpres /= 10; /*convert into microseconds*/ - tmpres -= DELTA_EPOCH_IN_MICROSECS; + tmpres -= DELTA_EPOCH_IN_MICROSECS; tv->tv_sec = (long)(tmpres / 1000000UL); tv->tv_usec = (long)(tmpres % 1000000UL); }