clean windows warnings
authorAndy Green <andy.green@linaro.org>
Sun, 27 Dec 2015 10:16:32 +0000 (18:16 +0800)
committerAndy Green <andy.green@linaro.org>
Sun, 27 Dec 2015 10:16:32 +0000 (18:16 +0800)
Signed-off-by: Andy Green <andy.green@linaro.org>
test-server/test-client.c
test-server/test-fraggle.c
test-server/test-ping.c

index 726615a..b8e262b 100644 (file)
@@ -242,7 +242,7 @@ static struct option options[] = {
        { NULL, 0, 0, 0 }
 };
 
-static int ratelimit_connects(unsigned int *last, int secs)
+static int ratelimit_connects(unsigned int *last, unsigned int secs)
 {
        struct timeval tv;
 
@@ -345,7 +345,7 @@ int main(int argc, char **argv)
 
        while (!force_exit) {
 
-               if (!wsi_dumb && ratelimit_connects(&rl_dumb, 2)) {
+               if (!wsi_dumb && ratelimit_connects(&rl_dumb, 2u)) {
                        lwsl_notice("dumb: connecting\n");
                        wsi_dumb = lws_client_connect(context, address, port,
                                use_ssl, "/", argv[optind], argv[optind],
@@ -353,7 +353,7 @@ int main(int argc, char **argv)
                                ietf_version);
                }
 
-               if (!wsi_mirror && ratelimit_connects(&rl_mirror, 2)) {
+               if (!wsi_mirror && ratelimit_connects(&rl_mirror, 2u)) {
                        lwsl_notice("mirror: connecting\n");
                        wsi_mirror = lws_client_connect(context,
                                address, port, use_ssl,  "/",
index d2ab027..a04ad8a 100644 (file)
@@ -97,7 +97,7 @@ callback_fraggle(struct lws *wsi, enum lws_callback_reasons reason,
 
                case FRAGSTATE_RANDOM_PAYLOAD:
 
-                       for (n = 0; n < len; n++)
+                       for (n = 0; (unsigned int)n < len; n++)
                                psf->sum += p[n];
 
                        psf->total_message += len;
@@ -184,9 +184,9 @@ callback_fraggle(struct lws *wsi, enum lws_callback_reasons reason,
                                                  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] = (unsigned char)(psf->sum >> 16);
+                       bp[2] = (unsigned char)(psf->sum >> 8);
+                       bp[3] = (unsigned char)psf->sum;
 
                        n = lws_write(wsi, (unsigned char *)bp,
                                                           4, LWS_WRITE_BINARY);
index 16065f1..d85af0a 100644 (file)
@@ -225,18 +225,18 @@ callback_lws_mirror(struct lws *wsi, enum lws_callback_reasons reason,
                /* 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;
                }
 
-               while (p - &pingbuf[LWS_SEND_BUFFER_PRE_PADDING] < size)
+               while ((unsigned int)(p - &pingbuf[LWS_SEND_BUFFER_PRE_PADDING]) < size)
                        *p++ = 0;
 
                gettimeofday(&tv, NULL);
 
                psd->ringbuffer[psd->ringbuffer_head].issue_timestamp =
                                             (tv.tv_sec * 1000000) + tv.tv_usec;
-               psd->ringbuffer[psd->ringbuffer_head].index = psd->ping_index++;
+               psd->ringbuffer[psd->ringbuffer_head].index = (unsigned long)psd->ping_index++;
                psd->ringbuffer[psd->ringbuffer_head].seen = 0;
 
                if (psd->ringbuffer_head == PING_RINGBUFFER_SIZE - 1)
@@ -266,7 +266,7 @@ callback_lws_mirror(struct lws *wsi, enum lws_callback_reasons reason,
 
                if (n < 0)
                        return -1;
-               if (n < size) {
+               if (n < (int)size) {
                        lwsl_err("Partial write\n");
                        return -1;
                }
@@ -374,7 +374,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);