Re: [Vala] Error in GLib.EnumClass binding (Re: Display values of an enum.)




Thanks for your answer.

Date: Sat, 10 Jul 2010 23:05:29 +0200
From: bulb ucw cz
To: pp_kl_h hotmail com
CC: vala-list gnome org
Subject: Error in GLib.EnumClass binding (Re: [Vala] Display values of an enum.)
    unowned EnumValue[] falues = 
enumClass.values;
    for (int i = 0; i < falues.length; i++) {

I believe vala supports foreach-style syntax here, but I am not certain
enough of the exact syntax to write it off the top of my head.

Well, I started out with that, it was something like:
    foreach(unowned EnumValue falue in falues) {...
But I wanted to make sure that I didn't do anything wrong with that.

$ valac EnumTest.vala 
/home/peterpaul/projects/vala/EnumTest.vala.c:
 In function ‘_vala_main’:
/home/peterpaul/projects/vala/EnumTest.vala.c:45:
 warning: assignment from incompatible pointer type
/home/peterpaul/projects/vala/EnumTest.vala.c:45:
 error: ‘GEnumClass’ has no member named ‘values_length1’
error: cc 
exited with status 256
Compilation failed: 1 error(s), 0 warning(s)

The warning can be safely ignored I believe (though it is a bug in valac --
it should know to emit correct cast). The error is caused by error in the
bindings.

The GLib.EnumClass.values member in gobject-2.0.vapi needs annotation:

    [CCode (array_length_cname = "n_values", array_length_type = "guint")]

(the same annotation is correctly used in other places in the file, e.g. the
ValueArray class).

The Glib.FlagsClass.values member needs the same annotation, too.

Ok, do I need to write a bug-report somewhere?

-- 
                                               Jan 'Bulb' Hudec <bulb ucw cz>
                                          
_________________________________________________________________
De Nieuwste Internet Explorer speciaal voor Hotmail, download nu gratis
http://www.microsoft.com/netherlands/ie8/hotmail.htm


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]