[gnome-color-manager] trivial: fix up a few buglets found using clang



commit 7e44be8854302899d1d804287370c6902be47f54
Author: Richard Hughes <richard hughsie com>
Date:   Wed May 26 19:11:13 2010 +0100

    trivial: fix up a few buglets found using clang

 src/gcm-fix-profile.c   |    2 +-
 src/gcm-inspect.c       |    6 +++---
 src/gcm-picker.c        |    3 +--
 src/gcm-prefs.c         |   42 ++++++++++++++++++++----------------------
 src/gcm-profile-lcms1.c |    1 -
 src/gcm-session.c       |    2 +-
 src/gcm-utils.c         |    7 +++++--
 7 files changed, 31 insertions(+), 32 deletions(-)
---
diff --git a/src/gcm-fix-profile.c b/src/gcm-fix-profile.c
index 5820136..8ef2e14 100644
--- a/src/gcm-fix-profile.c
+++ b/src/gcm-fix-profile.c
@@ -34,7 +34,7 @@ static gboolean
 gcm_fix_profile_filename (const gchar *filename, const gchar *description, const gchar *copyright, const gchar *model, const gchar *manufacturer)
 {
 	gboolean ret = TRUE;
-	cmsHPROFILE lcms_profile;
+	cmsHPROFILE lcms_profile = NULL;
 	gchar *data = NULL;
 	gsize len;
 	GError *error = NULL;
diff --git a/src/gcm-inspect.c b/src/gcm-inspect.c
index 90ad536..ac85f13 100644
--- a/src/gcm-inspect.c
+++ b/src/gcm-inspect.c
@@ -430,9 +430,9 @@ gcm_inspect_show_profiles_for_type (const gchar *type)
 	gboolean ret = FALSE;
 	GDBusConnection *connection;
 	GError *error = NULL;
-	const gchar *filename;
-	const gchar *description;
-	guint i;
+	const gchar *filename = NULL;
+	const gchar *description = NULL;
+	guint i = 0;
 	GVariant *args = NULL;
 	GVariant *response = NULL;
 	GVariantIter *iter = NULL;
diff --git a/src/gcm-picker.c b/src/gcm-picker.c
index cd7862e..4274283 100644
--- a/src/gcm-picker.c
+++ b/src/gcm-picker.c
@@ -132,7 +132,6 @@ gcm_picker_refresh_results (void)
 	g_object_get (calibrate, "xyz", &xyz, NULL);
 
 	/* create new pixbuf of the right size */
-	image = GTK_IMAGE (gtk_builder_get_object (builder, "image_preview"));
 	pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, 200, 200);
 
 	/* get values */
@@ -467,7 +466,7 @@ gcm_prefs_setup_space_combobox (GtkWidget *widget)
 	if (!has_profile) {
 		/* TRANSLATORS: this is when there are no profiles that can be used; the search term is either "RGB" or "CMYK" */
 		text = g_strdup_printf (_("No %s color spaces available"),
-					gcm_colorspace_to_localised_string (colorspace));
+					gcm_colorspace_to_localised_string (GCM_COLORSPACE_RGB));
 		gtk_combo_box_append_text (GTK_COMBO_BOX(widget), text);
 		gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0);
 		gtk_widget_set_sensitive (widget, FALSE);
diff --git a/src/gcm-prefs.c b/src/gcm-prefs.c
index e5fd7db..8ef6156 100644
--- a/src/gcm-prefs.c
+++ b/src/gcm-prefs.c
@@ -2286,7 +2286,6 @@ gcm_prefs_profile_combo_changed_cb (GtkWidget *widget, gpointer data)
 	GtkTreeIter iter;
 	GtkTreeModel *model;
 	GcmPrefsEntryType entry_type;
-	gchar *filename = NULL;
 
 	/* no devices */
 	if (current_device == NULL)
@@ -2312,10 +2311,23 @@ gcm_prefs_profile_combo_changed_cb (GtkWidget *widget, gpointer data)
 			goto out;
 		}
 
-		/* check the file is suitable */
+		/* import this */
+		ret = gcm_prefs_profile_import_file (file);
+		if (!ret) {
+			gchar *uri;
+			/* set to 'None' */
+			gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0);
+
+			uri = g_file_get_uri (file);
+			egg_debug ("%s did not import correctly", uri);
+			g_free (uri);
+			goto out;
+		}
+
+		/* get an object of the destination */
+		dest = gcm_utils_get_profile_destination (file);
 		profile = gcm_profile_default_new ();
-		filename = g_file_get_path (file);
-		ret = gcm_profile_parse (profile, file, &error);
+		ret = gcm_profile_parse (profile, dest, &error);
 		if (!ret) {
 			/* set to first entry */
 			gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0);
@@ -2323,33 +2335,19 @@ gcm_prefs_profile_combo_changed_cb (GtkWidget *widget, gpointer data)
 			g_error_free (error);
 			goto out;
 		}
+
+		/* check the file is suitable */
 		ret = gcm_prefs_is_profile_suitable_for_device (profile, current_device);
 		if (!ret) {
 			/* set to 'None' */
 			gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0);
 
 			/* TRANSLATORS: the profile was of the wrong sort for this device */
-			gcm_prefs_error_dialog (_("Could not import profile"), _("The profile was of the wrong type for this device"));
+			gcm_prefs_error_dialog (_("Could not import profile"),
+						_("The profile was of the wrong type for this device"));
 			goto out;
 		}
 
-		/* actually set this as the default */
-		ret = gcm_prefs_profile_import_file (file);
-		if (!ret) {
-			gchar *uri;
-			/* set to 'None' */
-			gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0);
-
-			uri = g_file_get_uri (file);
-			egg_debug ("%s did not import correctly", uri);
-			g_free (uri);
-			goto out;
-		}
-
-		/* now use the new profile as the device default */
-		dest = gcm_utils_get_profile_destination (file);
-		filename = g_file_get_path (dest);
-
 		/* add to combobox */
 		gtk_list_store_append (GTK_LIST_STORE(model), &iter);
 		gtk_list_store_set (GTK_LIST_STORE(model), &iter,
diff --git a/src/gcm-profile-lcms1.c b/src/gcm-profile-lcms1.c
index 8acf755..2df5550 100644
--- a/src/gcm-profile-lcms1.c
+++ b/src/gcm-profile-lcms1.c
@@ -381,7 +381,6 @@ gcm_profile_lcms1_parse_multi_localized_unicode (GcmProfileLcms1 *profile_lcms1,
 			/* there is more than one language encoded */
 			egg_warning ("more than one item of data in MLUC (names size: %i), using first one", names_size);
 		}
-		record_size = gcm_parser_decode_32 (data + 12);
 		len = gcm_parser_decode_32 (data + 20);
 		offset_name = gcm_parser_decode_32 (data + 24);
 		text = gcm_profile_lcms1_utf16be_to_locale (data + offset_name, len);
diff --git a/src/gcm-session.c b/src/gcm-session.c
index d7e2838..3488683 100644
--- a/src/gcm-session.c
+++ b/src/gcm-session.c
@@ -359,7 +359,7 @@ gcm_session_get_profiles_for_device (const gchar *device_id_with_prefix, GError
 	guint i;
 	gboolean use_native_device = FALSE;
 	GcmDevice *device;
-	GPtrArray *array;
+	GPtrArray *array = NULL;
 	GPtrArray *array_devices;
 
 	/* strip the prefix, if there is any */
diff --git a/src/gcm-utils.c b/src/gcm-utils.c
index 6eb26b4..518f667 100644
--- a/src/gcm-utils.c
+++ b/src/gcm-utils.c
@@ -139,7 +139,7 @@ gcm_utils_install_package (const gchar *package_name, GtkWindow *window)
 	GVariant *response = NULL;
 	GVariantBuilder *builder = NULL;
 	GError *error = NULL;
-	gboolean ret;
+	gboolean ret = FALSE;
 	guint32 xid = 0;
 	gchar **packages = NULL;
 
@@ -147,7 +147,7 @@ gcm_utils_install_package (const gchar *package_name, GtkWindow *window)
 
 #ifndef GCM_USE_PACKAGEKIT
 	egg_warning ("cannot install %s: this package was not compiled with --enable-packagekit", package_name);
-	return FALSE;
+	goto out;
 #endif
 
 	/* get xid of this window */
@@ -189,6 +189,9 @@ gcm_utils_install_package (const gchar *package_name, GtkWindow *window)
 		g_error_free (error);
 		goto out;
 	}
+
+	/* success */
+	ret = TRUE;
 out:
 	if (builder != NULL)
 		g_variant_builder_unref (builder);



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