[gobject-introspection] GIrNode: fix lookup of cached type nodes
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection] GIrNode: fix lookup of cached type nodes
- Date: Mon, 21 Feb 2011 16:29:23 +0000 (UTC)
commit e16444d4a07613a6ab07e7827ef970fb072830e5
Author: Giovanni Campagna <gcampagna src gnome org>
Date: Fri Feb 18 18:14:25 2011 +0100
GIrNode: fix lookup of cached type nodes
Different types of array have different type nodes, so they should
produce different keys in the cache of already seen type nodes, to
avoid turning a GByteArray into a reference to a GPtrArray.
https://bugzilla.gnome.org/show_bug.cgi?id=642300
girepository/girnode.c | 45 ++++++++++++++++++++++++++++++++++-----------
1 files changed, 34 insertions(+), 11 deletions(-)
---
diff --git a/girepository/girnode.c b/girepository/girnode.c
index fe45503..fe10e54 100644
--- a/girepository/girnode.c
+++ b/girepository/girnode.c
@@ -1227,19 +1227,42 @@ serialize_type (GIrTypelibBuild *build,
}
else if (node->tag == GI_TYPE_TAG_ARRAY)
{
- serialize_type (build, node->parameter_type1, str);
- g_string_append (str, "[");
+ if (node->array_type == GI_ARRAY_TYPE_C)
+ {
+ serialize_type (build, node->parameter_type1, str);
+ g_string_append (str, "[");
- if (node->has_length)
- g_string_append_printf (str, "length=%d", node->length);
- else if (node->has_size)
- g_string_append_printf (str, "fixed-size=%d", node->size);
+ if (node->has_length)
+ g_string_append_printf (str, "length=%d", node->length);
+ else if (node->has_size)
+ g_string_append_printf (str, "fixed-size=%d", node->size);
- if (node->zero_terminated)
- g_string_append_printf (str, "%szero-terminated=1",
- node->has_length ? "," : "");
+ if (node->zero_terminated)
+ g_string_append_printf (str, "%szero-terminated=1",
+ node->has_length ? "," : "");
- g_string_append (str, "]");
+ g_string_append (str, "]");
+ }
+ else if (node->array_type == GI_ARRAY_TYPE_BYTE_ARRAY)
+ {
+ /* We on purpose skip serializing parameter_type1, which should
+ always be void*
+ */
+ g_string_append (str, "GByteArray");
+ }
+ else
+ {
+ if (node->array_type == GI_ARRAY_TYPE_ARRAY)
+ g_string_append (str, "GArray");
+ else
+ g_string_append (str, "GPtrArray");
+ if (node->parameter_type1)
+ {
+ g_string_append (str, "<");
+ serialize_type (build, node->parameter_type1, str);
+ g_string_append (str, ">");
+ }
+ }
}
else if (node->tag == GI_TYPE_TAG_INTERFACE)
{
@@ -1284,7 +1307,7 @@ serialize_type (GIrTypelibBuild *build,
}
else if (node->tag == GI_TYPE_TAG_GHASH)
{
- g_string_append (str, "GHashTable<");
+ g_string_append (str, "GHashTable");
if (node->parameter_type1)
{
g_string_append (str, "<");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]