Re: [PATCH] ANSI C correctness + warning fixes



otaylor fresnel labs redhat com writes:

> ===========
> +  { GDK_ACTION_ASK,   (const char *) action_ask_bits,  (const char *) action_ask_mask_bits,  NULL },
> +  { GDK_ACTION_COPY,  (const char *) action_copy_bits, (const char *) action_copy_mask_bits, NULL },
> +  { GDK_ACTION_MOVE,  (const char *) action_move_bits, (const char *) action_move_mask_bits, NULL },
> +  { GDK_ACTION_LINK,  (const char *) action_link_bits, (const char *) action_link_mask_bits, NULL },
> +  { 0              ,  (const char *) action_none_bits, (const char *) action_none_mask_bits, NULL },
> ============
> 
> Please change the type of these pointers to guchar * and move the
> casts to when gdk_bitmap_create_from_data() is called. (Since I'd
> consider the prototype of that function the problem.)

Hmm, what about changing the prototype of that function to take const guchar *
arguments ?

> ===========
> -  klass->add_accelerator = (void*) gtk_accel_group_handle_add;
> -  klass->remove_accelerator = (void*) gtk_accel_group_handle_remove;
> +  klass->add_accelerator = gtk_widget_real_add_accelerator;
> +  klass->remove_accelerator = gtk_widget_real_remove_accelerator;
>    klass->grab_focus = gtk_widget_real_grab_focus;
>    klass->event = NULL;
>    klass->button_press_event = NULL;
> @@ -4907,4 +4918,30 @@ gtk_widget_class_path (GtkWidget *widget
>        *path_p = g_strdup (rev_path);
>        g_strreverse (*path_p);
>      }
> +}
> +
> +static gint
> +gtk_widget_real_add_accelerator (GtkWidget *widget, guint accel_signal_id,
> +				 GtkAccelGroup *accel_group, guint accel_key,
> +				 GdkModifierType accel_mods, GtkAccelFlags accel_flags)
> ===========
> 
> I'll let Tim comment on this one, but the thing is,
> gtk_accel_group_handle_add() was meant to be used as the default
> handler for remove_accelerator, so having to do a workaround like this
> really cannot be the right way to do things.

Btw. I did this because gtk_accel_group_handle_add/remove() take GtkObject's
but klass->add/remote_accelerator expects the first argument to be a
GtkWidget, so we either need to cast the functions or introduce this static
helper function.

-- 
Martin Baulig
martin gnome org (private)
baulig suse de (work)




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