GNOME Bugzilla – Bug 639211
Invalid C generated when passing length output parameter in function DataInputStream.read_line_async
Last modified: 2011-04-02 14:33:45 UTC
When I pass a length output parameter to function read_line_async of class DataInputStream vala generates invalid C code. The output parameter is passed as a reference to a gsize-pointer type instead of a reference to a gsize type. I have attached a small demo file that reproduces the issue (it's based on the gio-read-async sample at http://live.gnome.org/Vala/GIOSamples#Asynchronous_Stream_Reading), the C code as generated by vala 0.11.3 and a diff file showing the C code changes necessary to fix the C code. The compiler output when running valac is: $ valac --pkg gio-2.0 gio-async-read.vala C:/msys/1.0/home/Tobias/ValaEval/gio-async-read.vala.c: In function 'read_something_async_co': C:/msys/1.0/home/Tobias/ValaEval/gio-async-read.vala.c:129:3: warning: passing argument 3 of 'g_data_input_stream_read_line_finish' from incompatible pointer type c:/mingw/include/glib-2.0/gio/gdatainputstream.h:111:24: note: expected 'gsize *' but argument is of type 'gsize **'
Created attachment 178029 [details] Vala code that reproduces the problem
Created attachment 178030 [details] C code generated from the demo by vala 0.11.3
Created attachment 178031 [details] Diff file showing changes to fix the generated C code
Issue still reproducible with Vala 0.11.7 on GNU/Linux.
commit 937b138112835ba91e7dce4bb5956d4cf793ea24 Author: Jürg Billeter <j@bitron.ch> Date: Wed Mar 23 22:40:18 2011 +0100 gio-2.0: Fix g_data_input_stream_read_line_finish binding Fixes bug 639211.
*** Bug 644679 has been marked as a duplicate of this bug. ***