diff --git a/ChangeLog b/ChangeLog index f8c073698e..ad762f99d6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-07-20 Ronald S. Bultje + + * 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 * gst/gstmessage.c: (gst_message_new_custom): diff --git a/gst/gstinfo.c b/gst/gstinfo.c index 73f6ca4c46..dc20093a36 100644 --- a/gst/gstinfo.c +++ b/gst/gstinfo.c @@ -1030,12 +1030,13 @@ gst_debug_get_all_categories (void) GHashTable *__gst_function_pointers = NULL; const gchar * -_gst_debug_nameof_funcptr (void *ptr) +_gst_debug_nameof_funcptr (GstDebugFuncPtr ptr) G_GNUC_NO_INSTRUMENT; /* 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; #ifdef HAVE_DLADDR @@ -1064,15 +1065,15 @@ _gst_debug_nameof_funcptr (void *ptr) } } -void * -_gst_debug_register_funcptr (void *ptr, gchar * ptrname) +void +_gst_debug_register_funcptr (GstDebugFuncPtr func, gchar * ptrname) { + gpointer ptr = (gpointer) func; + if (!__gst_function_pointers) __gst_function_pointers = g_hash_table_new (g_direct_hash, g_direct_equal); if (!g_hash_table_lookup (__gst_function_pointers, ptr)) g_hash_table_insert (__gst_function_pointers, ptr, ptrname); - - return ptr; } #ifdef HAVE_PRINTF_EXTENSION diff --git a/gst/gstinfo.h b/gst/gstinfo.h index ab5bd80991..d9c15ca286 100644 --- a/gst/gstinfo.h +++ b/gst/gstinfo.h @@ -592,13 +592,16 @@ GST_LOG (const char *format, ...) /********** function pointer stuff **********/ -void * _gst_debug_register_funcptr (void * ptr, +typedef void (* GstDebugFuncPtr) (void); +void _gst_debug_register_funcptr (GstDebugFuncPtr func, gchar * ptrname); 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_NAME(ptr) _gst_debug_nameof_funcptr((void *)ptr) +#define GST_DEBUG_FUNCPTR(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 */