On Fri, 2005-11-25 at 12:10 -0500, Englisch, Volker (NIH/NCI) wrote:
> > Okay, this should now be fixed.. Can you "svn update"
> > your goffice-update branch and re-try?
>
>
> I did that. Now I am getting the same error that I reported originally
> with the trunk:
>
> cc1: warnings being treated as errors
> gog-graph.c: In function 'gog_graph_ref_data':
> gog-graph.c:414: warning: cast from pointer to integer of different size
> gog-graph.c:429: warning: cast from pointer to integer of different size
> gog-graph.c:434: warning: cast from pointer to integer of different size
> gog-graph.c: In function 'gog_graph_unref_data':
> gog-graph.c:469: warning: cast from pointer to integer of different size
> gog-graph.c:480: warning: cast from pointer to integer of different size
> gog-graph.c:483: warning: cast from pointer to integer of different size
> make[6]: *** [gog-graph.lo] Error 1
> make[6]: Leaving directory
> `/home/venglisc/gnucash/g2-devel/goffice/lib/goffice-0.0.4/goffice/graph
> '
This is code that's just plain broken for 64bit systems. Its trying to
hang a value on to an object using a pointer as its key, but glib
requires all keys to be either a 32 bit integer or a string. The above
code later tries to read back this value using the same key, but again
the key is of the wrong type on a 64bit platform.
Josh, Derek, any ideas on how to easily convert a 64 bit pointer into a
unique 32 bit pointer or into a string? That latter can be done easily
by printing it as hex into a character buffer, but its not going to be
blindingly fast. It should work though. I've attached an untested
patch below that uses this method and should work on both 32bit and
64bit systems.
David
P.S. You should also update. I committed a couple of fixes for gcc4
errors.
Index: lib/goffice-0.0.4/goffice/graph/gog-graph.c
===================================================================
--- lib/goffice-0.0.4/goffice/graph/gog-graph.c (revision 12038)
+++ lib/goffice-0.0.4/goffice/graph/gog-graph.c (working copy)
@@ -402,6 +402,7 @@
GObject *g_obj;
gpointer res;
unsigned count;
+ gchar *key;
if (dat == NULL)
return NULL;
@@ -411,7 +412,8 @@
/* Does it already exist in the graph ? */
g_obj = G_OBJECT (graph);
- res = g_object_get_qdata (g_obj, (GQuark)dat);
+ key = g_strdup_printf("%p", dat);
+ res = g_object_get_data (g_obj, key);
if (res == NULL) {
/* is there something like it already */
@@ -426,13 +428,14 @@
g_object_ref (dat);
} else {
dat = existing->data;
- res = g_object_get_qdata (g_obj, (GQuark)dat);
+ res = g_object_get_data (g_obj, key);
}
}
count = GPOINTER_TO_UINT (res) + 1;
- g_object_set_qdata (g_obj, (GQuark)dat, GUINT_TO_POINTER (count));
+ g_object_set_data (g_obj, key, GUINT_TO_POINTER (count));
g_object_ref (dat);
+ g_free(key);
return dat;
}
@@ -448,6 +451,7 @@
GObject *g_obj;
gpointer res;
unsigned count;
+ gchar *key;
if (dat == NULL)
return;
@@ -466,7 +470,8 @@
return;
g_obj = G_OBJECT (graph);
- res = g_object_get_qdata (g_obj, (GQuark)dat);
+ key = g_strdup_printf("%p", dat);
+ res = g_object_get_data (g_obj, key);
g_return_if_fail (res != NULL);
@@ -477,10 +482,12 @@
gog_graph_signals [GRAPH_REMOVE_DATA], 0, dat);
graph->data = g_slist_remove (graph->data, dat);
g_object_unref (dat);
- g_object_set_qdata (g_obj, (GQuark)dat, NULL);
- } else
+ g_object_set_data (g_obj, key, NULL);
+ } else {
/* store the decremented count */
- g_object_set_qdata (g_obj, (GQuark)dat, GUINT_TO_POINTER (count));
+ g_object_set_data (g_obj, key, GUINT_TO_POINTER (count));
+ }
+ g_free(key);
}
static gboolean
_______________________________________________
gnucash-devel mailing list
[email protected]
https://lists.gnucash.org/mailman/listinfo/gnucash-devel