[Bug 660955] New: instance_size in gst_type_register_static_full should be guint16, not guint.

GStreamer (bugzilla.gnome.org) bugzilla at gnome.org
Tue Oct 4 23:16:00 PDT 2011


https://bugzilla.gnome.org/show_bug.cgi?id=660955
  GStreamer | gstreamer (core) | 0.10.32

           Summary: instance_size in gst_type_register_static_full should
                    be guint16, not guint.
    Classification: Platform
           Product: GStreamer
           Version: 0.10.32
        OS/Version: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: Normal
         Component: gstreamer (core)
        AssignedTo: gstreamer-bugs at lists.freedesktop.org
        ReportedBy: mpaklin at hotmail.com
         QAContact: gstreamer-bugs at lists.freedesktop.org
     GNOME version: ---


Suppose I made a mistake (I actually did!) and had my element instance size
exceed 16 bit. I used GST_BOILERPLATE_FULL() to declare it.
GST_BOILERPLATE_FULL() calls gst_type_register_static_full() to register new
type with glib.

For some reason that I don't understand gst_type_register_static_full()
declares instance_size parameter as guint and then internally casts it into
guint16 probably suppressing corresponding warning(s). Why?

If it were to declare instance_size as guint16, the compiler would (hopefully)
throw a warning if sizeof(type) exceeded 16 bit. That would caught an
unsuspecting dev right there on the spot.

I filed a bug against glib to see if they could add an assert or something if
the type size exceeds 16 bit. See
https://bugzilla.gnome.org/show_bug.cgi?id=659916.
However in this case they obviously can't do anything as the cast to guint16
has been done already by gst_type_register_static_full().

I suggest changing instance_size parameter of gst_type_register_static_full()
to guint16. If that is not possible for compatibility or some other reason,
consider adding an assert to gst_type_register_static_full() to ensure that
passed instance_size is within the range.

Regards,
-- Max Paklin.

-- 
Configure bugmail: https://bugzilla.gnome.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the gstreamer-bugs mailing list