From 7a9970f90d354d2c491e4727b4bc83b83b440fbe Mon Sep 17 00:00:00 2001 From: Andy Green Date: Sun, 15 May 2016 08:29:37 +0800 Subject: [PATCH] win fix warnings from appveyor Signed-off-by: Andy Green --- lib/context.c | 6 +++--- lib/libuv.c | 2 +- lib/libwebsockets.c | 4 ++-- lib/server.c | 2 +- lwsws/conf.c | 2 +- test-server/test-server-v2.0.c | 3 ++- 6 files changed, 10 insertions(+), 9 deletions(-) diff --git a/lib/context.c b/lib/context.c index 0b34ee1..bf35926 100644 --- a/lib/context.c +++ b/lib/context.c @@ -447,7 +447,7 @@ lws_create_vhost(struct lws_context *context, #ifdef LWS_WITH_ACCESS_LOG if (info->log_filepath) { vh->log_fd = open(info->log_filepath, O_CREAT | O_APPEND | O_RDWR, 0600); - if (vh->log_fd == LWS_INVALID_FILE) { + if (vh->log_fd == (int)LWS_INVALID_FILE) { lwsl_err("unable to open log filepath %s\n", info->log_filepath); goto bail; @@ -460,7 +460,7 @@ lws_create_vhost(struct lws_context *context, info->log_filepath); #endif } else - vh->log_fd = LWS_INVALID_FILE; + vh->log_fd = (int)LWS_INVALID_FILE; #endif if (lws_context_init_server_ssl(info, vh)) @@ -940,7 +940,7 @@ lws_context_destroy(struct lws_context *context) #endif #endif #ifdef LWS_WITH_ACCESS_LOG - if (vh->log_fd != LWS_INVALID_FILE) + if (vh->log_fd != (int)LWS_INVALID_FILE) close(vh->log_fd); #endif diff --git a/lib/libuv.c b/lib/libuv.c index 64e5a7e..0b6b60f 100644 --- a/lib/libuv.c +++ b/lib/libuv.c @@ -269,7 +269,7 @@ lws_libuv_destroyloop(struct lws_context *context, int tsi) } void -lws_libuv_accept(struct lws *wsi, int accept_fd) +lws_libuv_accept(struct lws *wsi, lws_sockfd_type accept_fd) { struct lws_context *context = lws_get_context(wsi); struct lws_context_per_thread *pt = &context->pt[(int)wsi->tsi]; diff --git a/lib/libwebsockets.c b/lib/libwebsockets.c index 96dc533..6ac8639 100644 --- a/lib/libwebsockets.c +++ b/lib/libwebsockets.c @@ -2343,7 +2343,7 @@ lws_access_log(struct lws *wsi) wsi->access_log.header_log, wsi->access_log.response, wsi->access_log.sent, p); - if (wsi->vhost->log_fd != LWS_INVALID_FILE) { + if (wsi->vhost->log_fd != (int)LWS_INVALID_FILE) { if (write(wsi->vhost->log_fd, ass, l) != l) lwsl_err("Failed to write log\n"); } else @@ -2448,7 +2448,7 @@ lws_json_dump_vhost(const struct lws_vhost *vh, char *buf, int len) if (!first) buf += snprintf(buf, end - buf, ","); buf += snprintf(buf, end - buf, - "\n {\n \"%s\":\{\n" + "\n {\n \"%s\":{\n" " \"status\":\"ok\"\n }\n }" , vh->protocols[n].name); diff --git a/lib/server.c b/lib/server.c index 94a0280..c109585 100644 --- a/lib/server.c +++ b/lib/server.c @@ -674,7 +674,7 @@ lws_http_action(struct lws *wsi) */ if (hit->origin_protocol == LWSMPRO_CALLBACK) { - for (n = 0; n < wsi->vhost->count_protocols; n++) + for (n = 0; n < (unsigned int)wsi->vhost->count_protocols; n++) if (!strcmp(wsi->vhost->protocols[n].name, hit->origin)) { diff --git a/lwsws/conf.c b/lwsws/conf.c index 7367397..c78184d 100644 --- a/lwsws/conf.c +++ b/lwsws/conf.c @@ -378,7 +378,7 @@ lejp_vhosts_cb(struct lejp_ctx *ctx, char reason) break; case LEJPVP_MOUNTPOINT: a->m.mountpoint = a->p; - a->m.mountpoint_len = strlen(ctx->buf); + a->m.mountpoint_len = (unsigned char)strlen(ctx->buf); break; case LEJPVP_ORIGIN: a->m.origin = a->p; diff --git a/test-server/test-server-v2.0.c b/test-server/test-server-v2.0.c index b66a84e..b6feafe 100644 --- a/test-server/test-server-v2.0.c +++ b/test-server/test-server-v2.0.c @@ -229,7 +229,8 @@ int main(int argc, char **argv) info.port = 7681; while (n >= 0) { - n = getopt_long(argc, argv, "i:hsap:d:Dr:C:K:A:R:vu:g:", options, NULL); + n = getopt_long(argc, argv, "i:hsap:d:Dr:C:K:A:R:vu:g:", + (struct option *)options, NULL); if (n < 0) continue; switch (n) { -- 2.7.4