[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [patch] compile error fixes



On Sat, Jan 22, 2000 at 12:07:28AM +0000, Aaron Lehmann wrote:
> Hi,
> 
> Here is a fix for some compile errors. No warrenty on whether they work:
> 
> Index: drgeo_gtkmacro.cc
> ===================================================================
> RCS file: /cvs/gnome/dr-genius/drgeo/drgeo_gtkmacro.cc,v
> retrieving revision 1.5
> diff -u -r1.5 drgeo_gtkmacro.cc
> --- drgeo_gtkmacro.cc   2000/01/11 15:02:19     1.5
> +++ drgeo_gtkmacro.cc   2000/01/22 00:02:38
> @@ -490,7 +490,7 @@
> 
>    dialog = (drgeoGtkStyleDialog *)
>      gtk_object_get_data (GTK_OBJECT(widget), "drgeo_style");
> -  dialog->setColor ((drgeoColorType)data);
> +  dialog->setColor (*(drgeoColorType*)data);
>  }
>  static void
>  style_size_button_cb (GtkWidget * widget, gpointer data)
> @@ -499,7 +499,7 @@
> 
>    dialog = (drgeoGtkStyleDialog *)
>      gtk_object_get_data (GTK_OBJECT(widget), "drgeo_style");
> -  dialog->setSize ((drgeoLineType)data);
> +  dialog->setSize (*(drgeoLineType*)data);
>  }

That would result in a segfault!  You're casting a void pointer which doesn't
contain a pointer but an integer (not a pointer to an integer).

This should use GINT_TO_POINTER and GPOINTER_TO_INT which are macros for
storing integers inside pointers.

George