summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Balneaves <[email protected]>2012-11-12 08:54:33 -0600
committerScott Balneaves <[email protected]>2012-11-12 08:54:33 -0600
commitb94aaf81d04f87cfcfde76b68876fbc0d27a8deb (patch)
treea508028c3e29b1fd74d50fb7226625a128cb7500
parentcc9615065c128be5924a12df50abfda0c6b74a3a (diff)
downloadmate-panel-b94aaf81d04f87cfcfde76b68876fbc0d27a8deb.tar.bz2
mate-panel-b94aaf81d04f87cfcfde76b68876fbc0d27a8deb.tar.xz
Code audit: fix compile warnings, uninitialized pointer problems
-rw-r--r--applets/wncklet/window-list.c3
-rw-r--r--mate-panel/libpanel-util/panel-launch.c17
-rw-r--r--mate-panel/libpanel-util/panel-show.c4
-rw-r--r--mate-panel/panel-layout.c2
-rw-r--r--mate-panel/panel-profile.c38
-rw-r--r--mate-panel/panel-profile.h2
-rw-r--r--mate-panel/panel-reset.c3
-rw-r--r--mate-panel/panel-toplevel.c2
-rw-r--r--mate-panel/panel-util.c2
9 files changed, 42 insertions, 31 deletions
diff --git a/applets/wncklet/window-list.c b/applets/wncklet/window-list.c
index bd4355a3..490b56e5 100644
--- a/applets/wncklet/window-list.c
+++ b/applets/wncklet/window-list.c
@@ -549,7 +549,8 @@ static void group_windows_toggled(GtkToggleButton* button, TasklistData* tasklis
{
if (gtk_toggle_button_get_active(button))
{
- gint value = g_object_get_data(G_OBJECT(button), "group_value");
+ gint value;
+ g_object_get (G_OBJECT(button), "group_value", &value);
g_settings_set_enum (tasklist->settings, "group-windows", value);
}
}
diff --git a/mate-panel/libpanel-util/panel-launch.c b/mate-panel/libpanel-util/panel-launch.c
index af2b4282..5479daaa 100644
--- a/mate-panel/libpanel-util/panel-launch.c
+++ b/mate-panel/libpanel-util/panel-launch.c
@@ -58,13 +58,10 @@ _panel_launch_handle_error (const gchar *name,
GError *local_error,
GError **error)
{
- if (local_error == NULL)
- return TRUE;
-
- else if (g_error_matches (local_error,
- G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
- g_error_free (local_error);
- return TRUE;
+ if (g_error_matches (local_error,
+ G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
+ g_error_free (local_error);
+ return TRUE;
}
else if (error != NULL)
@@ -104,6 +101,9 @@ panel_app_info_launch_uris (GAppInfo *appinfo,
g_object_unref (context);
+ if ((local_error == NULL) && (retval == TRUE))
+ return TRUE;
+
return _panel_launch_handle_error (g_app_info_get_name (appinfo),
screen, local_error, error);
}
@@ -229,6 +229,9 @@ panel_launch_desktop_file_with_fallback (const char *desktop_file,
G_SPAWN_SEARCH_PATH,
NULL, NULL, NULL, &local_error);
+ if (local_error == NULL && retval == TRUE)
+ return TRUE;
+
return _panel_launch_handle_error (fallback_exec,
screen, local_error, error);
}
diff --git a/mate-panel/libpanel-util/panel-show.c b/mate-panel/libpanel-util/panel-show.c
index 02ea2e63..5100be88 100644
--- a/mate-panel/libpanel-util/panel-show.c
+++ b/mate-panel/libpanel-util/panel-show.c
@@ -141,8 +141,8 @@ static gboolean _panel_show_handle_error(const gchar* uri, GdkScreen* screen, GE
static gboolean panel_show_caja_search_uri(GdkScreen* screen, const gchar* uri, guint32 timestamp, GError** error)
{
- char* desktopfile;
- GDesktopAppInfo* appinfo;
+ char* desktopfile = NULL;
+ GDesktopAppInfo* appinfo = NULL;
gboolean ret;
desktopfile = panel_g_lookup_in_applications_dirs("caja-folder-handler.desktop");
diff --git a/mate-panel/panel-layout.c b/mate-panel/panel-layout.c
index 76e7747a..99147ae5 100644
--- a/mate-panel/panel-layout.c
+++ b/mate-panel/panel-layout.c
@@ -162,7 +162,7 @@ panel_layout_append_group_helper (GKeyFile *keyfile,
existing_ids = panel_dconf_list_subdirs (dconf_path, TRUE);
if (id) {
- for (i = 0; existing_ids[i]; i) {
+ for (i = 0; existing_ids[i]; i++) {
if (!strcmp (existing_ids[i], id)) {
existing_id = TRUE;
}
diff --git a/mate-panel/panel-profile.c b/mate-panel/panel-profile.c
index e7c0f002..9b976194 100644
--- a/mate-panel/panel-profile.c
+++ b/mate-panel/panel-profile.c
@@ -76,7 +76,9 @@ typedef void (*PanelProfileDestroyFunc) (const char *id);
static GSettings *profile_settings = NULL;
static GQuark toplevel_id_quark = 0;
+#if 0
static GQuark queued_changes_quark = 0;
+#endif
static GQuark commit_timeout_quark = 0;
static void panel_profile_object_id_list_update (gchar **objects);
@@ -848,8 +850,8 @@ void
panel_profile_add_to_list (PanelGSettingsKeyType type,
const char *id)
{
- char *key;
- char *new_id;
+ char *key = NULL;
+ char *new_id = NULL;
new_id = id ? g_strdup (id) : panel_profile_find_new_id (type);
@@ -858,12 +860,13 @@ panel_profile_add_to_list (PanelGSettingsKeyType type,
else if (type == PANEL_GSETTINGS_OBJECTS)
key = g_strdup (PANEL_OBJECT_ID_LIST_KEY);
- panel_gsettings_append_strv (profile_settings,
+ if ((key != NULL) && (new_id != NULL)) {
+ panel_gsettings_append_strv (profile_settings,
key,
new_id);
-
- g_free (key);
- g_free (new_id);
+ g_free (key);
+ g_free (new_id);
+ }
}
void
@@ -1069,7 +1072,7 @@ get_toplevel_screen (char *toplevel_path)
}
PanelToplevel *
-panel_profile_load_toplevel (char *toplevel_id)
+panel_profile_load_toplevel (const char *toplevel_id)
{
PanelToplevel *toplevel;
GdkScreen *screen;
@@ -1236,7 +1239,6 @@ panel_profile_prepare_object_with_id (PanelObjectType object_type,
gboolean right_stick)
{
PanelGSettingsKeyType key_type;
- const char *key;
char *id;
char *settings_path;
GSettings *settings;
@@ -1329,7 +1331,7 @@ static void
panel_profile_delete_dir (PanelGSettingsKeyType type,
const char *id)
{
- gchar *dir;
+ gchar *dir = NULL;
switch (type) {
case PANEL_GSETTINGS_TOPLEVELS:
@@ -1353,9 +1355,10 @@ panel_profile_delete_dir (PanelGSettingsKeyType type,
g_free (subdir);
}
- panel_dconf_recursive_reset (dir, NULL);
-
- g_free (dir);
+ if (dir != NULL) {
+ panel_dconf_recursive_reset (dir, NULL);
+ g_free (dir);
+ }
}
static gboolean
@@ -1476,7 +1479,7 @@ panel_profile_toplevel_id_list_notify (GSettings *settings,
toplevel_ids = panel_gsettings_strv_to_gslist (toplevel_ids_strv);
toplevel_ids = panel_g_slist_make_unique (toplevel_ids,
- g_strcmp0,
+ (GCompareFunc)g_strcmp0,
FALSE);
g_strfreev (toplevel_ids_strv);
@@ -1516,7 +1519,7 @@ panel_profile_object_id_list_update (gchar **objects)
object_ids = panel_gsettings_strv_to_gslist (objects);
object_ids = panel_g_slist_make_unique (object_ids,
- g_strcmp0,
+ (GCompareFunc)g_strcmp0,
FALSE);
existing_applets = mate_panel_applet_list_applets ();
@@ -1562,7 +1565,7 @@ panel_profile_load_list (GSettings *settings,
GCallback notify_handler)
{
- gchar *key;
+ gchar *key = NULL;
gchar *changed_signal;
gchar **list;
gint i;
@@ -1572,6 +1575,7 @@ panel_profile_load_list (GSettings *settings,
else if (type == PANEL_GSETTINGS_OBJECTS)
key = g_strdup (PANEL_OBJECT_ID_LIST_KEY);
+ g_assert (key != NULL);
changed_signal = g_strdup_printf ("changed::%s", key);
g_signal_connect (settings, changed_signal, G_CALLBACK (notify_handler), NULL);
@@ -1633,11 +1637,11 @@ panel_profile_load (void)
panel_profile_load_list (profile_settings,
PANEL_GSETTINGS_TOPLEVELS,
- panel_profile_load_and_show_toplevel_startup,
+ (PanelProfileLoadFunc)panel_profile_load_and_show_toplevel_startup,
G_CALLBACK (panel_profile_toplevel_id_list_notify));
panel_profile_load_list (profile_settings,
PANEL_GSETTINGS_OBJECTS,
- panel_profile_load_object,
+ (PanelProfileLoadFunc)panel_profile_load_object,
G_CALLBACK (panel_profile_object_id_list_notify));
panel_profile_ensure_toplevel_per_screen ();
diff --git a/mate-panel/panel-profile.h b/mate-panel/panel-profile.h
index 84b927e8..60c9c77e 100644
--- a/mate-panel/panel-profile.h
+++ b/mate-panel/panel-profile.h
@@ -57,7 +57,7 @@ void panel_profile_remove_from_list (PanelGSettingsKeyType type
const char *id);
gboolean panel_profile_id_lists_are_writable (void);
void panel_profile_create_toplevel (GdkScreen *screen);
-PanelToplevel *panel_profile_load_toplevel (char *toplevel_id);
+PanelToplevel *panel_profile_load_toplevel (const char *toplevel_id);
void panel_profile_delete_toplevel (PanelToplevel *toplevel);
char *panel_profile_prepare_object (PanelObjectType object_type,
PanelToplevel *toplevel,
diff --git a/mate-panel/panel-reset.c b/mate-panel/panel-reset.c
index 22532da4..cf496f1a 100644
--- a/mate-panel/panel-reset.c
+++ b/mate-panel/panel-reset.c
@@ -32,7 +32,8 @@
#include "panel-schemas.h"
#include <libpanel-util/panel-dconf.h>
-void panel_reset()
+void
+panel_reset()
{
panel_dconf_recursive_reset (PANEL_GENERAL_PATH, NULL);
panel_dconf_recursive_reset (PANEL_TOPLEVEL_PATH, NULL);
diff --git a/mate-panel/panel-toplevel.c b/mate-panel/panel-toplevel.c
index ed396980..ed621ecd 100644
--- a/mate-panel/panel-toplevel.c
+++ b/mate-panel/panel-toplevel.c
@@ -3360,6 +3360,8 @@ panel_toplevel_calculate_animation_end_geometry (PanelToplevel *toplevel)
screen = panel_toplevel_get_monitor_geometry (
toplevel, NULL, NULL, &monitor_width, &monitor_height);
+ g_assert (screen != NULL);
+
if (!toplevel->priv->expand) {
if (toplevel->priv->x_centered)
diff --git a/mate-panel/panel-util.c b/mate-panel/panel-util.c
index 4f081a4b..2259aff3 100644
--- a/mate-panel/panel-util.c
+++ b/mate-panel/panel-util.c
@@ -654,7 +654,7 @@ panel_make_unique_desktop_uri (const char *dir,
p = strrchr (name, '-');
if (p) {
char *end;
- strtol ((p + 1), &end, 10);
+ (void) strtol ((p + 1), &end, 10);
if (!*end)
*p = '\0';
}