Bug 13859 - unitialized variable warnings
Summary: unitialized variable warnings
Status: RESOLVED FIXED
Alias: None
Product: PackageKit
Classification: Unclassified
Component: General (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Richard Hughes
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-12-29 19:26 UTC by Christopher Aillon
Modified: 2008-01-20 14:26 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.