summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiovanni Campagna <gcampagna@src.gnome.org>2011-02-18 18:14:25 +0100
committerColin Walters <walters@verbum.org>2011-02-21 11:32:46 -0500
commite16444d4a07613a6ab07e7827ef970fb072830e5 (patch)
tree097b47eec98eb2e532caa0ba77c37d9a2eab0bc9
parentba7b286b5a3280308f447628c12a26e6079f0110 (diff)
downloadgobject-introspection-e16444d4a07613a6ab07e7827ef970fb072830e5.tar.gz
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
-rw-r--r--girepository/girnode.c45
1 files changed, 34 insertions, 11 deletions
diff --git a/girepository/girnode.c b/girepository/girnode.c
index fe45503d..fe10e543 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, "<");