diff options
author | Giovanni Campagna <gcampagna@src.gnome.org> | 2011-06-05 20:57:01 +0200 |
---|---|---|
committer | Giovanni Campagna <gcampagna@src.gnome.org> | 2011-06-08 17:45:13 +0200 |
commit | aea1a55dff7f5cf7f3d87bbe515d94b66057b852 (patch) | |
tree | 62f4cd439fb25ae36a1def9709ea6e5642b62808 /girepository/gifieldinfo.c | |
parent | c8c23d2db2ec6594b5c43bd01cc78db396c709f3 (diff) | |
download | gobject-introspection-aea1a55dff7f5cf7f3d87bbe515d94b66057b852.tar.gz |
Fix accessing structure fields that are arrays
We need to distinguish inline arrays inside structures, and arrays
that are pointers and annotations, and we can do it with
g_type_info_is_pointer(), setting it to FALSE for fixed size arrays.
As a side effect, (array fixed-size=N) on a pointer type has no longer
the expected result.
https://bugzilla.gnome.org/show_bug.cgi?id=646635
Diffstat (limited to 'girepository/gifieldinfo.c')
-rw-r--r-- | girepository/gifieldinfo.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/girepository/gifieldinfo.c b/girepository/gifieldinfo.c index 106fc1ce..17491a80 100644 --- a/girepository/gifieldinfo.c +++ b/girepository/gifieldinfo.c @@ -193,14 +193,7 @@ g_field_info_get_field (GIFieldInfo *field_info, if (g_type_info_is_pointer (type_info)) { - if (g_type_info_get_array_type (type_info) == GI_ARRAY_TYPE_C && - g_type_info_get_array_fixed_size (type_info) >= 0) - { - /* Consider fixed-size arrays as embedded inside the struct */ - value->v_pointer = G_STRUCT_MEMBER_P ((mem), (offset)); - } - else - value->v_pointer = G_STRUCT_MEMBER (gpointer, mem, offset); + value->v_pointer = G_STRUCT_MEMBER (gpointer, mem, offset); result = TRUE; } else @@ -248,9 +241,14 @@ g_field_info_get_field (GIFieldInfo *field_info, value->v_double = G_STRUCT_MEMBER (gdouble, mem, offset); result = TRUE; break; + case GI_TYPE_TAG_ARRAY: + /* We don't check the array type and that it is fixed-size, + we trust g-ir-compiler to do the right thing */ + value->v_pointer = G_STRUCT_MEMBER_P (mem, offset); + result = TRUE; + break; case GI_TYPE_TAG_UTF8: case GI_TYPE_TAG_FILENAME: - case GI_TYPE_TAG_ARRAY: case GI_TYPE_TAG_GLIST: case GI_TYPE_TAG_GSLIST: case GI_TYPE_TAG_GHASH: |