From 24bc25ec380aaccfa358eee6de9491a28a6cddfa Mon Sep 17 00:00:00 2001 From: Philipp Schafft Date: Sat, 28 Nov 2015 11:30:34 +0000 Subject: [PATCH] Cleanup: fixed some compiler warnings --- src/auth.c | 2 ++ src/auth_anonymous.c | 2 ++ src/auth_htpasswd.c | 2 ++ src/curl.c | 1 + src/event.c | 2 ++ src/event_url.c | 1 + src/format.c | 6 +++--- src/fserve.c | 3 +++ src/matchfile.c | 1 + src/slave.c | 2 ++ src/source.c | 4 ++++ src/stats.c | 8 ++++++++ 12 files changed, 31 insertions(+), 3 deletions(-) diff --git a/src/auth.c b/src/auth.c index f7d98b10..43a74e5f 100644 --- a/src/auth.c +++ b/src/auth.c @@ -243,6 +243,8 @@ static auth_result auth_remove_client(auth_t *auth, auth_client *auth_user) client_t *client = auth_user->client; auth_result ret = AUTH_RELEASED; + (void)auth; + if (client->auth->release_client) ret = client->auth->release_client(auth_user); diff --git a/src/auth_anonymous.c b/src/auth_anonymous.c index 92af87c6..f62832e7 100644 --- a/src/auth_anonymous.c +++ b/src/auth_anonymous.c @@ -22,11 +22,13 @@ static auth_result anonymous_auth(auth_client *auth_user) { + (void)auth_user; return AUTH_OK; } int auth_get_anonymous_auth(auth_t *authenticator, config_options_t *options) { + (void)options; authenticator->authenticate_client = anonymous_auth; authenticator->immediate = 1; return 0; diff --git a/src/auth_htpasswd.c b/src/auth_htpasswd.c index 56f3f638..16b7e59a 100644 --- a/src/auth_htpasswd.c +++ b/src/auth_htpasswd.c @@ -89,6 +89,8 @@ static int compare_users(void *arg, void *a, void *b) htpasswd_user *user1 = (htpasswd_user *)a; htpasswd_user *user2 = (htpasswd_user *)b; + (void)arg; + return strcmp (user1->name, user2->name); } diff --git a/src/curl.c b/src/curl.c index d928c1b0..95f2740e 100644 --- a/src/curl.c +++ b/src/curl.c @@ -24,6 +24,7 @@ static int my_getpass(void *client, char *prompt, char *buffer, int buflen) { #endif static size_t handle_returned (void *ptr, size_t size, size_t nmemb, void *stream) { + (void)ptr, (void)stream; return size * nmemb; } diff --git a/src/event.c b/src/event.c index a08b2faf..b15b537a 100644 --- a/src/event.c +++ b/src/event.c @@ -152,6 +152,8 @@ static inline void _try_registrations(event_registration_t *er, event_t *event) static void *event_run_thread (void *arg) { int running = 0; + (void)arg; + do { event_t *event; size_t i; diff --git a/src/event_url.c b/src/event_url.c index ed568551..a8078dbd 100644 --- a/src/event_url.c +++ b/src/event_url.c @@ -27,6 +27,7 @@ typedef struct event_url { } event_url_t; static size_t handle_returned (void *ptr, size_t size, size_t nmemb, void *stream) { + (void)ptr, (void)stream; return size * nmemb; } diff --git a/src/format.c b/src/format.c index 9d50b4be..06b495e0 100644 --- a/src/format.c +++ b/src/format.c @@ -292,7 +292,7 @@ int format_advance_queue(source_t *source, client_t *client) */ static int format_prepare_headers (source_t *source, client_t *client) { - unsigned remaining; + size_t remaining; char *ptr; int bytes; int bitrate_filtered = 0; @@ -303,11 +303,11 @@ static int format_prepare_headers (source_t *source, client_t *client) client->respcode = 200; bytes = util_http_build_header(ptr, remaining, 0, 0, 200, NULL, source->format->contenttype, NULL, NULL, source, client); - if (bytes == -1) { + if (bytes < 0) { ICECAST_LOG_ERROR("Dropping client as we can not build response headers."); client->respcode = 500; return -1; - } else if ((bytes + 1024) >= remaining) { /* we don't know yet how much to follow but want at least 1kB free space */ + } else if (((size_t)bytes + (size_t)1024U) >= remaining) { /* we don't know yet how much to follow but want at least 1kB free space */ void *new_ptr = realloc(ptr, bytes + 1024); if (new_ptr) { ICECAST_LOG_DEBUG("Client buffer reallocation succeeded."); diff --git a/src/fserve.c b/src/fserve.c index 7b0c9680..84b98f94 100644 --- a/src/fserve.c +++ b/src/fserve.c @@ -275,6 +275,8 @@ static void *fserv_thread_function(void *arg) fserve_t *fclient, **trail; size_t bytes; + (void)arg; + while (1) { if (wait_for_fds() < 0) @@ -716,6 +718,7 @@ static int _delete_mapping(void *mapping) { static int _compare_mappings(void *arg, void *a, void *b) { + (void)arg; return strcmp( ((mime_type *)a)->ext, ((mime_type *)b)->ext); diff --git a/src/matchfile.c b/src/matchfile.c index c5b3c19f..387f7fab 100644 --- a/src/matchfile.c +++ b/src/matchfile.c @@ -43,6 +43,7 @@ static int __func_free(void *x) { } static int __func_compare (void *arg, void *a, void *b) { + (void)arg; return strcmp(b, a); } diff --git a/src/slave.c b/src/slave.c index 0af89d52..59c1b271 100644 --- a/src/slave.c +++ b/src/slave.c @@ -724,6 +724,8 @@ static void *_slave_thread(void *arg) ice_config_t *config; unsigned int interval = 0; + (void)arg; + thread_mutex_lock(&_slave_mutex); update_settings = 0; update_all_mounts = 0; diff --git a/src/source.c b/src/source.c index 8ae0cbdb..70053e95 100644 --- a/src/source.c +++ b/src/source.c @@ -191,6 +191,8 @@ int source_compare_sources(void *arg, void *a, void *b) source_t *srca = (source_t *)a; source_t *srcb = (source_t *)b; + (void)arg; + return strcmp(srca->mount, srcb->mount); } @@ -934,6 +936,8 @@ static int _compare_clients(void *compare_arg, void *a, void *b) client_t *clienta = (client_t *) a; client_t *clientb = (client_t *) b; + (void)compare_arg; + connection_t *cona = clienta->con; connection_t *conb = clientb->con; diff --git a/src/stats.c b/src/stats.c index fc42426f..a77d82b1 100644 --- a/src/stats.c +++ b/src/stats.c @@ -671,6 +671,8 @@ static void *_stats_thread(void *arg) stats_event_t *copy; event_listener_t *listener; + (void)arg; + stats_event_time (NULL, "server_start"); stats_event_time_iso8601 (NULL, "server_start_iso8601"); @@ -995,6 +997,8 @@ void *stats_connection(void *arg) void stats_callback (client_t *client, void *notused) { + (void)notused; + if (client->con->error) { client_destroy (client); @@ -1078,6 +1082,8 @@ static int _compare_stats(void *arg, void *a, void *b) stats_node_t *nodea = (stats_node_t *)a; stats_node_t *nodeb = (stats_node_t *)b; + (void)arg; + return strcmp(nodea->name, nodeb->name); } @@ -1086,6 +1092,8 @@ static int _compare_source_stats(void *arg, void *a, void *b) stats_source_t *nodea = (stats_source_t *)a; stats_source_t *nodeb = (stats_source_t *)b; + (void)arg; + return strcmp(nodea->source, nodeb->source); }