After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 639211 - Invalid C generated when passing length output parameter in function DataInputStream.read_line_async
Invalid C generated when passing length output parameter in function DataInpu...
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Async
0.11.x
Other All
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
: 644679 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2011-01-11 13:30 UTC by Tobias Rapp
Modified: 2011-04-02 14:33 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Vala code that reproduces the problem (930 bytes, text/plain)
2011-01-11 13:32 UTC, Tobias Rapp
Details
C code generated from the demo by vala 0.11.3 (6.47 KB, text/plain)
2011-01-11 13:33 UTC, Tobias Rapp
Details
Diff file showing changes to fix the generated C code (639 bytes, text/plain)
2011-01-11 13:34 UTC, Tobias Rapp
Details

Description Tobias Rapp 2011-01-11 13:30:33 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 **'
Comment 1 Tobias Rapp 2011-01-11 13:32:03 UTC
Created attachment 178029 [details]
Vala code that reproduces the problem
Comment 2 Tobias Rapp 2011-01-11 13:33:17 UTC
Created attachment 178030 [details]
C code generated from the demo by vala 0.11.3
Comment 3 Tobias Rapp 2011-01-11 13:34:46 UTC
Created attachment 178031 [details]
Diff file showing changes to fix the generated C code
Comment 4 Tobias Rapp 2011-03-22 22:08:51 UTC
Issue still reproducible with Vala 0.11.7 on GNU/Linux.
Comment 5 Jürg Billeter 2011-03-23 21:42:11 UTC
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.
Comment 6 Jürg Billeter 2011-04-02 14:33:45 UTC
*** Bug 644679 has been marked as a duplicate of this bug. ***