gst/gstutils.h: Try to fix 'dereferencing type-punned pointer will break strict aliasing rules' warnings with C++ com...

Original commit message from CVS:
* gst/gstutils.h: (GST_BOILERPLATE_FULL):
Try to fix 'dereferencing type-punned pointer will break strict
aliasing rules' warnings with C++ compilers and GLib >= 2.14.0: GLib
changed the default GType typedef from gulong to gsize at some point,
but kept GType typedef'ed to gulong for C++ for ABI reasons; the
g_once_* functions all take a gsize * though, so work around the type
mismatch for C++ by doing everything in gsize and casting to GType
later.
This commit is contained in:
Tim-Philipp Müller 2008-05-09 18:25:44 +00:00
parent 4fa54750f6
commit 7c0437a9da
2 changed files with 18 additions and 4 deletions

View file

@ -1,3 +1,14 @@
2008-05-09 Tim-Philipp Müller <tim.muller at collabora co uk>
* gst/gstutils.h: (GST_BOILERPLATE_FULL):
Try to fix 'dereferencing type-punned pointer will break strict
aliasing rules' warnings with C++ compilers and GLib >= 2.14.0: GLib
changed the default GType typedef from gulong to gsize at some point,
but kept GType typedef'ed to gulong for C++ for ABI reasons; the
g_once_* functions all take a gsize * though, so work around the type
mismatch for C++ by doing everything in gsize and casting to GType
later.
2008-05-09 Jan Schmidt <jan.schmidt@sun.com>
* plugins/elements/gstmultiqueue.c:

View file

@ -137,8 +137,11 @@ GType type_as_function ## _get_type (void); \
GType \
type_as_function ## _get_type (void) \
{ \
static volatile GType object_type = 0; \
if (__gst_once_init_enter ((gsize *) &object_type)) { \
/* The typedef for GType may be gulong or gsize, depending on the \
* system and whether the compiler is c++ or not. The g_once_init_* \
* functions always take a gsize * though ... */ \
static volatile gsize gonce_data; \
if (__gst_once_init_enter (&gonce_data)) { \
GType _type; \
_type = gst_type_register_static_full (parent_type_macro, \
g_intern_static_string (#type), \
@ -154,9 +157,9 @@ type_as_function ## _get_type (void) \
NULL, \
(GTypeFlags) 0); \
additional_initializations (_type); \
__gst_once_init_leave ((gsize *) &object_type, (gsize) _type); \
__gst_once_init_leave (&gonce_data, (gsize) _type); \
} \
return object_type; \
return (GType) gonce_data; \
}
#define __GST_DO_NOTHING(type) /* NOP */