Re: Compiler warnings "set_label" incompatible pointer




On Tue, 2007-10-23 at 13:59 +0200, Daniel Dieterle wrote:

An the warnings:

handlers.c: In function 'on_button_run_clicked':
handlers.c:133: warning: passing argument 1 of 'gtk_button_set_label'
from incompatible pointer type
handlers.c:137: warning: passing argument 2 of 'gtk_timeout_add' from
incompatible pointer type

I can't imaging why the compiler complains himself?

you are casting a lot of stuff that do not require casting, but you are
not casting the things that do require it.

void on_button_run_clicked( GtkWidget * widget, GtkEntry *entry,
gpointer user_data )
{     
      /* Run changes to Pause */
      gtk_button_set_label (widget, ( const gchar *) "Pause");

this should be:

  gtk_button_set_label (GTK_BUTTON (widget), "Pause");

      /* calles every 100 ms function draw_satellite */
      satellite_is_running = gtk_timeout_add( 100, draw_satellite, (gpointer)
NULL );

and this should be:

  if (!satellite_is_running)
    satellite_is_running = g_timeout_add (100, (GSourceFunc) draw_satellite, NULL);

or you can drop the cast to GSourceFunc by declaring draw_satellite as:

  gboolean draw_satellite (gpointer data);

ciao,
 Emmanuele.

-- 
Emmanuele Bassi,
W: http://www.emmanuelebassi.net
B: http://log.emmanuelebassi.net




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