GNOME Bugzilla – Bug 705987
Gst.Base.Adapter.take() and map() are thought to have an out gsize parameter
Last modified: 2017-03-08 09:41:47 UTC
Created attachment 251609 [details] Example file triggering a bug Using Gstreamer 1.0 with Vala, valac thinks that Gst.Adapter.take() and Gst.Adapter.map() have an out gsize parameter and produces invalid code. In C, these functions have a signature of gpointer name(GstAdapter* adapter, gsize nbytes). Valac assumes the nbytes parameter to be an out parameter containing length of returned array. Generated C code looks like this: gsize size; GstAdapter* adapter = NULL; adapter = gst_adapter_new(); guint8* arr = NULL; arr = gst_adapter_take(adapter, &size); Upon compilation of provided example.vala file, a warning example.vala.c:67:2: warning: passing argument 2 of ‘gst_adapter_take’ makes integer from pointer without a cast [enabled by default] _tmp5_ = gst_adapter_take (adapter, &_tmp4_); ^ In file included from example.vala.c:10:0: /usr/include/gstreamer-1.0/gst/base/gstadapter.h:60:25: note: expected ‘gsize’ but argument is of type ‘gsize *’ gpointer gst_adapter_take (GstAdapter *adapter, gsize nbytes); is generated. I asked about this issue on #vala IRC channel and confirmed that these functions (take and map) should take one parameter in Vala.
commit b3e02e1ecd76cf0443287ac6ef99d18be188e840 Author: Rico Tzschichholz <ricotz@ubuntu.com> Date: Wed Mar 8 09:50:02 2017 +0100 gstreamer-1.0: Fix Gst.Base.Adapter.map/take bindings There is no explicit array-length returned while it is implicitly related to the in-parameter those methods are taking.