On Sun, 7 Dec 2003, MenTaLguY wrote:
Has anyone else had difficulty building button.c since I made this change?
I'm getting these build errors:
if ccache g++ -DHAVE_CONFIG_H -I. -I/home/bryce/src/Inkscape/inkscape/src/widgets -I../.. -I.. -I/home/bryce/src/Inkscape/inkscape/src -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/pango-1.0 -I/usr/X11R6/include -I/usr/include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/libart-2.0 -I/usr/include/libxml2 -DINKSCAPE_PIXMAPDIR=""/usr/local/share/inkscape"" -O0 -Wall -MT button.o -MD -MP -MF ".deps/button.Tpo" \ -c -o button.o `test -f '/home/bryce/src/Inkscape/inkscape/src/widgets/button.c' || echo '/home/bryce/src/Inkscape/inkscape/src/widgets/'`/home/bryce/src/Inkscape/inkscape/src/widgets/button.c; \ then mv ".deps/button.Tpo" ".deps/button.Po"; \ else rm -f ".deps/button.Tpo"; exit 1; \ fi /home/bryce/src/Inkscape/inkscape/src/widgets/button.c: In function `void sp_button_toggle_set_down(SPButton*, int)': /home/bryce/src/Inkscape/inkscape/src/widgets/button.c:189: invalid conversion from `void (*)()' to `void*' /home/bryce/src/Inkscape/inkscape/src/widgets/button.c:191: invalid conversion from `void (*)()' to `void*' /home/bryce/src/Inkscape/inkscape/src/widgets/button.c: In function `void sp_button_action_set_active(SPAction*, unsigned int, void*)': /home/bryce/src/Inkscape/inkscape/src/widgets/button.c:233: warning: comparison between signed and unsigned integer expressions make[3]: *** [button.o] Error 1
Bryce
-----Forwarded Message----- From: MenTaLguY <mental@...3...> To: bulia byak <archiver_1@...19...> Subject: Re: button.c Date: Sun, 07 Dec 2003 19:07:50 -0500
On Sun, 2003-12-07 at 02:32, bulia byak wrote:
Mental, your latest button.c only compiles if I change
g_signal_handlers_block_by_func (G_OBJECT (button), G_CALLBACK (sp_button_perform_action), NULL); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), down); g_signal_handlers_unblock_by_func (G_OBJECT (button), G_CALLBACK (sp_button_perform_action), NULL);
by
g_signal_handlers_block_by_func (G_OBJECT (button), (void*) G_CALLBACK (sp_button_perform_action), NULL); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), down); g_signal_handlers_unblock_by_func (G_OBJECT (button), (void*) G_CALLBACK (sp_button_perform_action), NULL);
Is that the right fix?
No.
Casting a function pointer to a normal pointer isn't safe or portable -- you can get away with it on x86, but on many architectures (like e.g. Itanium), a function pointer is really a much larger "function descriptor" datatype.
Actually, this should compile as-is (it did compile for me), so it's something funky with one of our build configurations (not sure whose yet).
I'm using gcc 3.3.2 with CFLAGS="-g -Wall", and building with glib 2.2.3.
What compiler, compiler options, and version of GLib are you using, and what error(s) do you get when you try to compile?
-mental