1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231
|
From: Mamoru TASAKA <mtasaka@fedoraproject.org>
Date: Tue, 21 Jan 2025 16:10:30 +0900
Subject: Fix C23 function prototypes
Function declarations are required to have parameter information in C23.
Specify the parameters explicitly so it conforms with this C standard where
needed. ptk_dir_tree_new actually doesn't take any parameters. So, in this
case, simply drop the argument from the function call instead.
Properly handle function assignments as well, so their types matches.
Origin: vendor, https://src.fedoraproject.org/rpms/spacefm/blob/rawhide/f/spacefm-1.0.6-c23-function-proto.patch
Forwarded: https://github.com/IgnorantGuru/spacefm/pull/828
Bug-Debian: https://bugs.debian.org/1097912
---
src/cust-dialog.c | 2 +-
src/ptk/ptk-dir-tree-view.c | 2 +-
src/ptk/ptk-file-misc.c | 44 ++++++++++++++++++++++----------------------
src/settings.c | 8 ++++----
src/settings.h | 10 +++++++---
5 files changed, 35 insertions(+), 31 deletions(-)
diff --git a/src/cust-dialog.c b/src/cust-dialog.c
index 38252ee..59b88d2 100644
--- a/src/cust-dialog.c
+++ b/src/cust-dialog.c
@@ -3806,7 +3806,7 @@ static void show_help()
fprintf( f, " %s\n\n", DEFAULT_MANUAL );
}
-void signal_handler()
+void signal_handler(int signal)
{
if ( signal_dialog )
{
diff --git a/src/ptk/ptk-dir-tree-view.c b/src/ptk/ptk-dir-tree-view.c
index 5781084..8b96435 100644
--- a/src/ptk/ptk-dir-tree-view.c
+++ b/src/ptk/ptk-dir-tree-view.c
@@ -357,7 +357,7 @@ GtkTreeModel* get_dir_tree_model()
if ( G_UNLIKELY( ! dir_tree_model ) )
{
- dir_tree_model = ptk_dir_tree_new( TRUE );
+ dir_tree_model = ptk_dir_tree_new();
g_object_add_weak_pointer( G_OBJECT( dir_tree_model ),
( gpointer * ) (GtkWidget *) & dir_tree_model );
}
diff --git a/src/ptk/ptk-file-misc.c b/src/ptk/ptk-file-misc.c
index a15c72b..72425ef 100644
--- a/src/ptk/ptk-file-misc.c
+++ b/src/ptk/ptk-file-misc.c
@@ -1338,7 +1338,7 @@ void on_opt_toggled( GtkMenuItem* item, MoveSet* mset )
void on_toggled( GtkMenuItem* item, MoveSet* mset )
{
//int (*show) () = NULL;
- void (*show) () = NULL;
+ void (*show) (GtkWidget *) = NULL;
gboolean someone_is_visible = FALSE;
gboolean opts_visible = FALSE;
@@ -1406,54 +1406,54 @@ void on_toggled( GtkMenuItem* item, MoveSet* mset )
// entries
if ( xset_get_b( "move_name" ) )
{
- show = (GFunc)gtk_widget_show;
+ show = gtk_widget_show;
someone_is_visible = TRUE;
}
else
- show = (GFunc)gtk_widget_hide;
- show( mset->label_name );
+ show = gtk_widget_hide;
+ show( GTK_WIDGET(mset->label_name) );
show( mset->scroll_name );
show( mset->hbox_ext );
- show( mset->blank_name );
+ show( GTK_WIDGET(mset->blank_name) );
if ( xset_get_b( "move_filename" ) )
{
- show = (GFunc)gtk_widget_show;
+ show = gtk_widget_show;
someone_is_visible = TRUE;
}
else
- show = (GFunc)gtk_widget_hide;
- show( mset->label_full_name );
+ show = gtk_widget_hide;
+ show( GTK_WIDGET(mset->label_full_name) );
show( mset->scroll_full_name );
- show( mset->blank_full_name );
+ show( GTK_WIDGET(mset->blank_full_name) );
if ( xset_get_b( "move_parent" ) )
{
- show = (GFunc)gtk_widget_show;
+ show = gtk_widget_show;
someone_is_visible = TRUE;
}
else
- show = (GFunc)gtk_widget_hide;
- show( mset->label_path );
+ show = gtk_widget_hide;
+ show( GTK_WIDGET(mset->label_path) );
show( mset->scroll_path );
- show( mset->blank_path );
+ show( GTK_WIDGET(mset->blank_path) );
if ( xset_get_b( "move_path" ) )
{
- show = (GFunc)gtk_widget_show;
+ show = gtk_widget_show;
someone_is_visible = TRUE;
}
else
- show = (GFunc)gtk_widget_hide;
- show( mset->label_full_path );
+ show = gtk_widget_hide;
+ show( GTK_WIDGET(mset->label_full_path) );
show( mset->scroll_full_path );
if ( !mset->is_link && !mset->create_new && xset_get_b( "move_type" ) )
{
- show = (GFunc)gtk_widget_show;
+ show = gtk_widget_show;
}
else
- show = (GFunc)gtk_widget_hide;
+ show = gtk_widget_hide;
show( mset->hbox_type );
gboolean new_file = FALSE;
@@ -1468,15 +1468,15 @@ void on_toggled( GtkMenuItem* item, MoveSet* mset )
if ( new_link || ( mset->is_link && xset_get_b( "move_target" ) ) )
{
- show = (GFunc)gtk_widget_show;
+ show = gtk_widget_show;
}
else
- show = (GFunc)gtk_widget_hide;
+ show = gtk_widget_hide;
show( mset->hbox_target );
if ( ( new_file || new_folder ) && xset_get_b( "move_template" ) )
{
- show = (GFunc)gtk_widget_show;
+ show = gtk_widget_show;
if ( new_file )
{
gtk_widget_show( GTK_WIDGET( mset->combo_template ) );
@@ -1493,7 +1493,7 @@ void on_toggled( GtkMenuItem* item, MoveSet* mset )
}
}
else
- show = (GFunc)gtk_widget_hide;
+ show = gtk_widget_hide;
show( mset->hbox_template );
if ( !someone_is_visible )
diff --git a/src/settings.c b/src/settings.c
index 9157203..87db029 100644
--- a/src/settings.c
+++ b/src/settings.c
@@ -2993,7 +2993,7 @@ void xset_parse( char* line )
}
}
-XSet* xset_set_cb( const char* name, void (*cb_func) (), gpointer cb_data )
+XSet* xset_set_cb_internal( const char* name, void (*cb_func) (GtkWidget*, gpointer), gpointer cb_data )
{
XSet* set = xset_get( name );
set->cb_func = cb_func;
@@ -3001,10 +3001,10 @@ XSet* xset_set_cb( const char* name, void (*cb_func) (), gpointer cb_data )
return set;
}
-XSet* xset_set_cb_panel( int panel, const char* name, void (*cb_func) (), gpointer cb_data )
+XSet* xset_set_cb_panel_internal( int panel, const char* name, void (*cb_func) (GtkWidget*, gpointer), gpointer cb_data )
{
char* fullname = g_strdup_printf( "panel%d_%s", panel, name );
- XSet* set = xset_set_cb( fullname, cb_func, cb_data );
+ XSet* set = xset_set_cb_internal( fullname, cb_func, cb_data );
g_free( fullname );
return set;
}
@@ -8593,7 +8593,7 @@ gboolean xset_menu_keypress( GtkWidget* widget, GdkEventKey* event,
void xset_menu_cb( GtkWidget* item, XSet* set )
{
GtkWidget* parent;
- void (*cb_func) () = NULL;
+ void (*cb_func) (GtkWidget*, gpointer) = NULL;
gpointer cb_data = NULL;
char* title;
XSet* mset; // mirror set or set
diff --git a/src/settings.h b/src/settings.h
index 4860f2c..6bc82d0 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -262,7 +262,7 @@ typedef struct
char* menu_label;
int menu_style; // not saved or read if locked
char* icon;
- void (*cb_func) (); // not saved
+ void (*cb_func) (GtkWidget*, gpointer); // not saved
gpointer cb_data; // not saved
char* ob1; // not saved
gpointer ob1_data; // not saved
@@ -416,7 +416,9 @@ XSet* xset_set_b_panel( int panel, const char* name, gboolean bval );
int xset_get_int( const char* name, const char* var );
int xset_get_int_panel( int panel, const char* name, const char* var );
XSet* xset_set_panel( int panel, const char* name, const char* var, const char* value );
-XSet* xset_set_cb_panel( int panel, const char* name, void (*cb_func) (), gpointer cb_data );
+XSet* xset_set_cb_panel_internal( int panel, const char* name, void (*cb_func) (GtkWidget*, gpointer), gpointer cb_data );
+#define xset_set_cb_panel(panel, name, cb_func, cb_data) \
+ xset_set_cb_panel_internal(panel, name, (void(*)(GtkWidget*, gpointer))(cb_func), cb_data)
gboolean xset_get_b_set( XSet* set );
XSet* xset_get_panel_mode( int panel, const char* name, char mode );
gboolean xset_get_b_panel_mode( int panel, const char* name, char mode );
@@ -451,7 +453,9 @@ GtkWidget* xset_add_menuitem( DesktopWindow* desktop, PtkFileBrowser* file_brows
GtkWidget* menu, GtkAccelGroup *accel_group,
XSet* set );
GtkWidget* xset_get_image( const char* icon, int icon_size );
-XSet* xset_set_cb( const char* name, void (*cb_func) (), gpointer cb_data );
+XSet* xset_set_cb_internal( const char* name, void (*cb_func) (GtkWidget*, gpointer), gpointer cb_data );
+#define xset_set_cb(name, cb_func, cb_data) \
+ xset_set_cb_internal(name, (void(*)(GtkWidget*, gpointer))(cb_func), cb_data)
XSet* xset_set_ob1_int( XSet* set, const char* ob1, int ob1_int );
XSet* xset_set_ob1( XSet* set, const char* ob1, gpointer ob1_data );
XSet* xset_set_ob2( XSet* set, const char* ob2, gpointer ob2_data );
|