ucs4 functions have wrong return transfer
Submitted by mod..@..ush.ai
Link to original bug (#729919)
Description
The following functions are documented to allocate their return value but are marked in GI as having "none" transfer on their return type:
g_ucs4_to_utf16 g_utf16_to_ucs4 g_utf8_to_ucs4 g_utf8_to_ucs4_fast g_utf8_to_utf16 g_unicode_canonical_decomposition
Also, the out arguments to g_unichar_decompose, g_unichar_fully_decompose, and g_unicode_canonical_decomposition are not known by GI to have 'out' direction.
These cause e.g. pygi to fail:
$ python3 Python 3.4.0 (default, Apr 27 2014, 23:33:09) [GCC 4.8.2 20140206 (prerelease)] on linux Type "help", "copyright", "credits" or "license" for more information.
import gi from gi.repository import GLib #pygi tries to interpret the pointer value of the ucs4 array as a unichar here: ... GLib.utf8_to_ucs4('foo', -1, 0, 0) Traceback (most recent call last): File "
<stdin>
", line 1, in<module>
TypeError: Invalid unicode codepoint 38962016 #here, it doesn't recognize the second-to-last argument as being 'out': ... GLib.unichar_fully_decompose('a', 0, 'b', 0) 1 GLib.unichar_fully_decompose('é', 0, 'b', 0) 2 #and it just crashes on this one, because the second arg is treated as a raw pointer value rather than the ffi allocating an int temporary and passing its address: ... GLib.unicode_canonical_decomposition('a', 0) zsh: segmentation fault python3
Version: 2.40.x