From aed10bcb4c8ab66d1e98ac0cc80a8b8dc4e18197 Mon Sep 17 00:00:00 2001 From: jcorporation Date: Sun, 20 Jan 2019 23:26:06 +0000 Subject: [PATCH] Fix: compiler warnings --- src/global.h.in | 2 +- src/mpd_client.c | 4 ++++ src/web_server.c | 6 +++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/global.h.in b/src/global.h.in index dbc7300..330aa4b 100644 --- a/src/global.h.in +++ b/src/global.h.in @@ -52,7 +52,7 @@ //check and return buffer size #define CHECK_RETURN_LEN() do { \ if (len > MAX_SIZE) \ - printf("ERROR: Buffer truncated\n"); \ + printf("ERROR: Buffer truncated %d / %d\n", (int)len, MAX_SIZE); \ return len; \ } while (0) diff --git a/src/mpd_client.c b/src/mpd_client.c index 5d1cd84..26961f4 100644 --- a/src/mpd_client.c +++ b/src/mpd_client.c @@ -1034,12 +1034,16 @@ static void mpd_client_mpd_features(t_config *config, t_mpd_state *mpd_state) { mpd_state->feat_tags = true; LOG_INFO() printf("\nmyMPD enabled tags: "); enum mpd_tag_type types[64]; + #if LIBMPDCLIENT_CHECK_VERSION(2,12,0) unsigned n = 0; token = strtok_r(taglist, s, &rest); + #endif while (token != NULL) { if (list_get_value(&mpd_state->mpd_tags, token) == 1) { list_push(&mpd_state->mympd_tags, token, 1); + #if LIBMPDCLIENT_CHECK_VERSION(2,12,0) types[n++] = mpd_tag_name_parse(token); + #endif LOG_INFO() printf("%s ", token); } token = strtok_r(NULL, s, &rest); diff --git a/src/web_server.c b/src/web_server.c index 12dd0b8..caac8db 100644 --- a/src/web_server.c +++ b/src/web_server.c @@ -177,7 +177,7 @@ static void ev_handler(struct mg_connection *nc, int ev, void *ev_data) { } case MG_EV_WEBSOCKET_HANDSHAKE_REQUEST: { struct http_message *hm = (struct http_message *) ev_data; - LOG_VERBOSE() printf("New websocket request (%ld): %.*s\n", user_data->conn_id, hm->uri.len, hm->uri.p); + LOG_VERBOSE() printf("New websocket request (%ld): %.*s\n", user_data->conn_id, (int)hm->uri.len, hm->uri.p); if (mg_vcmp(&hm->uri, "/ws") != 0) { printf("ERROR: Websocket request not to /ws, closing connection\n"); mg_printf(nc, "%s", "HTTP/1.1 403 FORBIDDEN\r\n\r\n"); @@ -193,7 +193,7 @@ static void ev_handler(struct mg_connection *nc, int ev, void *ev_data) { } case MG_EV_HTTP_REQUEST: { struct http_message *hm = (struct http_message *) ev_data; - LOG_VERBOSE() printf("HTTP request (%ld): %.*s\n", user_data->conn_id, hm->uri.len, hm->uri.p); + LOG_VERBOSE() printf("HTTP request (%ld): %.*s\n", user_data->conn_id, (int)hm->uri.len, hm->uri.p); if (mg_vcmp(&hm->uri, "/api") == 0) { bool rc = handle_api(user_data->conn_id, hm->body.p, hm->body.len); if (rc == false) { @@ -233,7 +233,7 @@ static void ev_handler_redirect(struct mg_connection *nc, int ev, void *ev_data) t_user_data *user_data = (t_user_data *) nc->user_data; t_config *config = (t_config *) user_data->config; - snprintf(host_header, 1024, "%.*s", host_hdr->len, host_hdr->p); + snprintf(host_header, 1024, "%.*s", (int)host_hdr->len, host_hdr->p); host = strtok_r(host_header, ":", &crap); char s_redirect[250]; if (strcmp(config->sslport, "443") == 0)