Bug 13859

Summary: unitialized variable warnings
Product: PackageKit Reporter: Christopher Aillon <caillon>
Component: GeneralAssignee: Richard Hughes <richard>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Christopher Aillon 2007-12-29 19:26:23 UTC
cc1: warnings being treated as errors
pk-prefs.c: In function 'pk_prefs_freq_combo_changed':
pk-prefs.c:113: warning: 'freq' may be used uninitialized in this function

then

cc1: warnings being treated as errors
pk-prefs.c: In function 'pk_prefs_update_combo_changed':
pk-prefs.c:146: warning: 'update' may be used uninitialized in this function

Technically, it won't ever be used as the one case the compiler thinks that this is an issue is a g_assert().... but this breaks builds with -Werror, such as: http://koji.fedoraproject.org/koji/getfile?taskID=306061&name=build.log and the fix is trivial and seems proper as there are variables to start the assignment off with.

--- gnome-packagekit-0.1.5/src/pk-prefs.c.Werror        2007-11-22 23:11:52.000000000 +0100
+++ gnome-packagekit-0.1.5/src/pk-prefs.c       2007-12-30 04:21:25.000000000 +0100
@@ -110,7 +110,7 @@ pk_prefs_freq_combo_changed (GtkWidget *
 {
        gchar *value;
        const gchar *action;
-       PkFreqEnum freq;
+       PkFreqEnum freq = PK_FREQ_ENUM_UNKNOWN;
        GConfClient *client;
 
        client = gconf_client_get_default ();
@@ -142,7 +142,7 @@ pk_prefs_update_combo_changed (GtkWidget
 {
        gchar *value;
        const gchar *action;
-       PkUpdateEnum update;
+       PkUpdateEnum update = PK_UPDATE_ENUM_UNKNOWN;
        GConfClient *client;
        GtkWidget *check_widget;
        GtkWidget *notify_widget;
Comment 1 Richard Hughes 2008-01-20 14:26:11 UTC
I think you pushed this, thanks. Closing.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.