gtktreedatalist.c, another one
- From: Daniel Elstner <daniel elstner gmx net>
- To: gtk-devel-list <gtk-devel-list gnome org>
- Subject: gtktreedatalist.c, another one
- Date: 28 May 2002 11:42:22 +0200
Hi,
in my latest patch, I overlooked another wrong GValue access:
gtk_tree_data_list_compare_func() tries to read G_TYPE_BOOLEAN with
g_value_get_int() -- ouch.
The attached patch also removes a bunch of unnecessary and
typo-provoking casts. OK to commit?
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gtk+/ChangeLog,v
retrieving revision 1.3338.2.71
diff -u -3 -p -r1.3338.2.71 ChangeLog
--- ChangeLog 27 May 2002 22:33:14 -0000 1.3338.2.71
+++ ChangeLog 28 May 2002 09:33:09 -0000
@@ -1,3 +1,11 @@
+2002-05-28 Daniel Elstner <daniel elstner gmx net>
+
+ * gtk/gtktreedatalist.c (_gtk_tree_data_list_node_to_value):
+ Avoid unnecessary and typo-provoking casts.
+ (_gtk_tree_data_list_node_to_value): ditto
+ (gtk_tree_data_list_compare_func): Use g_value_get_boolean()
+ to read G_TYPE_BOOLEAN -- g_value_get_int() does not work.
+
2002-05-27 Daniel Elstner <daniel elstner gmx net>
Fixes for #83190
Index: gtk/gtktreedatalist.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtktreedatalist.c,v
retrieving revision 1.25.2.1
diff -u -3 -p -r1.25.2.1 gtktreedatalist.c
--- gtk/gtktreedatalist.c 27 May 2002 22:33:17 -0000 1.25.2.1
+++ gtk/gtktreedatalist.c 28 May 2002 09:33:12 -0000
@@ -119,19 +119,19 @@ _gtk_tree_data_list_node_to_value (GtkTr
switch (G_TYPE_FUNDAMENTAL (type))
{
case G_TYPE_BOOLEAN:
- g_value_set_boolean (value, (gboolean) list->data.v_int);
+ g_value_set_boolean (value, list->data.v_int);
break;
case G_TYPE_CHAR:
- g_value_set_char (value, (gchar) list->data.v_char);
+ g_value_set_char (value, list->data.v_char);
break;
case G_TYPE_UCHAR:
- g_value_set_uchar (value, (guchar) list->data.v_uchar);
+ g_value_set_uchar (value, list->data.v_uchar);
break;
case G_TYPE_INT:
- g_value_set_int (value, (gint) list->data.v_int);
+ g_value_set_int (value, list->data.v_int);
break;
case G_TYPE_UINT:
- g_value_set_uint (value, (guint) list->data.v_uint);
+ g_value_set_uint (value, list->data.v_uint);
break;
case G_TYPE_LONG:
g_value_set_long (value, list->data.v_long);
@@ -152,25 +152,25 @@ _gtk_tree_data_list_node_to_value (GtkTr
g_value_set_flags (value, list->data.v_uint);
break;
case G_TYPE_FLOAT:
- g_value_set_float (value, (gfloat) list->data.v_float);
+ g_value_set_float (value, list->data.v_float);
break;
case G_TYPE_DOUBLE:
- g_value_set_double (value, (gdouble) list->data.v_double);
+ g_value_set_double (value, list->data.v_double);
break;
case G_TYPE_STRING:
g_value_set_string (value, (gchar *) list->data.v_pointer);
break;
case G_TYPE_POINTER:
- g_value_set_pointer (value, (gpointer) list->data.v_pointer);
+ g_value_set_pointer (value, list->data.v_pointer);
break;
case G_TYPE_BOXED:
- g_value_set_boxed (value, (gpointer) list->data.v_pointer);
+ g_value_set_boxed (value, list->data.v_pointer);
break;
case G_TYPE_OBJECT:
g_value_set_object (value, (GObject *) list->data.v_pointer);
break;
default:
- g_warning ("%s: Unsupported type (%s) retrieved.", G_STRLOC, g_type_name (value->g_type));
+ g_warning ("%s: Unsupported type (%s) retrieved.", G_STRLOC, g_type_name (G_VALUE_TYPE (value)));
break;
}
}
@@ -314,9 +314,9 @@ gtk_tree_data_list_compare_func (GtkTree
switch (G_TYPE_FUNDAMENTAL (type))
{
case G_TYPE_BOOLEAN:
- if (g_value_get_int (&a_value) < g_value_get_int (&b_value))
+ if (g_value_get_boolean (&a_value) < g_value_get_boolean (&b_value))
retval = -1;
- else if (g_value_get_int (&a_value) == g_value_get_int (&b_value))
+ else if (g_value_get_boolean (&a_value) == g_value_get_boolean (&b_value))
retval = 0;
else
retval = 1;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]