Broken "array length=..." handling
Submitted by Morten Welinder
Link to original bug (#694627)
Description
I want to add introspection hints for this function
guint8 const * gsf_input_read (GsfInput *input, size_t num_bytes, guint8 *optional_buffer)
FYI, optional_buffer should either be NULL or a buffer of length num_bytes. I would be happy if there was a way to simply make bindings always use NULL. The return value is either the optional_buffer, or -- in case of NULL, an internal buffer of length num_bytes.
Note, that num_bytes is of an integral type. There is absolute no way any information can be returned through that. In other words, it's an "in" node.
Here's what should work:
-
gsf_input_read:
-
@input: the input stream
-
@num_bytes (in): number of bytes to read
-
@optional_buffer: (array length=num_bytes) (allow-none) (transfer none)
-
Returns: (transfer none) (array length=num_bytes) pointer to the...
This doesn't work: first num_bytes' direction gets overwritten by @optional_buffer's. Then it gets overwritten by the result's direction and ends up as an "out" node. That makes no sense!