From 0bb23a9bb6c8b1324b81db3ab82ea71d2ec58092 Mon Sep 17 00:00:00 2001
From: Slávek Banko <slavek.banko@axis.cz>
Date: Sat, 30 Aug 2025 11:20:58 +0200
Subject: Use the complete definition of the prototype functions. This solves
 FTBFS in checking the compatibility of pointers.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
---
 gtk2/kgtk2.c | 78 ++++++++++++++++++++++++++++++------------------------------
 1 file changed, 39 insertions(+), 39 deletions(-)

diff --git a/gtk2/kgtk2.c b/gtk2/kgtk2.c
index 0cae4dd..182ed6c 100644
--- a/gtk2/kgtk2.c
+++ b/gtk2/kgtk2.c
@@ -699,12 +699,12 @@ kgtk_dialog_add_buttons_valist (    GtkDialog            *dialog,
 
 gboolean gtk_init_check(int *argc, char ***argv)
 {
-    static gboolean (*realFunction)() = NULL;
+    static gboolean (*realFunction)(int*, char***) = NULL;
 
     gboolean rv=FALSE;
 
     if(!realFunction)
-        realFunction = (gboolean (*)()) real_dlsym(RTLD_NEXT, "gtk_init_check");
+        realFunction = (gboolean (*)(int*, char***)) real_dlsym(RTLD_NEXT, "gtk_init_check");
 
     rv=realFunction(argc, argv);
 #ifdef KGTK_DEBUG
@@ -717,10 +717,10 @@ gboolean gtk_init_check(int *argc, char ***argv)
 
 void gtk_init(int *argc, char ***argv)
 {
-    static void * (*realFunction)() = NULL;
+    static void * (*realFunction)(int*, char***) = NULL;
 
     if(!realFunction)
-        realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "gtk_init");
+        realFunction = (void *(*)(int*, char***)) real_dlsym(RTLD_NEXT, "gtk_init");
 
     realFunction(argc, argv);
 #ifdef KGTK_DEBUG
@@ -1121,10 +1121,10 @@ static GSList * addProtocols(GSList *files)
 
 void gtk_window_present(GtkWindow *window)
 {
-    static void * (*realFunction)() = NULL;
+    static void * (*realFunction)(GtkWindow*) = NULL;
 
     if(!realFunction)
-        realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "gtk_window_present");
+        realFunction = (void *(*)(GtkWindow*)) real_dlsym(RTLD_NEXT, "gtk_window_present");
 
 #ifdef KGTK_DEBUG
     printf("KGTK::gtk_window_present %s %d\n", gtk_type_name(GTK_WIDGET_TYPE(window)),
@@ -1139,10 +1139,10 @@ void gtk_window_present(GtkWindow *window)
 
 void gtk_widget_show(GtkWidget *widget)
 {
-    static void * (*realFunction)() = NULL;
+    static void * (*realFunction)(GtkWidget*) = NULL;
 
     if(!realFunction)
-        realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "gtk_widget_show");
+        realFunction = (void *(*)(GtkWidget*)) real_dlsym(RTLD_NEXT, "gtk_widget_show");
 
     if(widget && !GTK_IS_FILE_CHOOSER_BUTTON(widget) && GTK_IS_FILE_CHOOSER(widget))
     {
@@ -1159,10 +1159,10 @@ void gtk_widget_show(GtkWidget *widget)
 
 void gtk_widget_hide(GtkWidget *widget)
 {
-    static void * (*realFunction)() = NULL;
+    static void * (*realFunction)(GtkWidget*) = NULL;
 
     if(!realFunction)
-        realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "gtk_widget_hide");
+        realFunction = (void *(*)(GtkWidget*)) real_dlsym(RTLD_NEXT, "gtk_widget_hide");
 
     determineAppName();
     if (((kgtkApp == APP_UNKNOWN && BLACKLIST_UNKNOWN_GTK_APPS) || kgtkApp == APP_BLACKLISTED) && realFunction) {
@@ -1188,12 +1188,12 @@ void gtk_widget_hide(GtkWidget *widget)
 
 gboolean gtk_file_chooser_get_do_overwrite_confirmation(GtkFileChooser *widget)
 {
-    static gboolean (*realFunction)() = NULL;
+    static gboolean (*realFunction)(GtkFileChooser*) = NULL;
 
     gboolean rv=FALSE;
 
     if(!realFunction)
-        realFunction = (gboolean (*)()) real_dlsym(RTLD_NEXT, "gtk_file_chooser_get_do_overwrite_confirmation");
+        realFunction = (gboolean (*)(GtkFileChooser*)) real_dlsym(RTLD_NEXT, "gtk_file_chooser_get_do_overwrite_confirmation");
 
     if(realFunction)
     {
@@ -1218,10 +1218,10 @@ gboolean gtk_file_chooser_get_do_overwrite_confirmation(GtkFileChooser *widget)
 /* ext => called from app, not kgtk */
 void kgtkFileChooserSetDoOverwriteConfirmation(GtkFileChooser *widget, gboolean v, gboolean ext)
 {
-    static void * (*realFunction)() = NULL;
+    static void * (*realFunction)(GtkFileChooser*, gboolean) = NULL;
 
     if(!realFunction)
-        realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "gtk_file_chooser_set_do_overwrite_confirmation");
+        realFunction = (void *(*)(GtkFileChooser*, gboolean)) real_dlsym(RTLD_NEXT, "gtk_file_chooser_set_do_overwrite_confirmation");
 
     if(realFunction)
     {
@@ -1556,10 +1556,10 @@ gboolean gtk_file_chooser_select_filename(GtkFileChooser *chooser, const char *f
 void gtk_file_chooser_unselect_all(GtkFileChooser *chooser)
 {
     KGtkFileData *data=lookupHash(chooser, TRUE);
-    static void * (*realFunction)() = NULL;
+    static void * (*realFunction)(GtkFileChooser*) = NULL;
 
     if(!realFunction)
-        realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "gtk_file_chooser_unselect_all");
+        realFunction = (void *(*)(GtkFileChooser*)) real_dlsym(RTLD_NEXT, "gtk_file_chooser_unselect_all");
     realFunction(chooser);
     if (((kgtkApp == APP_UNKNOWN && BLACKLIST_UNKNOWN_GTK_APPS) || kgtkApp == APP_BLACKLISTED) && realFunction) {
         return;
@@ -1579,10 +1579,10 @@ void gtk_file_chooser_unselect_all(GtkFileChooser *chooser)
 gboolean gtk_file_chooser_set_filename(GtkFileChooser *chooser, const char *filename)
 {
     KGtkFileData *data=lookupHash(chooser, TRUE);
-    static void * (*realFunction)() = NULL;
+    static void * (*realFunction)(GtkFileChooser*, const char*) = NULL;
 
     if(!realFunction)
-        realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "gtk_file_chooser_set_filename");
+        realFunction = (void *(*)(GtkFileChooser*, const char*)) real_dlsym(RTLD_NEXT, "gtk_file_chooser_set_filename");
     realFunction(chooser, filename);
     if (((kgtkApp == APP_UNKNOWN && BLACKLIST_UNKNOWN_GTK_APPS) || kgtkApp == APP_BLACKLISTED) && realFunction) {
         return FALSE;
@@ -1627,10 +1627,10 @@ void gtk_file_chooser_set_current_name(GtkFileChooser *chooser, const char *file
     if ((GTK_FILE_CHOOSER_ACTION_SAVE==act || GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER==act) ||
            ((kgtkApp == APP_UNKNOWN && BLACKLIST_UNKNOWN_GTK_APPS) || kgtkApp == APP_BLACKLISTED))
     {
-        static void * (*realFunction)() = NULL;
+        static void * (*realFunction)(GtkFileChooser*, const char*) = NULL;
 
         if(!realFunction)
-            realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "gtk_file_chooser_set_current_name");
+            realFunction = (void *(*)(GtkFileChooser*, const char*)) 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) {
             return;
@@ -1654,10 +1654,10 @@ GSList * gtk_file_chooser_get_filenames(GtkFileChooser *chooser)
     KGtkFileData *data=lookupHash(chooser, FALSE);
     GSList       *rv=NULL;
 
-    static void * (*realFunction)() = NULL;
+    static void * (*realFunction)(GtkFileChooser*) = NULL;
 
     if(!realFunction)
-        realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "gtk_file_chooser_get_filenames");
+        realFunction = (void *(*)(GtkFileChooser*)) real_dlsym(RTLD_NEXT, "gtk_file_chooser_get_filenames");
 
     determineAppName();
     if (((kgtkApp == APP_UNKNOWN && BLACKLIST_UNKNOWN_GTK_APPS) || kgtkApp == APP_BLACKLISTED) && realFunction) {
@@ -1692,10 +1692,10 @@ GSList * gtk_file_chooser_get_filenames(GtkFileChooser *chooser)
 gboolean gtk_file_chooser_set_current_folder(GtkFileChooser *chooser, const gchar *folder)
 {
     KGtkFileData *data=lookupHash(chooser, TRUE);
-    static void * (*realFunction)() = NULL;
+    static void * (*realFunction)(GtkFileChooser*, const gchar*) = NULL;
 
     if(!realFunction)
-        realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "gtk_file_chooser_set_current_folder");
+        realFunction = (void *(*)(GtkFileChooser*, const gchar*)) 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) {
         return FALSE;
@@ -1720,10 +1720,10 @@ gchar * gtk_file_chooser_get_current_folder(GtkFileChooser *chooser)
 {
     KGtkFileData *data=lookupHash(chooser, FALSE);
 
-    static void * (*realFunction)() = NULL;
+    static void * (*realFunction)(GtkFileChooser*) = NULL;
 
     if(!realFunction)
-        realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "gtk_file_chooser_get_current_folder");
+        realFunction = (void *(*)(GtkFileChooser*)) real_dlsym(RTLD_NEXT, "gtk_file_chooser_get_current_folder");
 
     determineAppName();
     if (((kgtkApp == APP_UNKNOWN && BLACKLIST_UNKNOWN_GTK_APPS) || kgtkApp == APP_BLACKLISTED) && realFunction) {
@@ -1748,10 +1748,10 @@ gchar * gtk_file_chooser_get_current_folder(GtkFileChooser *chooser)
 
 gchar * gtk_file_chooser_get_uri(GtkFileChooser *chooser)
 {
-    static void * (*realFunction)() = NULL;
+    static void * (*realFunction)(GtkFileChooser*) = NULL;
 
     if(!realFunction)
-        realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "gtk_file_chooser_get_uri");
+        realFunction = (void *(*)(GtkFileChooser*)) real_dlsym(RTLD_NEXT, "gtk_file_chooser_get_uri");
 
     determineAppName();
     if (((kgtkApp == APP_UNKNOWN && BLACKLIST_UNKNOWN_GTK_APPS) || kgtkApp == APP_BLACKLISTED) && realFunction) {
@@ -1810,10 +1810,10 @@ gboolean gtk_file_chooser_set_uri(GtkFileChooser *chooser, const char *uri)
 
 GSList * gtk_file_chooser_get_uris(GtkFileChooser *chooser)
 {
-    static void * (*realFunction)() = NULL;
+    static void * (*realFunction)(GtkFileChooser*) = NULL;
 
     if(!realFunction)
-        realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "gtk_file_chooser_get_uris");
+        realFunction = (void *(*)(GtkFileChooser*)) real_dlsym(RTLD_NEXT, "gtk_file_chooser_get_uris");
 
     determineAppName();
     if (((kgtkApp == APP_UNKNOWN && BLACKLIST_UNKNOWN_GTK_APPS) || kgtkApp == APP_BLACKLISTED) && realFunction) {
@@ -1893,10 +1893,10 @@ gchar * gtk_file_chooser_get_current_folder_uri(GtkFileChooser *chooser)
 
 void g_signal_stop_emission_by_name(gpointer instance, const gchar *detailed_signal)
 {
-    static void * (*realFunction)() = NULL;
+    static void * (*realFunction)(gpointer, const gchar*) = NULL;
 
     if(!realFunction)
-        realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "g_signal_stop_emission_by_name");
+        realFunction = (void *(*)(gpointer, const gchar*)) real_dlsym(RTLD_NEXT, "g_signal_stop_emission_by_name");
 
 #ifdef KGTK_DEBUG
     printf("KGTK::g_signal_stop_emission_by_name %s  %s (check)\n", gtk_type_name(GTK_WIDGET_TYPE(instance)), detailed_signal);
@@ -1912,13 +1912,13 @@ void g_signal_stop_emission_by_name(gpointer instance, const gchar *detailed_sig
 
 GtkWidget * gtk_dialog_add_button(GtkDialog *dialog, const gchar *button_text, gint response_id)
 {
-    static void * (*realFunction)() = NULL;
+    static void * (*realFunction)(GtkDialog*, const gchar*, gint) = NULL;
 
     GtkWidget    *dlg=NULL;
     KGtkFileData *data=NULL;
 
     if(!realFunction)
-        realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "gtk_dialog_add_button");
+        realFunction = (void *(*)(GtkDialog*, const gchar*, gint)) real_dlsym(RTLD_NEXT, "gtk_dialog_add_button");
     dlg = realFunction(dialog, button_text, response_id);
 
     determineAppName();
@@ -2091,12 +2091,12 @@ static void handleGtkFileChooserComboChanged(GtkComboBox *combo_box, gpointer us
 
 GtkWidget * gtk_file_chooser_button_new(const gchar *title, GtkFileChooserAction action)
 {
-    static void * (*realFunction)() = NULL;
+    static void * (*realFunction)(const gchar*, GtkFileChooserAction) = NULL;
 
     GtkWidget *button=NULL;
 
     if(!realFunction)
-        realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "gtk_file_chooser_button_new");
+        realFunction = (void *(*)(const gchar*, GtkFileChooserAction)) real_dlsym(RTLD_NEXT, "gtk_file_chooser_button_new");
 
 #ifdef KGTK_DEBUG
     printf("KGTK::gtk_file_chooser_button_new\n");
@@ -2208,12 +2208,12 @@ const gchar * kgtk_g_module_check_init(GModule *module)
 /* Mozilla specific */
 void * PR_FindFunctionSymbol(struct PR_LoadLibrary *lib, const char *raw_name)
 {
-    static void * (*realFunction)() = NULL;
+    static void * (*realFunction)(struct PR_LoadLibrary*, const char*) = NULL;
 
     void *rv=NULL;
 
     if(!realFunction)
-        realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "PR_FindFunctionSymbol");
+        realFunction = (void *(*)(struct PR_LoadLibrary*, const char*)) real_dlsym(RTLD_NEXT, "PR_FindFunctionSymbol");
 
 #ifdef KGTK_DEBUG_DLSYM
     printf("KGTK::PR_FindFunctionSymbol : %s\n", raw_name);
@@ -2242,7 +2242,7 @@ 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)(void*, const char*) = NULL;
 
 #ifdef KGTK_DEBUG_DLSYM
   printf("KGTK::real_dlsym : %s\n", name);
-- 
cgit v1.2.3

