Re: warning in g_value_register_transform_func



Hi,

Owen Taylor <otaylor redhat com> writes:

> I think this is just a bug and the check here is meant to be for an exact
> match on the two types. (The inner check in the loop in transform_func_lookup() -
> the check for value table equality isn't needed in this context, but won't
> hurt.)
> 
> Why don't you go ahead and make up a patch to fix this problem.

OK, so how does this one look like? Seems to work well for GimpConfig
serialization (try CVS module "gimp" binary "app/config/test-config").

Index: gobject/gvalue.c
===================================================================
RCS file: /cvs/gnome/glib/gobject/gvalue.c,v
retrieving revision 1.10
diff -u -p -r1.10 gvalue.c
--- gobject/gvalue.c	2001/03/18 04:44:37	1.10
+++ gobject/gvalue.c	2001/12/10 22:05:35
@@ -274,14 +274,17 @@ g_value_register_transform_func (GType  
   g_return_if_fail (G_TYPE_HAS_VALUE_TABLE (dest_type));
   g_return_if_fail (transform_func != NULL);
 
-  if (transform_func_lookup (src_type, dest_type))
+  entry.src_type = src_type;
+  entry.dest_type = dest_type;
+  
+  if (g_bsearch_array_lookup (&transform_array, &entry))
     g_warning ("reregistering value transformation function (%p) for `%s' to `%s'",
 	       transform_func,
 	       g_type_name (src_type),
 	       g_type_name (dest_type));
-  entry.src_type = src_type;
-  entry.dest_type = dest_type;
+
   entry.func = transform_func;
+
   g_bsearch_array_insert (&transform_array, &entry, TRUE);
 }
 

OK to commit?


Salut, Sven



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