]> git.ipfire.org Git - thirdparty/shairport-sync.git/commitdiff
Remove many causes of warnings at the -Wextra level
authorMike Brady <mikebrady@eircom.net>
Wed, 7 Mar 2018 20:48:21 +0000 (20:48 +0000)
committerMike Brady <mikebrady@eircom.net>
Wed, 7 Mar 2018 20:48:21 +0000 (20:48 +0000)
13 files changed:
Makefile.am
common.h
dacp.c
dbus-service.c
mdns_avahi.c
mdns_external.c
mpris-service.c
player.h
rtp.c
rtsp.c
shairport-sync-dbus-test-client.c
shairport-sync-mpris-test-client.c
shairport.c

index 248a2d99845b0832c564f0c0e79bc1eb84c51fa5..1e98c17c3f65dc0c7462ff6aaaf2a4ed1c3946a8 100644 (file)
@@ -6,7 +6,7 @@ bin_PROGRAMS = shairport-sync
 
 shairport_sync_SOURCES = shairport.c rtsp.c mdns.c mdns_external.c common.c rtp.c player.c alac.c audio.c loudness.c
 
-AM_CFLAGS = -Wno-multichar -Wall -pthread -DSYSCONFDIR=\"$(sysconfdir)\"
+AM_CFLAGS = -Wno-multichar -Wall -Wextra -pthread -DSYSCONFDIR=\"$(sysconfdir)\"
 if BUILD_FOR_FREEBSD
   AM_CPPFLAGS = -I/usr/local/include -Wno-multichar -DSYSCONFDIR=\"$(sysconfdir)\" -O2
 else
index 62ae78a1d62e52832ce4bc362639d66fdfc086bb..e869ff7ac605c818c59443cd243a9d09544e95a9 100644 (file)
--- a/common.h
+++ b/common.h
@@ -88,7 +88,7 @@ typedef struct {
   char *metadata_pipename;
   char *metadata_sockaddr;
   int metadata_sockport;
-  int metadata_sockmsglength;
+  size_t metadata_sockmsglength;
   int get_coverart;
 #endif
   uint8_t hw_addr[6];
diff --git a/dacp.c b/dacp.c
index 73ed1a87fc7078409209ea91c4954ef1c5097ff1..49035c5d9e01360277acc8cfa7633d8385342300 100644 (file)
--- a/dacp.c
+++ b/dacp.c
@@ -65,7 +65,9 @@ struct HttpResponse {
   int code;
 };
 
-static void *response_realloc(void *opaque, void *ptr, int size) { return realloc(ptr, size); }
+static void *response_realloc(__attribute__((unused)) void *opaque, void *ptr, int size) {
+  return realloc(ptr, size);
+}
 
 static void response_body(void *opaque, const char *data, int size) {
   struct HttpResponse *response = (struct HttpResponse *)opaque;
@@ -89,8 +91,10 @@ static void response_body(void *opaque, const char *data, int size) {
   response->size += size;
 }
 
-static void response_header(void *opaque, const char *ckey, int nkey, const char *cvalue,
-                            int nvalue) { /* example doesn't care about headers */
+static void
+response_header(__attribute__((unused)) void *opaque, __attribute__((unused)) const char *ckey,
+                __attribute__((unused)) int nkey, __attribute__((unused)) const char *cvalue,
+                __attribute__((unused)) int nvalue) { /* example doesn't care about headers */
 }
 
 static void response_code(void *opaque, int code) {
@@ -183,7 +187,7 @@ int dacp_send_command(const char *command, char **body, ssize_t *bodysize) {
 
           // Send command
           // debug(1,"DACP connect message: \"%s\".",message);
-          if (send(sockfd, message, strlen(message), 0) != strlen(message)) {
+          if (send(sockfd, message, strlen(message), 0) != (ssize_t)strlen(message)) {
             // debug(1, "Send failed");
             response.code = 493; // Client failed to send a message
 
@@ -278,7 +282,7 @@ void set_dacp_server_information(rtsp_conn_info *conn) { // tell the DACP conver
   pthread_mutex_unlock(&dacp_server_information_lock);
 }
 
-void *dacp_monitor_thread_code(void *na) {
+void *dacp_monitor_thread_code(__attribute__((unused)) void *na) {
   int scan_index = 0;
   // char server_reply[10000];
   // debug(1, "DACP monitor thread started.");
index e5bfb9362c6c2d4d402c4bf965900daa0325cf9a..d281efa6511cf6829323c39cd5784502265ff0c1 100644 (file)
 #include "dbus-service.h"
 #include "metadata_hub.h"
 
-void dbus_metadata_watcher(struct metadata_bundle *argc, void *userdata) {
+void dbus_metadata_watcher(struct metadata_bundle *argc, __attribute__((unused)) void *userdata) {
   // debug(1, "DBUS metadata watcher called");
-  shairport_sync_set_volume(shairportSyncSkeleton, metadata_store.speaker_volume);
+  shairport_sync_set_volume(shairportSyncSkeleton, argc->speaker_volume);
 }
 
-gboolean notify_loudness_filter_active_callback(ShairportSync *skeleton, gpointer user_data) {
+gboolean notify_loudness_filter_active_callback(ShairportSync *skeleton,
+                                                __attribute__((unused)) gpointer user_data) {
   debug(1, "\"notify_loudness_filter_active_callback\" called.");
   if (shairport_sync_get_loudness_filter_active(skeleton)) {
     debug(1, "activating loudness filter");
@@ -31,7 +32,8 @@ gboolean notify_loudness_filter_active_callback(ShairportSync *skeleton, gpointe
   return TRUE;
 }
 
-gboolean notify_loudness_threshold_callback(ShairportSync *skeleton, gpointer user_data) {
+gboolean notify_loudness_threshold_callback(ShairportSync *skeleton,
+                                            __attribute__((unused)) gpointer user_data) {
   gdouble th = shairport_sync_get_loudness_threshold(skeleton);
   if ((th <= 0.0) && (th >= -100.0)) {
     debug(1, "Setting loudness threshhold to %f.", th);
@@ -42,7 +44,8 @@ gboolean notify_loudness_threshold_callback(ShairportSync *skeleton, gpointer us
   return TRUE;
 }
 
-gboolean notify_volume_callback(ShairportSync *skeleton, gpointer user_data) {
+gboolean notify_volume_callback(ShairportSync *skeleton,
+                                __attribute__((unused)) gpointer user_data) {
   gint gvo = shairport_sync_get_volume(skeleton);
   int32_t vo = gvo;
   if ((vo >= 0) && (vo <= 100)) {
@@ -149,7 +152,8 @@ gboolean notify_volume_callback(ShairportSync *skeleton, gpointer user_data) {
 }
 
 static gboolean on_handle_remote_command(ShairportSync *skeleton, GDBusMethodInvocation *invocation,
-                                         const gchar *command, gpointer user_data) {
+                                         const gchar *command,
+                                         __attribute__((unused)) gpointer user_data) {
   debug(1, "RemoteCommand with command \"%s\".", command);
   send_simple_dacp_command((const char *)command);
   shairport_sync_complete_remote_command(skeleton, invocation);
@@ -157,7 +161,7 @@ static gboolean on_handle_remote_command(ShairportSync *skeleton, GDBusMethodInv
 }
 
 static void on_dbus_name_acquired(GDBusConnection *connection, const gchar *name,
-                                  gpointer user_data) {
+                                  __attribute__((unused)) gpointer user_data) {
 
   // debug(1, "Shairport Sync native D-Bus interface \"%s\" acquired on the %s bus.", name,
   // (config.dbus_service_bus_type == DBT_session) ? "session" : "system");
@@ -193,13 +197,16 @@ static void on_dbus_name_acquired(GDBusConnection *connection, const gchar *name
         (config.dbus_service_bus_type == DBT_session) ? "session" : "system");
 }
 
-static void on_dbus_name_lost_again(GDBusConnection *connection, const gchar *name,
-                                    gpointer user_data) {
+static void on_dbus_name_lost_again(__attribute__((unused)) GDBusConnection *connection,
+                                    __attribute__((unused)) const gchar *name,
+                                    __attribute__((unused)) gpointer user_data) {
   warn("Could not acquire a Shairport Sync native D-Bus interface \"%s\" on the %s bus.", name,
        (config.dbus_service_bus_type == DBT_session) ? "session" : "system");
 }
 
-static void on_dbus_name_lost(GDBusConnection *connection, const gchar *name, gpointer user_data) {
+static void on_dbus_name_lost(__attribute__((unused)) GDBusConnection *connection,
+                              __attribute__((unused)) const gchar *name,
+                              __attribute__((unused)) gpointer user_data) {
   // debug(1, "Could not acquire a Shairport Sync native D-Bus interface \"%s\" on the %s bus --
   // will try adding the process "
   //         "number to the end of it.",
index 58bf579ae0b0d9a1c26caf304cf0494e432789a6..1658da4b7b1a351b946c360525653b907a2b9447 100644 (file)
@@ -66,8 +66,10 @@ static int port = 0;
 static void resolve_callback(AvahiServiceResolver *r, AVAHI_GCC_UNUSED AvahiIfIndex interface,
                              AVAHI_GCC_UNUSED AvahiProtocol protocol, AvahiResolverEvent event,
                              const char *name, const char *type, const char *domain,
-                             const char *host_name, const AvahiAddress *address, uint16_t port,
-                             AvahiStringList *txt, AvahiLookupResultFlags flags, void *userdata) {
+                             __attribute__((unused)) const char *host_name,
+                             __attribute__((unused)) const AvahiAddress *address, uint16_t port,
+                             __attribute__((unused)) AvahiStringList *txt,
+                             __attribute__((unused)) AvahiLookupResultFlags flags, void *userdata) {
   assert(r);
 
   rtsp_conn_info *conn = (rtsp_conn_info *)userdata;
index 622963e9ff114adf85cf00e30aa6408a542bfb42..6f4e10f470b26fbd3b79beb0a75cf8f248290814 100644 (file)
@@ -83,7 +83,7 @@ static int fork_execvp(const char *file, char *const argv[]) {
   }
 }
 
-static int mdns_external_avahi_register(char *apname, int port) {
+static int mdns_external_avahi_register(char *apname, __attribute__((unused)) int port) {
   char mdns_port[6];
   sprintf(mdns_port, "%d", config.port);
 
@@ -122,7 +122,7 @@ static int mdns_external_avahi_register(char *apname, int port) {
   return -1;
 }
 
-static int mdns_external_dns_sd_register(char *apname, int port) {
+static int mdns_external_dns_sd_register(char *apname, __attribute__((unused)) int port) {
   char mdns_port[6];
   sprintf(mdns_port, "%d", config.port);
 
index fbc19b0699825eec0347846752e3a93f89ac47ba..e0622ddfc7885db6c4088bc6f4a59328fa733e8b 100644 (file)
@@ -14,7 +14,7 @@
 #include "metadata_hub.h"
 #include "mpris-service.h"
 
-void mpris_metadata_watcher(struct metadata_bundle *argc, void *userdata) {
+void mpris_metadata_watcher(struct metadata_bundle *argc, __attribute__((unused)) void *userdata) {
   // debug(1, "MPRIS metadata watcher called");
   char response[100];
 
@@ -147,49 +147,50 @@ void mpris_metadata_watcher(struct metadata_bundle *argc, void *userdata) {
 }
 
 static gboolean on_handle_next(MediaPlayer2Player *skeleton, GDBusMethodInvocation *invocation,
-                               gpointer user_data) {
+                               __attribute__((unused)) gpointer user_data) {
   send_simple_dacp_command("nextitem");
   media_player2_player_complete_next(skeleton, invocation);
   return TRUE;
 }
 
 static gboolean on_handle_previous(MediaPlayer2Player *skeleton, GDBusMethodInvocation *invocation,
-                                   gpointer user_data) {
+                                   __attribute__((unused)) gpointer user_data) {
   send_simple_dacp_command("previtem");
   media_player2_player_complete_previous(skeleton, invocation);
   return TRUE;
 }
 
 static gboolean on_handle_stop(MediaPlayer2Player *skeleton, GDBusMethodInvocation *invocation,
-                               gpointer user_data) {
+                               __attribute__((unused)) gpointer user_data) {
   send_simple_dacp_command("stop");
   media_player2_player_complete_stop(skeleton, invocation);
   return TRUE;
 }
 
 static gboolean on_handle_pause(MediaPlayer2Player *skeleton, GDBusMethodInvocation *invocation,
-                                gpointer user_data) {
+                                __attribute__((unused)) gpointer user_data) {
   send_simple_dacp_command("pause");
   media_player2_player_complete_pause(skeleton, invocation);
   return TRUE;
 }
 
 static gboolean on_handle_play_pause(MediaPlayer2Player *skeleton,
-                                     GDBusMethodInvocation *invocation, gpointer user_data) {
+                                     GDBusMethodInvocation *invocation,
+                                     __attribute__((unused)) gpointer user_data) {
   send_simple_dacp_command("playpause");
   media_player2_player_complete_play_pause(skeleton, invocation);
   return TRUE;
 }
 
 static gboolean on_handle_play(MediaPlayer2Player *skeleton, GDBusMethodInvocation *invocation,
-                               gpointer user_data) {
+                               __attribute__((unused)) gpointer user_data) {
   send_simple_dacp_command("play");
   media_player2_player_complete_play(skeleton, invocation);
   return TRUE;
 }
 
 static void on_mpris_name_acquired(GDBusConnection *connection, const gchar *name,
-                                   gpointer user_data) {
+                                   __attribute__((unused)) gpointer user_data) {
 
   const char *empty_string_array[] = {NULL};
 
@@ -238,13 +239,16 @@ static void on_mpris_name_acquired(GDBusConnection *connection, const gchar *nam
         (config.mpris_service_bus_type == DBT_session) ? "session" : "system");
 }
 
-static void on_mpris_name_lost_again(GDBusConnection *connection, const gchar *name,
-                                     gpointer user_data) {
+static void on_mpris_name_lost_again(__attribute__((unused)) GDBusConnection *connection,
+                                     const gchar *name,
+                                     __attribute__((unused)) gpointer user_data) {
   warn("Could not acquire an MPRIS interface named \"%s\" on the %s bus.", name,
        (config.mpris_service_bus_type == DBT_session) ? "session" : "system");
 }
 
-static void on_mpris_name_lost(GDBusConnection *connection, const gchar *name, gpointer user_data) {
+static void on_mpris_name_lost(__attribute__((unused)) GDBusConnection *connection,
+                               __attribute__((unused)) const gchar *name,
+                               __attribute__((unused)) gpointer user_data) {
   // debug(1, "Could not acquire MPRIS interface \"%s\" on the %s bus -- will try adding the process
   // "
   //         "number to the end of it.",
index 4e7129dc8faac37b566274fd1d45108ae913d373..f20f1cfd64a6744625896640dc4173816fb050f0 100644 (file)
--- a/player.h
+++ b/player.h
@@ -82,7 +82,8 @@ typedef struct {
   uint64_t packet_count;
   int connection_state_to_output;
   int player_thread_please_stop;
-  int64_t first_packet_time_to_play, time_since_play_started; // nanoseconds
+  uint64_t first_packet_time_to_play;
+  int64_t time_since_play_started; // nanoseconds
                                                               // stats
   uint64_t missing_packets, late_packets, too_late_packets, resend_requests;
   int decoder_in_use;
diff --git a/rtp.c b/rtp.c
index e5076dd7d8e7aa1641dd2956fd059755dedb013a..ec3f2fc8cf75a1e9695d2b6c9f5e02ba0cdfe654 100644 (file)
--- a/rtp.c
+++ b/rtp.c
@@ -43,8 +43,8 @@
 #include "player.h"
 #include "rtp.h"
 
-uint64_t static local_to_remote_time_jitters;
-uint64_t static local_to_remote_time_jitters_count;
+uint64_t local_to_remote_time_jitters;
+uint64_t local_to_remote_time_jitters_count;
 
 void memory_barrier();
 
diff --git a/rtsp.c b/rtsp.c
index eb1dfea51bfb86e6187f57431f20d2147f73b22f..c69f281ec7778c4eb060d04820a8c7850ed47cdf 100644 (file)
--- a/rtsp.c
+++ b/rtsp.c
@@ -123,7 +123,7 @@ typedef struct {
 
 typedef struct {
   uint32_t referenceCount; // we might start using this...
-  int nheaders;
+  unsigned int nheaders;
   char *name[16];
   char *value[16];
 
@@ -362,7 +362,7 @@ static int msg_add_header(rtsp_message *msg, char *name, char *value) {
 }
 
 static char *msg_get_header(rtsp_message *msg, char *name) {
-  int i;
+  unsigned int i;
   for (i = 0; i < msg->nheaders; i++)
     if (!strcasecmp(msg->name[i], name))
       return msg->value[i];
@@ -370,7 +370,7 @@ static char *msg_get_header(rtsp_message *msg, char *name) {
 }
 
 static void debug_print_msg_headers(int level, rtsp_message *msg) {
-  int i;
+  unsigned int i;
   for (i = 0; i < msg->nheaders; i++) {
     debug(level, "  Type: \"%s\", content: \"%s\"", msg->name[i], msg->value[i]);
   }
@@ -410,7 +410,7 @@ static void msg_free(rtsp_message *msg) {
     if (rc)
       debug(1, "Error %d unlocking reference counter lock during msg_free()", rc);
     if (msg->referenceCount == 0) {
-      int i;
+      unsigned int i;
       for (i = 0; i < msg->nheaders; i++) {
         free(msg->name[i]);
         free(msg->value[i]);
@@ -589,7 +589,7 @@ static enum rtsp_read_request_response rtsp_read_request(rtsp_conn_info *conn,
       reply = rtsp_read_request_response_immediate_shutdown_requested;
       goto shutdown;
     }
-    ssize_t read_chunk = msg_size - inbuf;
+    size_t read_chunk = msg_size - inbuf;
     if (read_chunk > max_read_chunk)
       read_chunk = max_read_chunk;
     usleep(40000); // wait about 40 milliseconds between reads of up to about 64 kB
@@ -628,7 +628,8 @@ static void msg_write_response(int fd, rtsp_message *resp) {
   char pkt[2048];
   int pktfree = sizeof(pkt);
   char *p = pkt;
-  int i, n;
+  int n;
+  unsigned int i;
 
   n = snprintf(p, pktfree, "RTSP/1.0 %d %s\r\n", resp->respcode,
                resp->respcode == 200 ? "OK" : "Unauthorized");
@@ -708,7 +709,8 @@ static void handle_record(rtsp_conn_info *conn, rtsp_message *req, rtsp_message
   // usleep(500000);
 }
 
-static void handle_options(rtsp_conn_info *conn, rtsp_message *req, rtsp_message *resp) {
+static void handle_options(rtsp_conn_info *conn, __attribute__((unused)) rtsp_message *req,
+                           rtsp_message *resp) {
   debug(3, "Connection %d: OPTIONS", conn->connection_number);
   resp->respcode = 200;
   msg_add_header(resp, "Public", "ANNOUNCE, SETUP, RECORD, "
@@ -716,7 +718,8 @@ static void handle_options(rtsp_conn_info *conn, rtsp_message *req, rtsp_message
                                  "OPTIONS, GET_PARAMETER, SET_PARAMETER");
 }
 
-static void handle_teardown(rtsp_conn_info *conn, rtsp_message *req, rtsp_message *resp) {
+static void handle_teardown(rtsp_conn_info *conn, __attribute__((unused)) rtsp_message *req,
+                            rtsp_message *resp) {
   debug(2, "Connection %d: TEARDOWN", conn->connection_number);
   // if (!rtsp_playing())
   //  debug(1, "This RTSP connection thread (%d) doesn't think it's playing, but "
@@ -857,7 +860,7 @@ static void handle_ignore(rtsp_conn_info *conn, rtsp_message *req, rtsp_message
 */
 
 static void handle_set_parameter_parameter(rtsp_conn_info *conn, rtsp_message *req,
-                                           rtsp_message *resp) {
+                                           __attribute__((unused)) rtsp_message *resp) {
   char *cp = req->content;
   int cp_left = req->contentlength;
   char *next;
@@ -977,7 +980,7 @@ static char encoding_table[] = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J'
                                 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
                                 '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/'};
 
-static int mod_table[] = {0, 2, 1};
+static size_t mod_table[] = {0, 2, 1};
 
 // pass in a pointer to the data, its length, a pointer to the output buffer and
 // a pointer to an int
@@ -992,7 +995,7 @@ char *base64_encode_so(const unsigned char *data, size_t input_length, char *enc
     return (NULL);
   *output_length = calculated_output_length;
 
-  int i, j;
+  size_t i, j;
   for (i = 0, j = 0; i < input_length;) {
 
     uint32_t octet_a = i < input_length ? (unsigned char)data[i++] : 0;
@@ -1136,7 +1139,7 @@ void metadata_process(uint32_t type, uint32_t code, char *data, uint32_t length)
       v = htonl(code);
       memcpy(ptr, &v, 4);
       ptr += 4;
-      uint32_t datalen = remaining;
+      size_t datalen = remaining;
       if (datalen > config.metadata_sockmsglength - 24) {
         datalen = config.metadata_sockmsglength - 24;
       }
@@ -1212,7 +1215,7 @@ void metadata_process(uint32_t type, uint32_t code, char *data, uint32_t length)
   }
 }
 
-void *metadata_thread_function(void *ignore) {
+void *metadata_thread_function(__attribute__((unused)) void *ignore) {
   metadata_create();
   metadata_package pack;
   while (1) {
@@ -1285,10 +1288,11 @@ int send_metadata(uint32_t type, uint32_t code, char *data, uint32_t length, rts
   return rc;
 }
 
-static void handle_set_parameter_metadata(rtsp_conn_info *conn, rtsp_message *req,
-                                          rtsp_message *resp) {
+static void handle_set_parameter_metadata(__attribute__((unused)) rtsp_conn_info *conn,
+                                          rtsp_message *req,
+                                          __attribute__((unused)) rtsp_message *resp) {
   char *cp = req->content;
-  int cl = req->contentlength;
+  unsigned int cl = req->contentlength;
 
   unsigned int off = 8;
 
@@ -1317,7 +1321,8 @@ static void handle_set_parameter_metadata(rtsp_conn_info *conn, rtsp_message *re
 
 #endif
 
-static void handle_get_parameter(rtsp_conn_info *conn, rtsp_message *req, rtsp_message *resp) {
+static void handle_get_parameter(__attribute__((unused)) rtsp_conn_info *conn, rtsp_message *req,
+                                 rtsp_message *resp) {
   // debug(1, "Connection %d: GET_PARAMETER", conn->connection_number);
   // debug_print_msg_headers(1,req);
   // debug_print_msg_content(1,req);
@@ -1562,7 +1567,7 @@ static void handle_announce(rtsp_conn_info *conn, rtsp_message *req, rtsp_messag
       memcpy(conn->stream.aeskey, aeskey, 16);
       free(aeskey);
     }
-    int i;
+    unsigned int i;
     for (i = 0; i < sizeof(conn->stream.fmtp) / sizeof(conn->stream.fmtp[0]); i++)
       conn->stream.fmtp[i] = atoi(strsep(&pfmtp, " \t"));
     // here we should check the sanity ot the fmtp values
index 566e82185fc0b6fac7c0787aa3f5c1af6e7dcc54..05ec5f7bb2922f6a12fe405d187295496ff49ec9 100644 (file)
@@ -6,8 +6,9 @@
 
 GMainLoop *loop;
 
-void on_properties_changed(GDBusProxy *proxy, GVariant *changed_properties,
-                           const gchar *const *invalidated_properties, gpointer user_data) {
+void on_properties_changed(__attribute__((unused)) GDBusProxy *proxy, GVariant *changed_properties,
+                           const gchar *const *invalidated_properties,
+                           __attribute__((unused)) gpointer user_data) {
   /* Note that we are guaranteed that changed_properties and
    * invalidated_properties are never NULL
    */
@@ -38,7 +39,8 @@ void on_properties_changed(GDBusProxy *proxy, GVariant *changed_properties,
   }
 }
 
-void notify_loudness_filter_active_callback(ShairportSync *proxy, gpointer user_data) {
+void notify_loudness_filter_active_callback(ShairportSync *proxy,
+                                            __attribute__((unused)) gpointer user_data) {
   //  printf("\"notify_loudness_filter_active_callback\" called with a gpointer of
   //  %lx.\n",(int64_t)user_data);
   gboolean ebl = shairport_sync_get_loudness_filter_active(proxy);
@@ -48,18 +50,19 @@ void notify_loudness_filter_active_callback(ShairportSync *proxy, gpointer user_
     printf("Client reports loudness is disabled.\n");
 }
 
-void notify_loudness_threshold_callback(ShairportSync *proxy, gpointer user_data) {
+void notify_loudness_threshold_callback(ShairportSync *proxy,
+                                        __attribute__((unused)) gpointer user_data) {
   gdouble th = shairport_sync_get_loudness_threshold(proxy);
   printf("Client reports loudness threshold set to %.2f dB.\n", th);
 }
 
-void notify_volume_callback(ShairportSync *proxy, gpointer user_data) {
+void notify_volume_callback(ShairportSync *proxy, __attribute__((unused)) gpointer user_data) {
   gdouble th = shairport_sync_get_volume(proxy);
   printf("Client reports volume set to %.2f.\n", th);
 }
 
 pthread_t dbus_thread;
-void *dbus_thread_func(void *arg) {
+void *dbus_thread_func(__attribute__((unused)) void *arg) {
 
   loop = g_main_loop_new(NULL, FALSE);
 
@@ -85,7 +88,7 @@ int main(int argc, char *argv[]) {
        "Listen on the D-Bus session bus -- pick this option or the \'--system\' option, but not "
        "both.",
        NULL},
-      POPT_AUTOHELP{NULL, 0, 0, NULL, 0}};
+      POPT_AUTOHELP{NULL, 0, 0, NULL, 0, NULL, NULL}};
 
   optCon = poptGetContext(NULL, argc, (const char **)argv, optionsTable, 0);
   poptSetOtherOptionHelp(optCon, "[--system | --session]");
index dcff138022f7aa8b26d3a0788753d1202e63268a..c2daa5b701d6f430d15affcb7bcf9ee7f0b2b79e 100644 (file)
@@ -7,8 +7,9 @@
 
 GMainLoop *loop;
 
-void on_properties_changed(GDBusProxy *proxy, GVariant *changed_properties,
-                           const gchar *const *invalidated_properties, gpointer user_data) {
+void on_properties_changed(__attribute__((unused)) GDBusProxy *proxy, GVariant *changed_properties,
+                           const gchar *const *invalidated_properties,
+                           __attribute__((unused)) gpointer user_data) {
   /* Note that we are guaranteed that changed_properties and
    * invalidated_properties are never NULL
    */
@@ -40,7 +41,7 @@ void on_properties_changed(GDBusProxy *proxy, GVariant *changed_properties,
 }
 
 pthread_t dbus_thread;
-void *dbus_thread_func(void *arg) {
+void *dbus_thread_func(__attribute__((unused)) void *arg) {
 
   loop = g_main_loop_new(NULL, FALSE);
 
@@ -63,7 +64,7 @@ int main(int argc, char *argv[]) {
        "Listen on the D-Bus session bus -- pick this option or the \'--system\' option, but not "
        "both.",
        NULL},
-      POPT_AUTOHELP{NULL, 0, 0, NULL, 0}};
+      POPT_AUTOHELP{NULL, 0, 0, NULL, 0, NULL, NULL}};
 
   optCon = poptGetContext(NULL, argc, (const char **)argv, optionsTable, 0);
   poptSetOtherOptionHelp(optCon, "[--system | --session]");
index a0e723a1b9d500c7db0c4a256accab52cf909f32..8b070f7eb1f3de78293ab90f68375b91446b12ca 100644 (file)
@@ -104,8 +104,10 @@ void shairport_shutdown() {
     config.output->deinit();
 }
 
-static void sig_ignore(int foo, siginfo_t *bar, void *baz) {}
-static void sig_shutdown(int foo, siginfo_t *bar, void *baz) {
+static void sig_ignore(__attribute__((unused)) int foo, __attribute__((unused)) siginfo_t *bar,
+                       __attribute__((unused)) void *baz) {}
+static void sig_shutdown(__attribute__((unused)) int foo, __attribute__((unused)) siginfo_t *bar,
+                         __attribute__((unused)) void *baz) {
   debug(1, "shutdown requested...");
   shairport_shutdown();
   //  daemon_log(LOG_NOTICE, "exit...");
@@ -114,7 +116,8 @@ static void sig_shutdown(int foo, siginfo_t *bar, void *baz) {
   exit(0);
 }
 
-static void sig_child(int foo, siginfo_t *bar, void *baz) {
+static void sig_child(__attribute__((unused)) int foo, __attribute__((unused)) siginfo_t *bar,
+                      __attribute__((unused)) void *baz) {
   pid_t pid;
   while ((pid = waitpid((pid_t)-1, 0, WNOHANG)) > 0) {
     if (pid == mdns_pid && !shutting_down) {
@@ -123,12 +126,16 @@ static void sig_child(int foo, siginfo_t *bar, void *baz) {
   }
 }
 
-static void sig_disconnect_audio_output(int foo, siginfo_t *bar, void *baz) {
+static void sig_disconnect_audio_output(__attribute__((unused)) int foo,
+                                        __attribute__((unused)) siginfo_t *bar,
+                                        __attribute__((unused)) void *baz) {
   debug(1, "disconnect audio output requested.");
   set_requested_connection_state_to_output(0);
 }
 
-static void sig_connect_audio_output(int foo, siginfo_t *bar, void *baz) {
+static void sig_connect_audio_output(__attribute__((unused)) int foo,
+                                     __attribute__((unused)) siginfo_t *bar,
+                                     __attribute__((unused)) void *baz) {
   debug(1, "connect audio output requested.");
   set_requested_connection_state_to_output(1);
 }
@@ -295,34 +302,34 @@ int parse_options(int argc, char **argv) {
   int daemonisewith = 0;
   int daemonisewithout = 0;
   struct poptOption optionsTable[] = {
-      {"verbose", 'v', POPT_ARG_NONE, NULL, 'v', NULL},
-      {"disconnectFromOutput", 'D', POPT_ARG_NONE, NULL, 0, NULL},
-      {"reconnectToOutput", 'R', POPT_ARG_NONE, NULL, 0, NULL},
-      {"kill", 'k', POPT_ARG_NONE, NULL, 0, NULL},
-      {"daemon", 'd', POPT_ARG_NONE, &daemonisewith, 0, NULL},
-      {"justDaemoniseNoPIDFile", 'j', POPT_ARG_NONE, &daemonisewithout, 0, NULL},
-      {"configfile", 'c', POPT_ARG_STRING, &config.configfile, 0, NULL},
-      {"statistics", 0, POPT_ARG_NONE, &config.statistics_requested, 0, NULL},
-      {"logOutputLevel", 0, POPT_ARG_NONE, &config.logOutputLevel, 0, NULL},
-      {"version", 'V', POPT_ARG_NONE, NULL, 0, NULL},
-      {"port", 'p', POPT_ARG_INT, &config.port, 0, NULL},
-      {"name", 'a', POPT_ARG_STRING, &raw_service_name, 0, NULL},
-      {"output", 'o', POPT_ARG_STRING, &config.output_name, 0, NULL},
-      {"on-start", 'B', POPT_ARG_STRING, &config.cmd_start, 0, NULL},
-      {"on-stop", 'E', POPT_ARG_STRING, &config.cmd_stop, 0, NULL},
-      {"wait-cmd", 'w', POPT_ARG_NONE, &config.cmd_blocking, 0, NULL},
-      {"mdns", 'm', POPT_ARG_STRING, &config.mdns_name, 0, NULL},
-      {"latency", 'L', POPT_ARG_INT, &config.userSuppliedLatency, 0, NULL},
-      {"stuffing", 'S', POPT_ARG_STRING, &stuffing, 'S', NULL},
-      {"resync", 'r', POPT_ARG_INT, &fResyncthreshold, 0, NULL},
-      {"timeout", 't', POPT_ARG_INT, &config.timeout, 't', NULL},
-      {"password", 0, POPT_ARG_STRING, &config.password, 0, NULL},
-      {"tolerance", 'z', POPT_ARG_INT, &fTolerance, 0, NULL},
+      {"verbose", 'v', POPT_ARG_NONE, NULL, 'v', NULL, NULL},
+      {"disconnectFromOutput", 'D', POPT_ARG_NONE, NULL, 0, NULL, NULL},
+      {"reconnectToOutput", 'R', POPT_ARG_NONE, NULL, 0, NULL, NULL},
+      {"kill", 'k', POPT_ARG_NONE, NULL, 0, NULL, NULL},
+      {"daemon", 'd', POPT_ARG_NONE, &daemonisewith, 0, NULL, NULL},
+      {"justDaemoniseNoPIDFile", 'j', POPT_ARG_NONE, &daemonisewithout, 0, NULL, NULL},
+      {"configfile", 'c', POPT_ARG_STRING, &config.configfile, 0, NULL, NULL},
+      {"statistics", 0, POPT_ARG_NONE, &config.statistics_requested, 0, NULL, NULL},
+      {"logOutputLevel", 0, POPT_ARG_NONE, &config.logOutputLevel, 0, NULL, NULL},
+      {"version", 'V', POPT_ARG_NONE, NULL, 0, NULL, NULL},
+      {"port", 'p', POPT_ARG_INT, &config.port, 0, NULL, NULL},
+      {"name", 'a', POPT_ARG_STRING, &raw_service_name, 0, NULL, NULL},
+      {"output", 'o', POPT_ARG_STRING, &config.output_name, 0, NULL, NULL},
+      {"on-start", 'B', POPT_ARG_STRING, &config.cmd_start, 0, NULL, NULL},
+      {"on-stop", 'E', POPT_ARG_STRING, &config.cmd_stop, 0, NULL, NULL},
+      {"wait-cmd", 'w', POPT_ARG_NONE, &config.cmd_blocking, 0, NULL, NULL},
+      {"mdns", 'm', POPT_ARG_STRING, &config.mdns_name, 0, NULL, NULL},
+      {"latency", 'L', POPT_ARG_INT, &config.userSuppliedLatency, 0, NULL, NULL},
+      {"stuffing", 'S', POPT_ARG_STRING, &stuffing, 'S', NULL, NULL},
+      {"resync", 'r', POPT_ARG_INT, &fResyncthreshold, 0, NULL, NULL},
+      {"timeout", 't', POPT_ARG_INT, &config.timeout, 't', NULL, NULL},
+      {"password", 0, POPT_ARG_STRING, &config.password, 0, NULL, NULL},
+      {"tolerance", 'z', POPT_ARG_INT, &fTolerance, 0, NULL, NULL},
 #ifdef CONFIG_METADATA
-      {"metadata-pipename", 'M', POPT_ARG_STRING, &config.metadata_pipename, 'M', NULL},
-      {"get-coverart", 'g', POPT_ARG_NONE, &config.get_coverart, 'g', NULL},
+      {"metadata-pipename", 'M', POPT_ARG_STRING, &config.metadata_pipename, 'M', NULL, NULL},
+      {"get-coverart", 'g', POPT_ARG_NONE, &config.get_coverart, 'g', NULL, NULL},
 #endif
-      POPT_AUTOHELP{NULL, 0, 0, NULL, 0}};
+      POPT_AUTOHELP{NULL, 0, 0, NULL, 0, NULL, NULL}};
 
   // we have to parse the command line arguments to look for a config file
   int optind;
@@ -1019,7 +1026,7 @@ int parse_options(int argc, char **argv) {
 GMainLoop *loop;
 
 pthread_t dbus_thread;
-void *dbus_thread_func(void *arg) {
+void *dbus_thread_func(__attribute__((unused)) void *arg) {
   loop = g_main_loop_new(NULL, FALSE);
   g_main_loop_run(loop);
   return NULL;