From dee0e9ab8f63d1b022a7ac011a921db48acc1cd7 Mon Sep 17 00:00:00 2001 From: Scott Balneaves Date: Tue, 13 Nov 2012 21:44:26 -0600 Subject: Fix all compile warnings. --- capplet/gsm-app-dialog.c | 9 +++++++-- mate-session/gs-idle-monitor.c | 10 +++++----- mate-session/gsm-autostart-app.c | 8 +++++++- mate-session/gsm-consolekit.c | 13 +++++++++++++ mate-session/gsm-inhibit-dialog.c | 4 ++++ mate-session/gsm-manager.c | 23 +++++++++++++++-------- mate-session/mdm-signal-handler.c | 8 +++++++- mate-session/test-client-dbus.c | 8 +++++++- mate-session/test-inhibit.c | 8 +++++++- 9 files changed, 72 insertions(+), 19 deletions(-) diff --git a/capplet/gsm-app-dialog.c b/capplet/gsm-app-dialog.c index b8938fd..b4ca56a 100644 --- a/capplet/gsm-app-dialog.c +++ b/capplet/gsm-app-dialog.c @@ -35,9 +35,14 @@ #define CAPPLET_COMMENT_ENTRY_WIDGET_NAME "session_properties_comment_entry" #define CAPPLET_BROWSE_WIDGET_NAME "session_properties_browse_button" - #define GSM_APP_DIALOG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSM_TYPE_APP_DIALOG, GsmAppDialogPrivate)) +#ifdef __GNUC__ +#define UNUSED_VARIABLE __attribute__ ((unused)) +#else +#define UNUSED_VARIABLE +#endif + struct GsmAppDialogPrivate { GtkWidget *name_entry; @@ -473,7 +478,7 @@ gsm_app_dialog_run (GsmAppDialog *dialog, GError *error; char **argv; int argc; - gboolean changed; + gboolean UNUSED_VARIABLE changed; name = gsm_app_dialog_get_name (GSM_APP_DIALOG (dialog)); exec = gsm_app_dialog_get_command (GSM_APP_DIALOG (dialog)); diff --git a/mate-session/gs-idle-monitor.c b/mate-session/gs-idle-monitor.c index bfde3ca..e2d51f0 100644 --- a/mate-session/gs-idle-monitor.c +++ b/mate-session/gs-idle-monitor.c @@ -193,7 +193,7 @@ handle_alarm_notify_event (GSIdleMonitor *monitor, return; } - g_debug ("Watch %d fired, idle time = %lld", + g_debug ("Watch %d fired, idle time = %ld", watch->id, _xsyncvalue_to_int64 (alarm_event->counter_value)); @@ -450,22 +450,22 @@ _xsync_alarm_set (GSIdleMonitor *monitor, attr.trigger.test_type = XSyncPositiveTransition; if (watch->xalarm_positive != None) { - g_debug ("GSIdleMonitor: updating alarm for positive transition wait=%lld", + g_debug ("GSIdleMonitor: updating alarm for positive transition wait=%ld", _xsyncvalue_to_int64 (attr.trigger.wait_value)); XSyncChangeAlarm (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), watch->xalarm_positive, flags, &attr); } else { - g_debug ("GSIdleMonitor: creating new alarm for positive transition wait=%lld", + g_debug ("GSIdleMonitor: creating new alarm for positive transition wait=%ld", _xsyncvalue_to_int64 (attr.trigger.wait_value)); watch->xalarm_positive = XSyncCreateAlarm (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), flags, &attr); } attr.trigger.test_type = XSyncNegativeTransition; if (watch->xalarm_negative != None) { - g_debug ("GSIdleMonitor: updating alarm for negative transition wait=%lld", + g_debug ("GSIdleMonitor: updating alarm for negative transition wait=%ld", _xsyncvalue_to_int64 (attr.trigger.wait_value)); XSyncChangeAlarm (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), watch->xalarm_negative, flags, &attr); } else { - g_debug ("GSIdleMonitor: creating new alarm for negative transition wait=%lld", + g_debug ("GSIdleMonitor: creating new alarm for negative transition wait=%ld", _xsyncvalue_to_int64 (attr.trigger.wait_value)); watch->xalarm_negative = XSyncCreateAlarm (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), flags, &attr); } diff --git a/mate-session/gsm-autostart-app.c b/mate-session/gsm-autostart-app.c index 5dd463b..ef22911 100644 --- a/mate-session/gsm-autostart-app.c +++ b/mate-session/gsm-autostart-app.c @@ -32,6 +32,12 @@ #include "gsm-autostart-app.h" #include "gsm-util.h" +#ifdef __GNUC__ +#define UNUSED_VARIABLE __attribute__ ((unused)) +#else +#define UNUSED_VARIABLE +#endif + enum { AUTOSTART_LAUNCH_SPAWN = 0, AUTOSTART_LAUNCH_ACTIVATE @@ -316,7 +322,7 @@ setup_condition_monitor (GsmAutostartApp *app) guint kind; char *key; gboolean res; - gboolean disabled; + gboolean UNUSED_VARIABLE disabled; if (app->priv->condition_monitor != NULL) { g_file_monitor_cancel (app->priv->condition_monitor); diff --git a/mate-session/gsm-consolekit.c b/mate-session/gsm-consolekit.c index c5eadb0..e04ae76 100644 --- a/mate-session/gsm-consolekit.c +++ b/mate-session/gsm-consolekit.c @@ -791,6 +791,12 @@ gsm_consolekit_can_restart (GsmConsolekit *manager) G_TYPE_INVALID, G_TYPE_BOOLEAN, &can_restart, G_TYPE_INVALID); + if (res == FALSE) { + g_warning ("Could not make DBUS call: %s", + error->message); + g_error_free (error); + return FALSE; + } return can_restart; } @@ -819,6 +825,13 @@ gsm_consolekit_can_stop (GsmConsolekit *manager) G_TYPE_BOOLEAN, &can_stop, G_TYPE_INVALID); + if (res == FALSE) { + g_warning ("Could not make DBUS call: %s", + error->message); + g_error_free (error); + return FALSE; + } + return can_stop; } diff --git a/mate-session/gsm-inhibit-dialog.c b/mate-session/gsm-inhibit-dialog.c index 047524f..3d4e85c 100644 --- a/mate-session/gsm-inhibit-dialog.c +++ b/mate-session/gsm-inhibit-dialog.c @@ -401,8 +401,10 @@ get_pixmap_for_window (Window window) Picture src_picture; Picture dst_picture; gboolean has_alpha; +#if 0 int x; int y; +#endif int width; int height; @@ -410,8 +412,10 @@ get_pixmap_for_window (Window window) format = XRenderFindVisualFormat (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), attr.visual); has_alpha = (format->type == PictTypeDirect && format->direct.alphaMask); +#if 0 x = attr.x; y = attr.y; +#endif width = attr.width; height = attr.height; diff --git a/mate-session/gsm-manager.c b/mate-session/gsm-manager.c index 54f7ee2..8b2e024 100644 --- a/mate-session/gsm-manager.c +++ b/mate-session/gsm-manager.c @@ -89,6 +89,12 @@ #define IS_STRING_EMPTY(x) ((x)==NULL||(x)[0]=='\0') +#ifdef __GNUC__ +#define UNUSED_VARIABLE __attribute__ ((unused)) +#else +#define UNUSED_VARIABLE +#endif + typedef enum { GSM_MANAGER_LOGOUT_NONE, @@ -288,12 +294,11 @@ app_condition_changed (GsmApp *app, if (condition) { if (!gsm_app_is_running (app) && client == NULL) { - GError *error; - gboolean res; + GError *error = NULL; + gboolean UNUSED_VARIABLE res; g_debug ("GsmManager: starting app '%s'", gsm_app_peek_id (app)); - error = NULL; res = gsm_app_start (app, &error); if (error != NULL) { g_warning ("Not able to start app from its condition: %s", @@ -305,7 +310,7 @@ app_condition_changed (GsmApp *app, } } else { GError *error; - gboolean res; + gboolean UNUSED_VARIABLE res; if (client != NULL) { /* Kill client in case condition if false and make sure it won't @@ -1473,7 +1478,7 @@ _disconnect_client (GsmManager *manager, gboolean is_condition_client; GsmApp *app; GError *error; - gboolean res; + gboolean UNUSED_VARIABLE res; const char *app_id; const char *startup_id; gboolean app_restart; @@ -1632,7 +1637,7 @@ static void remove_inhibitors_for_connection (GsmManager *manager, const char *service_name) { - guint n_removed; + guint UNUSED_VARIABLE n_removed; RemoveClientData data; data.service_name = service_name; @@ -2304,10 +2309,12 @@ on_gsettings_key_changed (GSettings *settings, delay = g_settings_get_int (settings, key); gsm_presence_set_idle_timeout (manager->priv->presence, delay * 60000); } else if (g_strcmp0 (key, KEY_LOCK_DISABLE) == 0) { - gboolean disabled; + /* ??? */ + gboolean UNUSED_VARIABLE disabled; disabled = g_settings_get_boolean (settings, key); } else if (g_strcmp0 (key, KEY_USER_SWITCH_DISABLE) == 0) { - gboolean disabled; + /* ??? */ + gboolean UNUSED_VARIABLE disabled; disabled = g_settings_get_boolean (settings, key); } else { g_debug ("Config key not handled: %s", key); diff --git a/mate-session/mdm-signal-handler.c b/mate-session/mdm-signal-handler.c index 9f2ab3c..bded104 100644 --- a/mate-session/mdm-signal-handler.c +++ b/mate-session/mdm-signal-handler.c @@ -44,6 +44,12 @@ #define MDM_SIGNAL_HANDLER_GET_PRIVATE(o) \ (G_TYPE_INSTANCE_GET_PRIVATE((o), MDM_TYPE_SIGNAL_HANDLER, MdmSignalHandlerPrivate)) +#ifdef __GNUC__ +#define UNUSED_VARIABLE __attribute__ ((unused)) +#else +#define UNUSED_VARIABLE +#endif + typedef struct { int signal_number; MdmSignalHandlerFunc func; @@ -254,7 +260,7 @@ static void mdm_signal_handler_backtrace(void) static void signal_handler(int signo) { static int in_fatal = 0; - int ignore; + int UNUSED_VARIABLE ignore; guchar signo_byte = signo; /* avoid loops */ diff --git a/mate-session/test-client-dbus.c b/mate-session/test-client-dbus.c index ab9c0a7..fa888ed 100644 --- a/mate-session/test-client-dbus.c +++ b/mate-session/test-client-dbus.c @@ -35,6 +35,12 @@ #define SM_CLIENT_DBUS_INTERFACE "org.mate.SessionManager.ClientPrivate" +#ifdef __GNUC__ +#define UNUSED_VARIABLE __attribute__ ((unused)) +#else +#define UNUSED_VARIABLE +#endif + static DBusGConnection *bus_connection = NULL; static DBusGProxy *sm_proxy = NULL; static char *client_id = NULL; @@ -72,7 +78,7 @@ on_client_query_end_session (DBusGProxy *proxy, { GError *error; gboolean is_ok; - gboolean res; + gboolean UNUSED_VARIABLE res; const char *reason; is_ok = FALSE; diff --git a/mate-session/test-inhibit.c b/mate-session/test-inhibit.c index a712449..d314d9d 100644 --- a/mate-session/test-inhibit.c +++ b/mate-session/test-inhibit.c @@ -34,6 +34,12 @@ #define SM_DBUS_PATH "/org/mate/SessionManager" #define SM_DBUS_INTERFACE "org.mate.SessionManager" +#ifdef __GNUC__ +#define UNUSED_VARIABLE __attribute__ ((unused)) +#else +#define UNUSED_VARIABLE +#endif + static DBusGConnection *bus_connection = NULL; static DBusGProxy *sm_proxy = NULL; static guint cookie = 0; @@ -73,7 +79,7 @@ do_inhibit_for_window (GdkWindow *window) { GError *error; gboolean res; - const char *startup_id; + const char UNUSED_VARIABLE *startup_id; const char *app_id; const char *reason; guint toplevel_xid; -- cgit v1.2.1