From 408a7440394ae3966f518d389d0a64e85d423471 Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Tue, 17 Sep 2024 15:06:52 +0900 Subject: [PATCH] Fix build with gcc14 and various warnings Signed-off-by: Michele Calgaro --- gtk2/kgtk2.c | 154 ++++++++++++++++++++++++++------------------------- 1 file changed, 78 insertions(+), 76 deletions(-) diff --git a/gtk2/kgtk2.c b/gtk2/kgtk2.c index 4e83191..ff57775 100644 --- a/gtk2/kgtk2.c +++ b/gtk2/kgtk2.c @@ -66,6 +66,7 @@ TODO #include #include "connect.h" #include "config.h" +#include "ctype.h" #define BLACKLIST_UNKNOWN_GTK_APPS 0 @@ -187,7 +188,7 @@ typedef struct static gpointer kdialogdMain(gpointer data) { - KGtkData *d=(struct KGtkData *)data; + KGtkData *d=(KGtkData*)data; char buffer[MAX_DATA_LEN+1]={'\0'}; int num=0; @@ -247,7 +248,7 @@ static gboolean sendMessage(GtkWidget *widget, Operation op, GSList **res, gchar #ifdef KGTK_DEBUG printf("KGTK::Dialog has a parent!\n"); #endif - xid=GDK_WINDOW_XID(gtk_widget_get_toplevel(widget->parent)); + xid=GDK_WINDOW_XID(gtk_widget_get_toplevel(widget->parent)->window); } /* @@ -283,6 +284,7 @@ static gboolean sendMessage(GtkWidget *widget, Operation op, GSList **res, gchar GtkWidget *w=node->data; if(w && GTK_IS_WIDGET(w) && w->window) + { if(gtk_window_has_toplevel_focus(GTK_WINDOW(w)) && gtk_window_is_active(GTK_WINDOW(w))) { @@ -296,7 +298,10 @@ static gboolean sendMessage(GtkWidget *widget, Operation op, GSList **res, gchar break; } else - prevX=GDK_WINDOW_XID(w->window); + { + prevX=GDK_WINDOW_XID(w->window); + } + } } g_list_free(topWindows); } @@ -331,7 +336,7 @@ static gboolean sendMessage(GtkWidget *widget, Operation op, GSList **res, gchar gtk_window_set_skip_pager_hint(GTK_WINDOW(dlg), TRUE); kdialogdLoop = g_main_loop_new (NULL, FALSE); kdialogdError=FALSE; - g_thread_create(&kdialogdMain, &d, FALSE, NULL); + g_thread_new(NULL, &kdialogdMain, &d); GDK_THREADS_LEAVE(); g_main_loop_run(kdialogdLoop); @@ -456,7 +461,7 @@ static gboolean isMozApp(const char *app, const char *check) /* OK check for xulrunner-1.9 */ { double dummy; - if(app_len>(check_len+1) && 1==sscanf(&app[check_len+1], "%f", &dummy)) + if(app_len>(check_len+1) && 1==sscanf(&app[check_len+1], "%lf", &dummy)) return TRUE; } } @@ -537,8 +542,6 @@ static gboolean kgtkInit(const char *appName) { determineAppName(); if (((kgtkApp != APP_UNKNOWN) || (!BLACKLIST_UNKNOWN_GTK_APPS)) && (kgtkApp != APP_BLACKLISTED)) { - if(!g_threads_got_initialized) - g_thread_init(NULL); atexit(&kgtkExit); } } @@ -695,12 +698,12 @@ kgtk_dialog_add_buttons_valist ( GtkDialog *dialog, gboolean gtk_init_check(int *argc, char ***argv) { - static void * (*realFunction)() = NULL; + static gboolean (*realFunction)() = NULL; gboolean rv=FALSE; if(!realFunction) - realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "gtk_init_check"); + realFunction = (gboolean (*)()) real_dlsym(RTLD_NEXT, "gtk_init_check"); rv=realFunction(argc, argv); #ifdef KGTK_DEBUG @@ -1161,7 +1164,7 @@ void gtk_widget_hide(GtkWidget *widget) realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "gtk_widget_hide"); determineAppName(); - if (((kgtkApp == APP_UNKNOWN) && BLACKLIST_UNKNOWN_GTK_APPS) || (kgtkApp == APP_BLACKLISTED) && realFunction) { + if (((kgtkApp == APP_UNKNOWN && BLACKLIST_UNKNOWN_GTK_APPS) || kgtkApp == APP_BLACKLISTED) && realFunction) { #ifdef KGTK_DEBUG printf("KGTK::gtk_widget_hide Bypassing internal function\n"); fflush(stdout); #endif @@ -1184,12 +1187,12 @@ void gtk_widget_hide(GtkWidget *widget) gboolean gtk_file_chooser_get_do_overwrite_confirmation(GtkFileChooser *widget) { - static void * (*realFunction)() = NULL; + static gboolean (*realFunction)() = NULL; gboolean rv=FALSE; if(!realFunction) - realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "gtk_file_chooser_get_do_overwrite_confirmation"); + realFunction = (gboolean (*)()) real_dlsym(RTLD_NEXT, "gtk_file_chooser_get_do_overwrite_confirmation"); if(realFunction) { @@ -1200,12 +1203,12 @@ gboolean gtk_file_chooser_get_do_overwrite_confirmation(GtkFileChooser *widget) if(!data->setOverWrite) { data->setOverWrite=TRUE; - data->doOverwrite=(gboolean) realFunction(widget); + data->doOverwrite=realFunction(widget); } rv=data->doOverwrite; } else - rv=(gboolean) realFunction(widget); + rv=realFunction(widget); } return rv; @@ -1248,16 +1251,16 @@ int gtk_combo_box_get_active(GtkComboBox *combo) { int rv=0; - if(APP_KINO==kgtkApp && isOnFileChooser(combo)) + if(APP_KINO==kgtkApp && isOnFileChooser((GtkWidget*)combo)) return 1; else { - static void * (*realFunction)() = NULL; + static gint (*realFunction)(GtkComboBox*) = NULL; if(!realFunction) - realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "gtk_combo_box_get_active"); + realFunction = (gint (*)(GtkComboBox*)) real_dlsym(RTLD_NEXT, "gtk_combo_box_get_active"); - rv=(int)realFunction(combo); + rv=realFunction(combo); } return rv; @@ -1265,13 +1268,13 @@ int gtk_combo_box_get_active(GtkComboBox *combo) gint gtk_dialog_run(GtkDialog *dialog) { - static void * (*realFunction)() = NULL; + static gint (*realFunction)(GtkDialog*) = NULL; if(!realFunction) - realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "gtk_dialog_run"); + realFunction = (gint (*)(GtkDialog*)) real_dlsym(RTLD_NEXT, "gtk_dialog_run"); determineAppName(); - if (((kgtkApp == APP_UNKNOWN) && BLACKLIST_UNKNOWN_GTK_APPS) || (kgtkApp == APP_BLACKLISTED) && realFunction) { + if (((kgtkApp == APP_UNKNOWN && BLACKLIST_UNKNOWN_GTK_APPS) || kgtkApp == APP_BLACKLISTED) && realFunction) { #ifdef KGTK_DEBUG printf("KGTK::gtk_dialog_run Bypassing internal function\n"); fflush(stdout); #endif @@ -1468,15 +1471,15 @@ gint gtk_dialog_run(GtkDialog *dialog) g_signal_emit_by_name(dialog, "response", data->cancel); return data->cancel; } - return realFunction(dialog); + return (gint)realFunction(dialog); } void gtk_widget_destroy(GtkWidget *widget) { - static void * (*realFunction)() = NULL; + static void (*realFunction)(GtkWidget*) = NULL; if(!realFunction) - realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "gtk_widget_destroy"); + realFunction = (void (*)(GtkWidget*)) real_dlsym(RTLD_NEXT, "gtk_widget_destroy"); if(fileDialogHash && GTK_IS_FILE_CHOOSER(widget)) freeHash(widget); @@ -1488,13 +1491,13 @@ gchar * gtk_file_chooser_get_filename(GtkFileChooser *chooser) { KGtkFileData *data=lookupHash(chooser, FALSE); - static void * (*realFunction)() = NULL; + static gchar * (*realFunction)(GtkFileChooser*) = NULL; if(!realFunction) - realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "gtk_file_chooser_get_filename"); + realFunction = (gchar *(*)(GtkFileChooser*)) real_dlsym(RTLD_NEXT, "gtk_file_chooser_get_filename"); determineAppName(); - if (((kgtkApp == APP_UNKNOWN) && BLACKLIST_UNKNOWN_GTK_APPS) || (kgtkApp == APP_BLACKLISTED) && realFunction) { + if (((kgtkApp == APP_UNKNOWN && BLACKLIST_UNKNOWN_GTK_APPS) || kgtkApp == APP_BLACKLISTED) && realFunction) { #ifdef KGTK_DEBUG printf("KGTK::gtk_file_chooser_get_filename Bypassing internal function\n"); fflush(stdout); #endif @@ -1511,12 +1514,12 @@ gchar * gtk_file_chooser_get_filename(GtkFileChooser *chooser) gboolean gtk_file_chooser_select_filename(GtkFileChooser *chooser, const char *filename) { KGtkFileData *data=lookupHash(chooser, TRUE); - static void * (*realFunction)() = NULL; + static gboolean (*realFunction)(GtkFileChooser*, const char*) = NULL; if(!realFunction) - realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "gtk_file_chooser_select_filename"); + realFunction = (gboolean (*)(GtkFileChooser*, const char*)) real_dlsym(RTLD_NEXT, "gtk_file_chooser_select_filename"); realFunction(chooser, filename); - if (((kgtkApp == APP_UNKNOWN) && BLACKLIST_UNKNOWN_GTK_APPS) || (kgtkApp == APP_BLACKLISTED) && realFunction) { + if (((kgtkApp == APP_UNKNOWN && BLACKLIST_UNKNOWN_GTK_APPS) || kgtkApp == APP_BLACKLISTED) && realFunction) { return FALSE; } @@ -1538,7 +1541,7 @@ gboolean gtk_file_chooser_select_filename(GtkFileChooser *chooser, const char *f data->files=g_slist_prepend(data->files, g_strdup(filename)); - if(folder && !data->folder || strcmp(folder, data->folder)) + if(folder && (!data->folder || strcmp(folder, data->folder))) { gtk_file_chooser_set_current_folder(chooser, folder); g_free(folder); @@ -1557,7 +1560,7 @@ void gtk_file_chooser_unselect_all(GtkFileChooser *chooser) if(!realFunction) realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "gtk_file_chooser_unselect_all"); realFunction(chooser); - if (((kgtkApp == APP_UNKNOWN) && BLACKLIST_UNKNOWN_GTK_APPS) || (kgtkApp == APP_BLACKLISTED) && realFunction) { + if (((kgtkApp == APP_UNKNOWN && BLACKLIST_UNKNOWN_GTK_APPS) || kgtkApp == APP_BLACKLISTED) && realFunction) { return; } @@ -1580,7 +1583,7 @@ gboolean gtk_file_chooser_set_filename(GtkFileChooser *chooser, const char *file if(!realFunction) realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "gtk_file_chooser_set_filename"); realFunction(chooser, filename); - if (((kgtkApp == APP_UNKNOWN) && BLACKLIST_UNKNOWN_GTK_APPS) || (kgtkApp == APP_BLACKLISTED) && realFunction) { + if (((kgtkApp == APP_UNKNOWN && BLACKLIST_UNKNOWN_GTK_APPS) || kgtkApp == APP_BLACKLISTED) && realFunction) { return FALSE; } @@ -1621,15 +1624,14 @@ void gtk_file_chooser_set_current_name(GtkFileChooser *chooser, const char *file GtkFileChooserAction act=gtk_file_chooser_get_action(chooser); if ((GTK_FILE_CHOOSER_ACTION_SAVE==act || GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER==act) || - (((kgtkApp == APP_UNKNOWN) && BLACKLIST_UNKNOWN_GTK_APPS) || (kgtkApp == APP_BLACKLISTED)) - ) + ((kgtkApp == APP_UNKNOWN && BLACKLIST_UNKNOWN_GTK_APPS) || kgtkApp == APP_BLACKLISTED)) { static void * (*realFunction)() = NULL; if(!realFunction) realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "gtk_file_chooser_set_current_name"); realFunction(chooser, filename); - if (((kgtkApp == APP_UNKNOWN) && BLACKLIST_UNKNOWN_GTK_APPS) || (kgtkApp == APP_BLACKLISTED) && realFunction) { + if (((kgtkApp == APP_UNKNOWN && BLACKLIST_UNKNOWN_GTK_APPS) || kgtkApp == APP_BLACKLISTED) && realFunction) { return; } } @@ -1657,7 +1659,7 @@ GSList * gtk_file_chooser_get_filenames(GtkFileChooser *chooser) realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "gtk_file_chooser_get_filenames"); determineAppName(); - if (((kgtkApp == APP_UNKNOWN) && BLACKLIST_UNKNOWN_GTK_APPS) || (kgtkApp == APP_BLACKLISTED) && realFunction) { + if (((kgtkApp == APP_UNKNOWN && BLACKLIST_UNKNOWN_GTK_APPS) || kgtkApp == APP_BLACKLISTED) && realFunction) { #ifdef KGTK_DEBUG printf("KGTK::gtk_file_chooser_get_filenames Bypassing internal function\n"); fflush(stdout); #endif @@ -1694,7 +1696,7 @@ gboolean gtk_file_chooser_set_current_folder(GtkFileChooser *chooser, const gcha if(!realFunction) realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "gtk_file_chooser_set_current_folder"); realFunction(chooser, folder); - if (((kgtkApp == APP_UNKNOWN) && BLACKLIST_UNKNOWN_GTK_APPS) || (kgtkApp == APP_BLACKLISTED) && realFunction) { + if (((kgtkApp == APP_UNKNOWN && BLACKLIST_UNKNOWN_GTK_APPS) || kgtkApp == APP_BLACKLISTED) && realFunction) { return FALSE; } @@ -1723,7 +1725,7 @@ gchar * gtk_file_chooser_get_current_folder(GtkFileChooser *chooser) realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "gtk_file_chooser_get_current_folder"); determineAppName(); - if (((kgtkApp == APP_UNKNOWN) && BLACKLIST_UNKNOWN_GTK_APPS) || (kgtkApp == APP_BLACKLISTED) && realFunction) { + if (((kgtkApp == APP_UNKNOWN && BLACKLIST_UNKNOWN_GTK_APPS) || kgtkApp == APP_BLACKLISTED) && realFunction) { #ifdef KGTK_DEBUG printf("KGTK::gtk_file_chooser_get_current_folder Bypassing internal function\n"); fflush(stdout); #endif @@ -1751,7 +1753,7 @@ gchar * gtk_file_chooser_get_uri(GtkFileChooser *chooser) realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "gtk_file_chooser_get_uri"); determineAppName(); - if (((kgtkApp == APP_UNKNOWN) && BLACKLIST_UNKNOWN_GTK_APPS) || (kgtkApp == APP_BLACKLISTED) && realFunction) { + if (((kgtkApp == APP_UNKNOWN && BLACKLIST_UNKNOWN_GTK_APPS) || kgtkApp == APP_BLACKLISTED) && realFunction) { #ifdef KGTK_DEBUG printf("KGTK::gtk_file_chooser_get_uri Bypassing internal function\n"); fflush(stdout); #endif @@ -1776,13 +1778,13 @@ gchar * gtk_file_chooser_get_uri(GtkFileChooser *chooser) gboolean gtk_file_chooser_set_uri(GtkFileChooser *chooser, const char *uri) { - static void * (*realFunction)() = NULL; + static gboolean (*realFunction)(GtkFileChooser*, const char *) = NULL; if(!realFunction) - realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "gtk_file_chooser_set_uri"); + realFunction = (gboolean (*)(GtkFileChooser*, const char *)) real_dlsym(RTLD_NEXT, "gtk_file_chooser_set_uri"); determineAppName(); - if (((kgtkApp == APP_UNKNOWN) && BLACKLIST_UNKNOWN_GTK_APPS) || (kgtkApp == APP_BLACKLISTED) && realFunction) { + if (((kgtkApp == APP_UNKNOWN && BLACKLIST_UNKNOWN_GTK_APPS) || kgtkApp == APP_BLACKLISTED) && realFunction) { #ifdef KGTK_DEBUG printf("KGTK::gtk_file_chooser_set_uri Bypassing internal function\n"); fflush(stdout); #endif @@ -1813,7 +1815,7 @@ GSList * gtk_file_chooser_get_uris(GtkFileChooser *chooser) realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "gtk_file_chooser_get_uris"); determineAppName(); - if (((kgtkApp == APP_UNKNOWN) && BLACKLIST_UNKNOWN_GTK_APPS) || (kgtkApp == APP_BLACKLISTED) && realFunction) { + if (((kgtkApp == APP_UNKNOWN && BLACKLIST_UNKNOWN_GTK_APPS) || kgtkApp == APP_BLACKLISTED) && realFunction) { #ifdef KGTK_DEBUG printf("KGTK::gtk_file_chooser_get_uris Bypassing internal function\n"); fflush(stdout); #endif @@ -1828,13 +1830,13 @@ GSList * gtk_file_chooser_get_uris(GtkFileChooser *chooser) gboolean gtk_file_chooser_set_current_folder_uri(GtkFileChooser *chooser, const gchar *uri) { - static void * (*realFunction)() = NULL; + static gboolean (*realFunction)(GtkFileChooser*, const gchar*) = NULL; if(!realFunction) - realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "gtk_file_chooser_set_current_folder_uri"); + realFunction = (gboolean (*)(GtkFileChooser*, const gchar*)) real_dlsym(RTLD_NEXT, "gtk_file_chooser_set_current_folder_uri"); determineAppName(); - if (((kgtkApp == APP_UNKNOWN) && BLACKLIST_UNKNOWN_GTK_APPS) || (kgtkApp == APP_BLACKLISTED) && realFunction) { + if (((kgtkApp == APP_UNKNOWN && BLACKLIST_UNKNOWN_GTK_APPS) || kgtkApp == APP_BLACKLISTED) && realFunction) { #ifdef KGTK_DEBUG printf("KGTK::gtk_file_chooser_set_current_folder_uri Bypassing internal function\n"); fflush(stdout); #endif @@ -1858,13 +1860,13 @@ gboolean gtk_file_chooser_set_current_folder_uri(GtkFileChooser *chooser, const gchar * gtk_file_chooser_get_current_folder_uri(GtkFileChooser *chooser) { - static void * (*realFunction)() = NULL; + static gchar * (*realFunction)(GtkFileChooser*) = NULL; if(!realFunction) - realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "gtk_file_chooser_get_current_folder_uri"); + realFunction = (gchar *(*)(GtkFileChooser*)) real_dlsym(RTLD_NEXT, "gtk_file_chooser_get_current_folder_uri"); determineAppName(); - if (((kgtkApp == APP_UNKNOWN) && BLACKLIST_UNKNOWN_GTK_APPS) || (kgtkApp == APP_BLACKLISTED) && realFunction) { + if (((kgtkApp == APP_UNKNOWN && BLACKLIST_UNKNOWN_GTK_APPS) || kgtkApp == APP_BLACKLISTED) && realFunction) { #ifdef KGTK_DEBUG printf("KGTK::gtk_file_chooser_get_current_folder_uri Bypassing internal function\n"); fflush(stdout); #endif @@ -1919,7 +1921,7 @@ GtkWidget * gtk_dialog_add_button(GtkDialog *dialog, const gchar *button_text, g dlg = realFunction(dialog, button_text, response_id); determineAppName(); - if (((kgtkApp == APP_UNKNOWN) && BLACKLIST_UNKNOWN_GTK_APPS) || (kgtkApp == APP_BLACKLISTED) && realFunction) { + if (((kgtkApp == APP_UNKNOWN && BLACKLIST_UNKNOWN_GTK_APPS) || kgtkApp == APP_BLACKLISTED) && realFunction) { #ifdef KGTK_DEBUG printf("KGTK::gtk_dialog_add_button Bypassing internal function\n"); fflush(stdout); #endif @@ -1961,7 +1963,7 @@ void gtk_dialog_add_buttons(GtkDialog *dialog, const gchar *first_button_text, . va_end(varargs); determineAppName(); - if (((kgtkApp == APP_UNKNOWN) && BLACKLIST_UNKNOWN_GTK_APPS) || (kgtkApp == APP_BLACKLISTED)) { + if (((kgtkApp == APP_UNKNOWN && BLACKLIST_UNKNOWN_GTK_APPS) || kgtkApp == APP_BLACKLISTED)) { #ifdef KGTK_DEBUG printf("KGTK::gtk_dialog_add_buttons Bypassing internal function\n"); fflush(stdout); #endif @@ -2010,7 +2012,7 @@ GtkWidget * gtk_file_chooser_dialog_new(const gchar *title, GtkWindow *parent, va_end(varargs); determineAppName(); - if (((kgtkApp == APP_UNKNOWN) && BLACKLIST_UNKNOWN_GTK_APPS) || (kgtkApp == APP_BLACKLISTED)) { + if (((kgtkApp == APP_UNKNOWN && BLACKLIST_UNKNOWN_GTK_APPS) || kgtkApp == APP_BLACKLISTED)) { #ifdef KGTK_DEBUG printf("KGTK::gtk_file_chooser_dialog_new Bypassing internal function\n"); fflush(stdout); #endif @@ -2052,7 +2054,7 @@ static void handleGtkFileChooserButtonClicked(GtkButton *button, gpointer user_d #ifdef KGTK_DEBUG printf("KGTK::handleGtkFileChooserButtonClicked\n"); #endif - gtk_dialog_run(GTK_FILE_CHOOSER_BUTTON(user_data)->priv->dialog); + gtk_dialog_run((GtkDialog*)GTK_FILE_CHOOSER_BUTTON(user_data)->priv->dialog); } static void handleGtkFileChooserComboChanged(GtkComboBox *combo_box, gpointer user_data) @@ -2074,7 +2076,7 @@ static void handleGtkFileChooserComboChanged(GtkComboBox *combo_box, gpointer us gtk_tree_model_get(priv->filter_model, &iter, TYPE_COLUMN, &type, -1); if(ROW_TYPE_OTHER==type) - gtk_dialog_run(GTK_FILE_CHOOSER_BUTTON(user_data)->priv->dialog); + gtk_dialog_run((GtkDialog*)GTK_FILE_CHOOSER_BUTTON(user_data)->priv->dialog); else { g_signal_handler_unblock(priv->combo_box, priv->combo_box_changed_id); @@ -2103,7 +2105,7 @@ GtkWidget * gtk_file_chooser_button_new(const gchar *title, GtkFileChooserAction { GtkFileChooserButtonPrivate *priv=NULL; - button=realFunction(title, action); + button=(GtkWidget*)realFunction(title, action); priv=GTK_FILE_CHOOSER_BUTTON(button)->priv; if(priv->button) @@ -2239,38 +2241,38 @@ void * PR_FindFunctionSymbol(struct PR_LoadLibrary *lib, const char *raw_name) /* Overriding dlsym is required for SWT - which dlsym's the gtk_file_chooser functions! */ static void * real_dlsym(void *handle, const char *name) { - static void * (*realFunction)() = NULL; + static void * (*realFunction)() = NULL; #ifdef KGTK_DEBUG_DLSYM - printf("KGTK::real_dlsym : %s\n", name); + printf("KGTK::real_dlsym : %s\n", name); #endif - if (!realFunction) - { - // Get the real dlsym function + if (!realFunction) + { + // Get the real dlsym function #ifdef HAVE_DL_SYM - realFunction = _dl_sym(RTLD_NEXT, "dlsym", dlsym); + realFunction = _dl_sym(RTLD_NEXT, "dlsym", dlsym); #else - realFunction = dlvsym(RTLD_NEXT, "dlsym", "GLIBC_2.2.5"); + realFunction = dlvsym(RTLD_NEXT, "dlsym", "GLIBC_2.2.5"); #endif - } + } - if (realFunction) - return realFunction(handle, name); - else - { - printf("kgtk-qt3 gtk2 real_dlsymc() realFunction not found!!\n"); - return NULL; - } + if (realFunction) + return realFunction(handle, name); + else + { + printf("kgtk-qt3 gtk2 real_dlsymc() realFunction not found!!\n"); + return NULL; + } } void * dlsym(void *handle, const char *name) { - // Need this so _dl_sym will be able to find the next dlsym, i.e. the real dlsym! - if (!strcmp(name, "dlsym")) - { - return (void*)dlsym; - } + // Need this so _dl_sym will be able to find the next dlsym, i.e. the real dlsym! + if (!strcmp(name, "dlsym")) + { + return (void*)dlsym; + } void *rv=NULL;