mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 23:16:14 +01:00
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
This commit is contained in:
parent
f478da144f
commit
a0890f3d8f
45
girnode.c
45
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, "<");
|
||||
|
Loading…
Reference in New Issue
Block a user