GNOME Bugzilla – Bug 559425
Length of arrays arguments treated inconsistently wrt. implicit "self" parameter
Last modified: 2015-02-07 16:54:53 UTC
When you have multiple array arguments that refer to a single length argument, the index of the generated length ends up wrong, for example: void annotation_object_compute_msq_n(AnnotationObject *object, int n_nums, double *nums1, double *nums2); In this case, "nums1" and "nums2" get a length index of one, instead of zero (as the "object" parameter is implicit).
I just noticed that this affects all array arguments with length annotations, i.e. the "self" parameter taken into account for the length, but it is implicit in the GIR/typelib. Is this in fact intended behaviour? If so, this bug can be closed.
Well, you could alternatively think of it as being 1-based. But I don't have a strong opinion either way; if we keep it this way we should document it, if we change it we should document it and go through the bindings to fix them.
Well, if it's one-based, then it's only one-based for methods, e.g. from the g-ir-generate output for the GTK+ typelib: <function name="init" c:identifier="gtk_init"> <return-value transfer-ownership="none"> <type name="none"/> </return-value> <parameters> <parameter name="argc" transfer-ownership="full" direction="inout"> <type name="int"/> </parameter> <parameter name="argv" transfer-ownership="none" direction="inout"> <array length="0" zero-terminated="1"> <type name="utf8"/> </array> </parameter> </parameters> </function> I think that's a little bit inconsistent.
Array lengths should be consistent now.
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]