gnome-power-manager r2774 - in trunk: . applets/brightness applets/inhibit src



Author: rhughes
Date: Thu Apr 10 14:52:24 2008
New Revision: 2774
URL: http://svn.gnome.org/viewvc/gnome-power-manager?rev=2774&view=rev

Log:
2008-04-10  Richard Hughes  <richard hughsie com>

* configure.ac:
Turn on some extra warnings for GCC.

* applets/brightness/brightness-applet.c: (gpm_applet_help_cb):
* applets/inhibit/inhibit-applet.c: (gpm_applet_help_cb):
* src/gpm-backlight.c: (gpm_backlight_brightness_evaluate_and_set):
* src/gpm-brightness-hal.c: (gpm_brightness_hal_up),
(gpm_brightness_hal_down):
* src/gpm-brightness-xrandr.c:
(gpm_brightness_xrandr_output_get_internal),
(gpm_brightness_xrandr_output_set_internal),
(gpm_brightness_xrandr_output_set),
(gpm_brightness_xrandr_foreach_resource):
* src/gpm-brightness.c: (gpm_brightness_get):
* src/gpm-common.c: (gpm_help_display):
* src/gpm-inhibit.c: (gpm_inhibit_get_message):
* src/gpm-light-sensor.c: (gpm_light_sensor_poll_cb),
(gpm_light_sensor_init):
* src/gpm-debug.c:
* src/gpm-main.c: (main):
* src/gpm-manager.c: (gpm_manager_is_inhibit_valid):
Fix the warnings!


Modified:
   trunk/ChangeLog
   trunk/applets/brightness/brightness-applet.c
   trunk/applets/inhibit/inhibit-applet.c
   trunk/configure.ac
   trunk/src/gpm-backlight.c
   trunk/src/gpm-brightness-hal.c
   trunk/src/gpm-brightness-xrandr.c
   trunk/src/gpm-brightness.c
   trunk/src/gpm-common.c
   trunk/src/gpm-debug.c
   trunk/src/gpm-inhibit.c
   trunk/src/gpm-light-sensor.c
   trunk/src/gpm-main.c
   trunk/src/gpm-manager.c

Modified: trunk/applets/brightness/brightness-applet.c
==============================================================================
--- trunk/applets/brightness/brightness-applet.c	(original)
+++ trunk/applets/brightness/brightness-applet.c	Thu Apr 10 14:52:24 2008
@@ -806,7 +806,7 @@
 						GTK_DIALOG_DESTROY_WITH_PARENT,
 						GTK_MESSAGE_ERROR,
 						GTK_BUTTONS_CLOSE,
-						error->message);
+						"%s", error->message);
 		gtk_dialog_run (GTK_DIALOG (dialog));
 		gtk_widget_destroy (dialog);
 		g_error_free (error);

Modified: trunk/applets/inhibit/inhibit-applet.c
==============================================================================
--- trunk/applets/inhibit/inhibit-applet.c	(original)
+++ trunk/applets/inhibit/inhibit-applet.c	Thu Apr 10 14:52:24 2008
@@ -465,7 +465,7 @@
 						GTK_DIALOG_DESTROY_WITH_PARENT,
 						GTK_MESSAGE_ERROR,
 						GTK_BUTTONS_CLOSE,
-						error->message);
+						"%s", error->message);
 		gtk_dialog_run (GTK_DIALOG (dialog));
 		gtk_widget_destroy (dialog);
 		g_error_free (error);

Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac	(original)
+++ trunk/configure.ac	Thu Apr 10 14:52:24 2008
@@ -18,10 +18,10 @@
 dnl ---------------------------------------------------------------------------
 dnl - Extra verbose warning switches
 dnl ---------------------------------------------------------------------------
-#if test "$GCC" = "yes"; then
-#    CPPFLAGS="$CPPFLAGS -Werror -Wcast-align -Wno-uninitialized"
-#    CPPFLAGS="$CPPFLAGS -Wall"
-#fi
+if test "$GCC" = "yes"; then
+    CPPFLAGS="$CPPFLAGS -Werror -Wcast-align -Wno-uninitialized"
+    CPPFLAGS="$CPPFLAGS -Wall -Wformat-security"
+fi
 
 dnl ---------------------------------------------------------------------------
 dnl - Debugging switches (uncomment this if you want to use gdb)

Modified: trunk/src/gpm-backlight.c
==============================================================================
--- trunk/src/gpm-backlight.c	(original)
+++ trunk/src/gpm-backlight.c	Thu Apr 10 14:52:24 2008
@@ -436,7 +436,7 @@
 	gpm_debug ("4. ambient scale %f, brightness %f", scale, brightness);
 
 	/* convert to percentage */
-	value = roundf (brightness * 100.0f);
+	value = (guint) ((brightness * 100.0f) + 0.5);
 
 	/* only do stuff if the brightness is different */
 	gpm_brightness_get (backlight->priv->brightness, &old_value);

Modified: trunk/src/gpm-brightness-hal.c
==============================================================================
--- trunk/src/gpm-brightness-hal.c	(original)
+++ trunk/src/gpm-brightness-hal.c	Thu Apr 10 14:52:24 2008
@@ -327,7 +327,6 @@
 {
 	gboolean ret = FALSE;
 	gint step;
-	gint percentage;
 	guint current_hw;
 
 	g_return_val_if_fail (GPM_IS_BRIGHTNESS_HAL (brightness), FALSE);
@@ -370,7 +369,6 @@
 {
 	gboolean ret = FALSE;
 	gint step;
-	gint percentage;
 	guint current_hw;
 
 	g_return_val_if_fail (GPM_IS_BRIGHTNESS_HAL (brightness), FALSE);

Modified: trunk/src/gpm-brightness-xrandr.c
==============================================================================
--- trunk/src/gpm-brightness-xrandr.c	(original)
+++ trunk/src/gpm-brightness-xrandr.c	Thu Apr 10 14:52:24 2008
@@ -80,7 +80,7 @@
  * gpm_brightness_xrandr_output_get_internal:
  **/
 static gboolean
-gpm_brightness_xrandr_output_get_internal (GpmBrightnessXRandR *brightness, RROutput output, int *cur)
+gpm_brightness_xrandr_output_get_internal (GpmBrightnessXRandR *brightness, RROutput output, guint *cur)
 {
 	unsigned long nitems;
 	unsigned long bytes_after;
@@ -88,7 +88,6 @@
 	Atom actual_type;
 	int actual_format;
 	gboolean ret = FALSE;
-	long value;
 
 	g_return_val_if_fail (GPM_IS_BRIGHTNESS_XRANDR (brightness), FALSE);
 
@@ -115,8 +114,8 @@
 {
 	gboolean ret = TRUE;
 
-	g_return_if_fail (GPM_IS_BRIGHTNESS_XRANDR (brightness));
-	g_return_if_fail (value >= 0);
+	g_return_val_if_fail (GPM_IS_BRIGHTNESS_XRANDR (brightness), FALSE);
+	g_return_val_if_fail (value >= 0, FALSE);
 
 	/* don't abort on error */
 	gdk_error_trap_push ();
@@ -306,7 +305,7 @@
 	gint i;
 	gint shared_value_abs;
 
-	g_return_if_fail (GPM_IS_BRIGHTNESS_XRANDR (brightness));
+	g_return_val_if_fail (GPM_IS_BRIGHTNESS_XRANDR (brightness), FALSE);
 
 	ret = gpm_brightness_xrandr_output_get_internal (brightness, output, &cur);
 	if (!ret) {
@@ -367,7 +366,7 @@
 	gboolean ret;
 	gboolean success_any = FALSE;
 
-	g_return_if_fail (GPM_IS_BRIGHTNESS_XRANDR (brightness));
+	g_return_val_if_fail (GPM_IS_BRIGHTNESS_XRANDR (brightness), FALSE);
 
 	/* do for each output */
 	for (i=0; i<resources->noutput; i++) {

Modified: trunk/src/gpm-brightness.c
==============================================================================
--- trunk/src/gpm-brightness.c	(original)
+++ trunk/src/gpm-brightness.c	Thu Apr 10 14:52:24 2008
@@ -177,7 +177,6 @@
 	if (percentage_local > 100) {
 		gpm_warning ("percentage value of %i will be ignored", percentage_local);
 		ret = FALSE;
-		return;
 	}
 	/* a new value is always trusted if the method and checks succeed */
 	if (ret) {

Modified: trunk/src/gpm-common.c
==============================================================================
--- trunk/src/gpm-common.c	(original)
+++ trunk/src/gpm-common.c	Thu Apr 10 14:52:24 2008
@@ -353,7 +353,7 @@
 		d = gtk_message_dialog_new(NULL,
 				GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
 				GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
-				error->message);
+				"%s", error->message);
 		gtk_dialog_run(GTK_DIALOG(d));
 		gtk_widget_destroy(d);
 		g_error_free(error);

Modified: trunk/src/gpm-debug.c
==============================================================================
--- trunk/src/gpm-debug.c	(original)
+++ trunk/src/gpm-debug.c	Thu Apr 10 14:52:24 2008
@@ -31,6 +31,7 @@
 #include <signal.h>
 #include <time.h>
 #include <syslog.h>
+#include <unistd.h>
 
 #include "gpm-common.h"
 #include "gpm-debug.h"
@@ -48,8 +49,6 @@
 static gboolean is_init = FALSE;	/* if we are initialised */
 static gboolean do_verbose = FALSE;	/* if we should print out debugging */
 static gboolean is_console = FALSE;
-static GSList *list = NULL;
-static gchar va_args_buffer [1025];
 
 /**
  * gpm_debug_is_verbose:

Modified: trunk/src/gpm-inhibit.c
==============================================================================
--- trunk/src/gpm-inhibit.c	(original)
+++ trunk/src/gpm-inhibit.c	Thu Apr 10 14:52:24 2008
@@ -402,23 +402,24 @@
 		g_free (boldstr);
 		g_free (italicstr);
 
-	} else { if (strcmp (action, "suspend") == 0) {
-			g_string_append_printf (message, _("Multiple applications have stopped the suspend from taking place."), action);
+	} else {
+		if (strcmp (action, "suspend") == 0) {
+			g_string_append_printf (message, _("Multiple applications have stopped the suspend from taking place."));
 
 		} else if (strcmp (action, "hibernate") == 0) {
-			g_string_append_printf (message, _("Multiple applications have stopped the hibernate from taking place."), action);
+			g_string_append_printf (message, _("Multiple applications have stopped the hibernate from taking place."));
 
 		} else if (strcmp (action, "policy action") == 0) {
-			g_string_append_printf (message, _("Multiple applications have stopped the policy action from taking place."), action);
+			g_string_append_printf (message, _("Multiple applications have stopped the policy action from taking place."));
 
 		} else if (strcmp (action, "reboot") == 0) {
-			g_string_append_printf (message, _("Multiple applications have stopped the reboot from taking place."), action); 
+			g_string_append_printf (message, _("Multiple applications have stopped the reboot from taking place.")); 
 
 		} else if (strcmp (action, "shutdown") == 0) {
-			g_string_append_printf (message, _("Multiple applications have stopped the shutdown from taking place."), action);
+			g_string_append_printf (message, _("Multiple applications have stopped the shutdown from taking place."));
 
 		} else if (strcmp (action, "timeout action") == 0) {
-			g_string_append_printf (message, _("Multiple applications have stopped the suspend from taking place."), action);
+			g_string_append_printf (message, _("Multiple applications have stopped the suspend from taking place."));
 		}
 		
 		for (a=0; a<g_slist_length (inhibit->priv->list); a++) {

Modified: trunk/src/gpm-light-sensor.c
==============================================================================
--- trunk/src/gpm-light-sensor.c	(original)
+++ trunk/src/gpm-light-sensor.c	Thu Apr 10 14:52:24 2008
@@ -292,7 +292,6 @@
 	gboolean ret;
 	gboolean enable;
 	GpmLightSensor *sensor;
-	gfloat bright;
 
 	g_return_val_if_fail (userdata != NULL, TRUE);
 
@@ -348,7 +347,6 @@
 	HalGManager *manager;
 	HalGDevice *device;
 	guint timeout;
-	gfloat bright;
 
 	sensor->priv = GPM_LIGHT_SENSOR_GET_PRIVATE (sensor);
 	sensor->priv->udi = NULL;

Modified: trunk/src/gpm-main.c
==============================================================================
--- trunk/src/gpm-main.c	(original)
+++ trunk/src/gpm-main.c	Thu Apr 10 14:52:24 2008
@@ -145,7 +145,6 @@
 	GError *error = NULL;
 	GOptionContext *context;
  	GnomeProgram *program;
-	int i;
 
 	const GOptionEntry options[] = {
 		{ "no-daemon", '\0', 0, G_OPTION_ARG_NONE, &no_daemon,

Modified: trunk/src/gpm-manager.c
==============================================================================
--- trunk/src/gpm-manager.c	(original)
+++ trunk/src/gpm-manager.c	Thu Apr 10 14:52:24 2008
@@ -171,7 +171,7 @@
 			      const char *action)
 {
 	gboolean has_inhibit;
-	gchar *title;
+	gchar *title = NULL;
 
 	/* We have to decide on whether this is a idle action or a user keypress */
 	gpm_inhibit_has_inhibit (manager->priv->inhibit, &has_inhibit, NULL);



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