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 144042 - [PATCH] gdk-pixbuf/io-ani.c: constness
[PATCH] gdk-pixbuf/io-ani.c: constness
Status: RESOLVED FIXED
Product: gdk-pixbuf
Classification: Platform
Component: general
git master
Other All
: Normal trivial
: ---
Assigned To: gdk-pixbuf-maint
gdk-pixbuf-maint
Depends on:
Blocks:
 
 
Reported: 2004-06-09 17:33 UTC by Morten Welinder
Modified: 2013-12-19 04:02 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Trivial patch to constify data (9.52 KB, patch)
2008-03-28 20:44 UTC, Luis Menina
needs-work Details | Review
Corrects the warnings with casts (14.08 KB, patch)
2008-11-11 00:21 UTC, Luis Menina
reviewed Details | Review

Description Morten Welinder 2004-06-09 17:33:30 UTC
The three tables in the MODULE_ENTRY function look like they should be const.
Comment 1 Morten Welinder 2004-06-09 19:01:15 UTC
Ditto io-bmp.c
Ditto io-gif.c
Ditto io-ico.c
Ditto io-jpeg.c
Ditto io-pcx.c
Ditto io-png.c
Ditto io-pnm.c
Ditto io-ras.c
Ditto io-tga.c
Ditto io-tiff.c
Ditto io-wbmp.c
Ditto io-xbm.c
Ditto io-xpm.c
Comment 2 Luis Menina 2008-03-28 20:44:28 UTC
Created attachment 108191 [details] [review]
Trivial patch to constify data

Constifying the data causes few warnings, because the struct members that will point to this data are not const.
For example:
io-gif.c:1690: warning: assignment discards qualifiers from pointer target type
io-gif.c:1692: warning: assignment from incompatible pointer type
io-gif.c:1693: warning: assignment from incompatible pointer type

Would a simple cast to non-const type be enough ? Or is there a trickier way to Do The Right Thing (TM) ?
Comment 3 Björn Lindqvist 2008-04-08 13:57:37 UTC
It seems to me that declaring the struct-members as const too is the right thing. If that doesn't work, then the next best option is to add explicit casts. The warnings has to be quelched, somehow. 
Comment 4 Luis Menina 2008-10-29 03:49:33 UTC
Are you sure I'm allowed to switch GdkPixbufFormat members to const ? May it cause some ABI/API breakage, as it's a public structure?
Comment 5 Luis Menina 2008-11-11 00:21:34 UTC
Created attachment 122380 [details] [review]
Corrects the warnings with casts

Making the struct members const was breaking too much stuff in gdk-pixbuf-io.c, so I used some casts to make the warnings disapear.
Comment 6 Emmanuele Bassi (:ebassi) 2010-06-26 13:50:00 UTC
constifying (especially the strings arrays) would move the text into the read-only data section of the shared object. looks a good idea to me. in theory, the GdkPixbufFormat should be constified, but that would be a possible source breakage.
Comment 7 Emmanuele Bassi (:ebassi) 2010-06-26 13:50:51 UTC
Review of attachment 122380 [details] [review]:

I think this should go in (note: gdk-pixbuf was moved out of gtk+)
Comment 8 Emmanuele Bassi (:ebassi) 2010-06-26 13:51:05 UTC
Review of attachment 122380 [details] [review]:

I think this should go in (note: gdk-pixbuf was moved out of gtk+)