gst/gstinfo.*: Fix illegal cast on some platforms (#309253).

Original commit message from CVS:
* gst/gstinfo.c: (_gst_debug_nameof_funcptr),
(_gst_debug_register_funcptr):
* gst/gstinfo.h:
Fix illegal cast on some platforms (#309253).
This commit is contained in:
Ronald S. Bultje 2005-07-20 16:20:39 +00:00
parent 3b19336fcc
commit e333ec54c0
3 changed files with 21 additions and 10 deletions

View file

@ -1,3 +1,10 @@
2005-07-20 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* gst/gstinfo.c: (_gst_debug_nameof_funcptr),
(_gst_debug_register_funcptr):
* gst/gstinfo.h:
Fix illegal cast on some platforms (#309253).
2005-07-20 Ronald S. Bultje <rbultje@ronald.bitfreak.net> 2005-07-20 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* gst/gstmessage.c: (gst_message_new_custom): * gst/gstmessage.c: (gst_message_new_custom):

View file

@ -1030,12 +1030,13 @@ gst_debug_get_all_categories (void)
GHashTable *__gst_function_pointers = NULL; GHashTable *__gst_function_pointers = NULL;
const gchar * const gchar *
_gst_debug_nameof_funcptr (void *ptr) _gst_debug_nameof_funcptr (GstDebugFuncPtr ptr)
G_GNUC_NO_INSTRUMENT; G_GNUC_NO_INSTRUMENT;
/* This function MUST NOT return NULL */ /* This function MUST NOT return NULL */
const gchar *_gst_debug_nameof_funcptr (void *ptr) const gchar *_gst_debug_nameof_funcptr (GstDebugFuncPtr func)
{ {
gpointer ptr = (gpointer) func;
gchar *ptrname; gchar *ptrname;
#ifdef HAVE_DLADDR #ifdef HAVE_DLADDR
@ -1064,15 +1065,15 @@ _gst_debug_nameof_funcptr (void *ptr)
} }
} }
void * void
_gst_debug_register_funcptr (void *ptr, gchar * ptrname) _gst_debug_register_funcptr (GstDebugFuncPtr func, gchar * ptrname)
{ {
gpointer ptr = (gpointer) func;
if (!__gst_function_pointers) if (!__gst_function_pointers)
__gst_function_pointers = g_hash_table_new (g_direct_hash, g_direct_equal); __gst_function_pointers = g_hash_table_new (g_direct_hash, g_direct_equal);
if (!g_hash_table_lookup (__gst_function_pointers, ptr)) if (!g_hash_table_lookup (__gst_function_pointers, ptr))
g_hash_table_insert (__gst_function_pointers, ptr, ptrname); g_hash_table_insert (__gst_function_pointers, ptr, ptrname);
return ptr;
} }
#ifdef HAVE_PRINTF_EXTENSION #ifdef HAVE_PRINTF_EXTENSION

View file

@ -592,13 +592,16 @@ GST_LOG (const char *format, ...)
/********** function pointer stuff **********/ /********** function pointer stuff **********/
void * _gst_debug_register_funcptr (void * ptr, typedef void (* GstDebugFuncPtr) (void);
void _gst_debug_register_funcptr (GstDebugFuncPtr func,
gchar * ptrname); gchar * ptrname);
G_CONST_RETURN gchar * G_CONST_RETURN gchar *
_gst_debug_nameof_funcptr (void * ptr); _gst_debug_nameof_funcptr (GstDebugFuncPtr func);
#define GST_DEBUG_FUNCPTR(ptr) (_gst_debug_register_funcptr((void *)(ptr), #ptr) , ptr) #define GST_DEBUG_FUNCPTR(ptr) \
#define GST_DEBUG_FUNCPTR_NAME(ptr) _gst_debug_nameof_funcptr((void *)ptr) (_gst_debug_register_funcptr((GstDebugFuncPtr)(ptr), #ptr) , ptr)
#define GST_DEBUG_FUNCPTR_NAME(ptr) \
_gst_debug_nameof_funcptr((GstDebugFuncPtr)ptr)
#else /* GST_DISABLE_GST_DEBUG */ #else /* GST_DISABLE_GST_DEBUG */