Strange warning messages in Uint8Array to guint8* marshalling
In the following example, the first call succeeds, while the other two log a critical (g_output_stream_write: assertion 'buffer != NULL' failed
).
import Gio from 'gi://Gio';
// Works
Gio.MemoryOutputStream.new_resizable().write(new Uint8Array([0]), null)
// I can't think of a use-case, but should be valid?
Gio.MemoryOutputStream.new_resizable().write(new Uint8Array([]), null)
// Zero-length string, I think should equate to new Uint8Array([0])
Gio.MemoryOutputStream.new_resizable().write('', null)
It seems like if we explicitly pass a zero-length buffer in GJS, it should not translate to a null pointer in C.
The string conversion is maybe not so odd if you assume that the second call is already broken. It probably translates to a zero-length buffer, since JS strings are not zero-terminated.