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 754263 - GdaBinary.data is wrongly introspected
GdaBinary.data is wrongly introspected
Status: RESOLVED FIXED
Product: libgda
Classification: Other
Component: Vala bindings
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Daniel Espinosa
gnome-db Maintainers
Depends on:
Blocks: 754725
 
 
Reported: 2015-08-28 23:35 UTC by Corentin Noël
Modified: 2016-04-21 15:29 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Corentin Noël 2015-08-28 23:35:17 UTC
GdaBinary.data should be marked as a guint8 array
Comment 1 malerba 2015-09-02 15:00:29 UTC
I'm not very fluent on the annotations, could you provide a patch?
Thanks!
Comment 2 Corentin Noël 2015-09-03 14:25:39 UTC
in libgda/gda-value.h, line 136

change this:

/**
 * GdaBinary:
 * @data:
 * @binary_length:
 */

into this:

/**
 * GdaBinary:
 * @data: (array):
 * @binary_length:
 */
Comment 3 malerba 2015-09-03 18:37:52 UTC
Thanks,
This is now committed: https://git.gnome.org/browse/libgda/commit/?id=6a22ca5e476f8dccd315aec2455574a7ded6810a
Comment 4 Daniel Espinosa 2015-09-08 03:22:17 UTC
I can't see the array length set on VAPI nor on GIR.

I've added a (array length=binary_length), but VAPI doesn't set correct value for array length, it should hide binary_length on biding, as for:

[CCode (cheader_filename = "libgda/libgda.h", copy_function = "g_boxed_copy", free_function = "g_boxed_free", type_id = "gda_binary_get_type ()")]
	[Compact]
	public class Binary {
		[CCode (array_length_name = binary_length)]
		public weak uint8[] data;
		public static void* copy (void* boxed);
		public static void free (owned void* boxed);
		public string to_string (uint maxlen);
	}

from:

https://wiki.gnome.org/Projects/Vala/LegacyBindings#Array_Lengths

and 

https://wiki.gnome.org/Projects/GObjectIntrospection/Annotations#GObject-Introspection_annotations

Then in order to get correctly set array length, may custome code to Gda-6.0.metadata should be added or try to fix (witch is better) on GI annotations.

I'm checking it.
Comment 5 Daniel Espinosa 2015-09-08 13:47:30 UTC
For better GdaBinary introspection, we should:

a) Hide GdaBinary members to users
b) Add API to modify, create and release structure resources
c) consider to use glib API like GBytes

Comments?
Comment 6 Gergely POLONKAI 2015-09-19 13:11:49 UTC
I’d go with GBytes, as it works pretty well already in GLib. Why re-invent the wheel?
Comment 7 Daniel Espinosa 2016-04-21 15:29:46 UTC
I've prepared a huge commit to seal GdaBinary and GdaBlob, making them introspectable friendly. It is already in master.

Closing this bug. Feel free to reopen if you found it is not fixed.