Fix: compiler warnings

This commit is contained in:
jcorporation 2019-01-20 23:26:06 +00:00
parent 0681386eb8
commit aed10bcb4c
3 changed files with 8 additions and 4 deletions

View File

@ -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)

View File

@ -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);

View File

@ -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)