[gssdp] Fix compilation with -Wall -Wextra



commit c132e35dd7c93b5cdcf76987149339cea4caa5dc
Author: Jens Georg <jensg openismus com>
Date:   Wed Apr 17 14:47:41 2013 +0200

    Fix compilation with -Wall -Wextra

 libgssdp/gssdp-client.c           | 16 +++++------
 libgssdp/gssdp-resource-browser.c | 16 +++++++----
 libgssdp/gssdp-resource-group.c   |  4 +--
 libgssdp/gssdp-socket-functions.c |  6 +++++
 libgssdp/gssdp-socket-source.c    |  6 ++---
 tests/gtest/test-util.c           | 14 +++++-----
 tests/test-browser.c              |  8 +++---
 tests/test-publish.c              |  4 +--
 tools/gssdp-device-sniffer.c      | 56 +++++++++++++++++++++------------------
 9 files changed, 73 insertions(+), 57 deletions(-)
---
diff --git a/libgssdp/gssdp-client.c b/libgssdp/gssdp-client.c
index 9770035..dfe904d 100644
--- a/libgssdp/gssdp-client.c
+++ b/libgssdp/gssdp-client.c
@@ -164,7 +164,7 @@ gssdp_client_init (GSSDPClient *client)
 
 static void
 gssdp_client_initable_iface_init (gpointer g_iface,
-                                  gpointer iface_data)
+                                  G_GNUC_UNUSED gpointer iface_data)
 {
         GInitableIface *iface = (GInitableIface *)g_iface;
         iface->init = gssdp_client_initable_init;
@@ -172,7 +172,7 @@ gssdp_client_initable_iface_init (gpointer g_iface,
 
 static gboolean
 gssdp_client_initable_init (GInitable     *initable,
-                            GCancellable  *cancellable,
+                            G_GNUC_UNUSED GCancellable *cancellable,
                             GError       **error)
 {
         GSSDPClient *client = GSSDP_CLIENT (initable);
@@ -1052,8 +1052,8 @@ out:
 }
 
 static gboolean
-request_socket_source_cb (GIOChannel  *source,
-                          GIOCondition condition,
+request_socket_source_cb (G_GNUC_UNUSED GIOChannel  *source,
+                          G_GNUC_UNUSED GIOCondition condition,
                           gpointer     user_data)
 {
         GSSDPClient *client;
@@ -1064,8 +1064,8 @@ request_socket_source_cb (GIOChannel  *source,
 }
 
 static gboolean
-multicast_socket_source_cb (GIOChannel  *source,
-                            GIOCondition condition,
+multicast_socket_source_cb (G_GNUC_UNUSED GIOChannel  *source,
+                            G_GNUC_UNUSED GIOCondition condition,
                             gpointer     user_data)
 {
         GSSDPClient *client;
@@ -1076,8 +1076,8 @@ multicast_socket_source_cb (GIOChannel  *source,
 }
 
 static gboolean
-search_socket_source_cb (GIOChannel  *source,
-                         GIOCondition condition,
+search_socket_source_cb (G_GNUC_UNUSED GIOChannel  *source,
+                         G_GNUC_UNUSED GIOCondition condition,
                          gpointer     user_data)
 {
         GSSDPClient *client;
diff --git a/libgssdp/gssdp-resource-browser.c b/libgssdp/gssdp-resource-browser.c
index b4ca354..b4957fb 100644
--- a/libgssdp/gssdp-resource-browser.c
+++ b/libgssdp/gssdp-resource-browser.c
@@ -913,7 +913,11 @@ check_target_compat (GSSDPResourceBrowser *resource_browser,
         g_free (tmp);
         g_match_info_free (info);
 
-        return version >= resource_browser->priv->version;
+        if (version < 0) {
+            return FALSE;
+        }
+
+        return (uint) version >= resource_browser->priv->version;
 }
 
 static void
@@ -964,9 +968,9 @@ received_announcement (GSSDPResourceBrowser *resource_browser,
  * Received a message
  */
 static void
-message_received_cb (GSSDPClient        *client,
-                     const char         *from_ip,
-                     gushort             from_port,
+message_received_cb (G_GNUC_UNUSED GSSDPClient        *client,
+                     G_GNUC_UNUSED const char         *from_ip,
+                     G_GNUC_UNUSED gushort             from_port,
                      _GSSDPMessageType   type,
                      SoupMessageHeaders *headers,
                      gpointer            user_data)
@@ -1008,7 +1012,9 @@ resource_free (gpointer data)
 }
 
 static gboolean
-clear_cache_helper (gpointer key, gpointer value, gpointer data)
+clear_cache_helper (G_GNUC_UNUSED gpointer key,
+                    gpointer value,
+                    G_GNUC_UNUSED gpointer data)
 {
         Resource *resource;
 
diff --git a/libgssdp/gssdp-resource-group.c b/libgssdp/gssdp-resource-group.c
index 262a865..af83212 100644
--- a/libgssdp/gssdp-resource-group.c
+++ b/libgssdp/gssdp-resource-group.c
@@ -738,7 +738,7 @@ resource_group_timeout (gpointer user_data)
  * Received a message
  */
 static void
-message_received_cb (GSSDPClient        *client,
+message_received_cb (G_GNUC_UNUSED GSSDPClient        *client,
                      const char         *from_ip,
                      gushort             from_port,
                      _GSSDPMessageType   type,
@@ -807,7 +807,7 @@ message_received_cb (GSSDPClient        *client,
                                     target,
                                     0,
                                     NULL) &&
-                     version <= resource->version)) {
+                     (guint) version <= resource->version)) {
                         /* Match. */
                         guint timeout;
                         DiscoveryResponse *response;
diff --git a/libgssdp/gssdp-socket-functions.c b/libgssdp/gssdp-socket-functions.c
index 8f4ea36..4669f96 100644
--- a/libgssdp/gssdp-socket-functions.c
+++ b/libgssdp/gssdp-socket-functions.c
@@ -153,6 +153,8 @@ gssdp_socket_mcast_interface_set (GSocket      *socket,
                                         error);
 }
 
+#define __GSSDP_UNUSED(x) (void)(x)
+
 gboolean
 gssdp_socket_reuse_address (GSocket *socket,
                             gboolean enable,
@@ -169,6 +171,10 @@ gssdp_socket_reuse_address (GSocket *socket,
                                         (char *) &enable,
                                         sizeof (enable),
                                         error);
+#else
+        __GSSDP_UNUSED(socket);
+        __GSSDP_UNUSED(enable);
+        __GSSDP_UNUSED(error);
 #endif
         return TRUE;
 }
diff --git a/libgssdp/gssdp-socket-source.c b/libgssdp/gssdp-socket-source.c
index aa32c63..8c1e81c 100644
--- a/libgssdp/gssdp-socket-source.c
+++ b/libgssdp/gssdp-socket-source.c
@@ -74,7 +74,7 @@ gssdp_socket_source_do_init (GInitable     *initable,
 
 static void
 gssdp_socket_source_initable_init (gpointer g_iface,
-                                   gpointer iface_data)
+                                   G_GNUC_UNUSED gpointer iface_data)
 {
         GInitableIface *iface = (GInitableIface *)g_iface;
         iface->init = gssdp_socket_source_do_init;
@@ -83,7 +83,7 @@ gssdp_socket_source_initable_init (gpointer g_iface,
 static void
 gssdp_socket_source_get_property (GObject    *object,
                                   guint       property_id,
-                                  GValue     *value,
+                                  G_GNUC_UNUSED GValue     *value,
                                   GParamSpec *pspec)
 {
         /* All properties are construct-only, write-only */
@@ -145,7 +145,7 @@ gssdp_socket_source_new (GSSDPSocketSourceType type,
 
 static gboolean
 gssdp_socket_source_do_init (GInitable     *initable,
-                             GCancellable  *cancellable,
+                             G_GNUC_UNUSED GCancellable  *cancellable,
                              GError       **error)
 {
         GSSDPSocketSource *self = NULL;
diff --git a/tests/gtest/test-util.c b/tests/gtest/test-util.c
index 6349eaa..7bf87fd 100644
--- a/tests/gtest/test-util.c
+++ b/tests/gtest/test-util.c
@@ -22,18 +22,18 @@
 #include "test-util.h"
 
 void
-on_resource_unavailable_assert_not_reached (GSSDPResourceBrowser *src,
-                                            const char           *usn,
-                                            gpointer              user_data)
+on_resource_unavailable_assert_not_reached (G_GNUC_UNUSED GSSDPResourceBrowser *src,
+                                            G_GNUC_UNUSED const char           *usn,
+                                            G_GNUC_UNUSED gpointer              user_data)
 {
         g_assert_not_reached ();
 }
 
 void
-on_resource_available_assert_not_reached (GSSDPResourceBrowser *src,
-                                          const char           *usn,
-                                          GList                *locations,
-                                          gpointer              user_data)
+on_resource_available_assert_not_reached (G_GNUC_UNUSED GSSDPResourceBrowser *src,
+                                          G_GNUC_UNUSED const char           *usn,
+                                          G_GNUC_UNUSED GList                *locations,
+                                          G_GNUC_UNUSED gpointer              user_data)
 {
         g_assert_not_reached ();
 }
diff --git a/tests/test-browser.c b/tests/test-browser.c
index c09b017..125d95f 100644
--- a/tests/test-browser.c
+++ b/tests/test-browser.c
@@ -24,7 +24,7 @@
 #include <stdlib.h>
 
 static void
-resource_available_cb (GSSDPResourceBrowser *resource_browser,
+resource_available_cb (G_GNUC_UNUSED GSSDPResourceBrowser *resource_browser,
                        const char           *usn,
                        GList                *locations)
 {
@@ -39,7 +39,7 @@ resource_available_cb (GSSDPResourceBrowser *resource_browser,
 }
 
 static void
-resource_unavailable_cb (GSSDPResourceBrowser *resource_browser,
+resource_unavailable_cb (G_GNUC_UNUSED GSSDPResourceBrowser *resource_browser,
                          const char           *usn)
 {
         g_print ("resource unavailable\n"
@@ -48,8 +48,8 @@ resource_unavailable_cb (GSSDPResourceBrowser *resource_browser,
 }
 
 int
-main (int    argc,
-      char **argv)
+main (G_GNUC_UNUSED int    argc,
+      G_GNUC_UNUSED char **argv)
 {
         GSSDPClient *client;
         GSSDPResourceBrowser *resource_browser;
diff --git a/tests/test-publish.c b/tests/test-publish.c
index 601bbfb..e77ca4c 100644
--- a/tests/test-publish.c
+++ b/tests/test-publish.c
@@ -24,8 +24,8 @@
 #include <stdlib.h>
 
 int
-main (int    argc,
-      char **argv)
+main (G_GNUC_UNUSED int    argc,
+      G_GNUC_UNUSED char **argv)
 {
         GSSDPClient *client;
         GSSDPResourceGroup *resource_group;
diff --git a/tools/gssdp-device-sniffer.c b/tools/gssdp-device-sniffer.c
index 72280a1..80035c5 100644
--- a/tools/gssdp-device-sniffer.c
+++ b/tools/gssdp-device-sniffer.c
@@ -43,7 +43,8 @@ GOptionEntry entries[] =
 
 G_MODULE_EXPORT
 void
-on_enable_packet_capture_activate (GtkCheckMenuItem *menuitem, gpointer user_data)
+on_enable_packet_capture_activate (GtkCheckMenuItem      *menuitem,
+                                   G_GNUC_UNUSED gpointer user_data)
 {
         capture_packets = gtk_check_menu_item_get_active (menuitem);
 }
@@ -133,7 +134,8 @@ display_packet (time_t arrival_time, SoupMessageHeaders *packet_headers)
 }
 
 static void
-on_packet_selected (GtkTreeSelection *selection, gpointer user_data)
+on_packet_selected (GtkTreeSelection      *selection,
+                    G_GNUC_UNUSED gpointer user_data)
 {
         GtkTreeModel *model;
         GtkTreeIter iter;
@@ -156,7 +158,8 @@ on_packet_selected (GtkTreeSelection *selection, gpointer user_data)
 
 G_MODULE_EXPORT
 void
-on_clear_packet_capture_activate (GtkMenuItem *menuitem, gpointer user_data)
+on_clear_packet_capture_activate (G_GNUC_UNUSED GtkMenuItem *menuitem,
+                                  G_GNUC_UNUSED gpointer     user_data)
 {
         clear_packet_treeview ();
 }
@@ -164,10 +167,10 @@ on_clear_packet_capture_activate (GtkMenuItem *menuitem, gpointer user_data)
 static char *message_types[] = {"M-SEARCH", "RESPONSE", "NOTIFY"};
 
 static char **
-packet_to_treeview_data (const gchar *from_ip,
-                time_t arrival_time,
-                _GSSDPMessageType type,
-                SoupMessageHeaders *headers)
+packet_to_treeview_data (const gchar        *from_ip,
+                         time_t              arrival_time,
+                         _GSSDPMessageType   type,
+                         SoupMessageHeaders *headers)
 {
         char **packet_data;
         const char *target;
@@ -230,12 +233,12 @@ append_packet (const gchar *from_ip,
 }
 
 static void
-on_ssdp_message (GSSDPClient *client,
-                const gchar *from_ip,
-                gushort from_port,
-                _GSSDPMessageType type,
-                SoupMessageHeaders *headers,
-                gpointer user_data)
+on_ssdp_message (GSSDPClient *client G_GNUC_UNUSED,
+                 const gchar *from_ip,
+                 gushort from_port G_GNUC_UNUSED,
+                 _GSSDPMessageType type,
+                 SoupMessageHeaders *headers,
+                 gpointer user_data G_GNUC_UNUSED)
 {
         time_t arrival_time;
         
@@ -305,9 +308,9 @@ append_device (const char *uuid,
 }
 
 static void
-resource_available_cb (GSSDPResourceBrowser *resource_browser,
-                       const char           *usn,
-                       GList                *locations)
+resource_available_cb (G_GNUC_UNUSED GSSDPResourceBrowser *resource_browser,
+                       const char                         *usn,
+                       GList                              *locations)
 {
 
         char **usn_tokens;
@@ -367,8 +370,8 @@ remove_device (const char *uuid)
 }
 
 static void
-resource_unavailable_cb (GSSDPResourceBrowser *resource_browser,
-                         const char           *usn)
+resource_unavailable_cb (G_GNUC_UNUSED GSSDPResourceBrowser *resource_browser,
+                         const char                         *usn)
 {
         char **usn_tokens;
         char *uuid;
@@ -384,8 +387,8 @@ resource_unavailable_cb (GSSDPResourceBrowser *resource_browser,
 
 G_MODULE_EXPORT
 void
-on_use_filter_radiobutton_toggled (GtkToggleButton *togglebutton,
-                gpointer         user_data)
+on_use_filter_radiobutton_toggled (GtkToggleButton       *togglebutton,
+                                   G_GNUC_UNUSED gpointer user_data)
 {
         GtkWidget *filter_hbox;
         gboolean use_filter;
@@ -424,9 +427,9 @@ get_ip_filter ()
 
 G_MODULE_EXPORT
 void
-on_address_filter_dialog_response (GtkDialog *dialog,
-                gint       response,
-                gpointer   user_data)
+on_address_filter_dialog_response (GtkDialog             *dialog,
+                                   G_GNUC_UNUSED gint     response,
+                                   G_GNUC_UNUSED gpointer user_data)
 {
         GtkWidget *use_filter_radio;
 
@@ -544,11 +547,12 @@ setup_treeviews ()
 
 G_MODULE_EXPORT
 gboolean
-on_delete_event (GtkWidget *widget,
-                GdkEvent  *event,
-                gpointer   user_data)
+on_delete_event (G_GNUC_UNUSED GtkWidget *widget,
+                 G_GNUC_UNUSED GdkEvent  *event,
+                 G_GNUC_UNUSED gpointer   user_data)
 {
         gtk_main_quit ();
+
         return TRUE;
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]