From e333ec54c03a71b660b1f6730aff6854534a577c Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Wed, 20 Jul 2005 16:20:39 +0000 Subject: [PATCH] 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). --- ChangeLog | 7 +++++++ gst/gstinfo.c | 13 +++++++------ gst/gstinfo.h | 11 +++++++---- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index f8c0736..ad762f9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 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): * gst/gstmessage.h: Add _new_custom, make _new_application a macro to _new_custom. diff --git a/gst/gstinfo.c b/gst/gstinfo.c index 73f6ca4..dc20093 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 ab5bd80..d9c15ca 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 */ -- 2.7.4