After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 762630 - Warning at compilation time
Warning at compilation time
Status: RESOLVED FIXED
Product: gnome-control-center
Classification: Core
Component: Printers
git master
Other Linux
: Normal normal
: ---
Assigned To: Felipe Borges
Control-Center Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-02-24 17:28 UTC by Marek Kašík
Modified: 2016-02-25 13:22 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
printers: make sure the printer job state_string is initialized (850 bytes, patch)
2016-02-25 12:58 UTC, Felipe Borges
committed Details | Review

Description Marek Kašík 2016-02-24 17:28:36 UTC
Hi, I see this when compiling g-c-c:

pp-jobs-dialog.c: In function ‘create_listbox_row’:
pp-jobs-dialog.c:139:10: warning: ‘state_string’ may be used uninitialized in this function [-Wmaybe-uninitialized]
widget = gtk_label_new (state_string);
^
pp-jobs-dialog.c:94:10: note: ‘state_string’ was declared here
gchar *state_string;

Marek
Comment 1 Felipe Borges 2016-02-25 12:58:25 UTC
Created attachment 322365 [details] [review]
printers: make sure the printer job state_string is initialized
Comment 2 Felipe Borges 2016-02-25 12:59:56 UTC
(In reply to Marek Kašík from comment #0)
> Hi, I see this when compiling g-c-c:
> 
> pp-jobs-dialog.c: In function ‘create_listbox_row’:
> pp-jobs-dialog.c:139:10: warning: ‘state_string’ may be used uninitialized
> in this function [-Wmaybe-uninitialized]
> widget = gtk_label_new (state_string);
> ^
> pp-jobs-dialog.c:94:10: note: ‘state_string’ was declared here
> gchar *state_string;
> 
> Marek

Thanks for spotting that. Initializing state_string to NULL is enough to have the status GtkLabel set to an empty label in the corner case where the job_state doesn't match one of the IPP_JOB_* constants.
Comment 3 Marek Kašík 2016-02-25 13:05:59 UTC
Review of attachment 322365 [details] [review]:

Thank you for the fix. Push it to the branches which need the fix please.
Comment 4 Felipe Borges 2016-02-25 13:22:47 UTC
Attachment 322365 [details] pushed as 9dd58c0 - printers: make sure the printer job state_string is initialized