[gstreamer-bugs] [Bug 303106] New: gst_structure_get_uint() contra gcc4 signedness madness?

bugzilla-daemon at bugzilla.gnome.org bugzilla-daemon at bugzilla.gnome.org
Thu May 5 02:49:18 PDT 2005


Please DO NOT reply to this by email. All additional comments should be made in
the comments box of this bug report.

 http://bugzilla.gnome.org/show_bug.cgi?id=303106
 GStreamer | gstreamer (core) | Ver: 0.8.8

           Summary: gst_structure_get_uint() contra gcc4 signedness madness?
           Product: GStreamer
           Version: 0.8.8
          Platform: Other
        OS/Version: Linux
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: Normal
         Component: gstreamer (core)
        AssignedTo: gstreamer-bugs at lists.sourceforge.net
        ReportedBy: t.i.m at zen.co.uk
         QAContact: gstreamer-bugs at lists.sourceforge.net
                CC: all-bugs at bugzilla.gnome.org


I think we should have a gst_structure_get_uint() that we can cleanly use with
unsigned integer pointers as out parameter with gcc4.

Check out bug #303011 and gst/speed/gstspeed.[ch] for the problem. We have

struct MyPlugin
{
  ...
  guint channels;
  guint rate;
  ...
};

and then do

 ret = gst_structure_get_int (s, "channels", &filter->channels);
 ret = gst_structure_get_int (s, "rate", &filter->rate);

etc. and gcc4 barfs. And there must be hundreds of those in the plugins tree.

Now, I think it's simply wrong and ugly to cast those out parameter pointers.
Similarly I find it unacceptable to change the struct members to gint (if I have
variables that can never be negative, they should stay unsigned IMHO, not to
mention that changing them might trigger other signed/unsigned complaints
elsewehre).


The problem is of course that the underlying value types G_TYPE_INT and
G_TYPE_UINT are not compatible, so g_value_get_* will complain if the value
holds a type of a different signedness.

So here's my suggestion, which I know is evil, but still think it's the best way:

add gst_structure_get_uint() and make both _get_uint() and _get_int() handle
both G_TYPE_INT and G_TYPE_UINT fields and cast them as appropriate. At least
performance-wise this shouldn't be a problem, as those two types are fundamental
types and thus integer constants.

Proposed patch attached.

Flame ahead :P

Cheers
 -Tim

------- You are receiving this mail because: -------
You are the assignee for the bug.
You are the QA contact for the bug.




More information about the Gstreamer-bugs mailing list