Re: [Vala] How do I call functions which have a "ref" variable as one of their argument



Maybe you should use "out" instead of "ref"?

A semi ugly way to work around the first error (if "out" doesn't work
for some strange reason) is to just initialize the variable to
something before using it.


Not sure about the second issue, as far as I understand the
native function "dbus_error_init (DBusError *error)" is how
you could normally initialize a DBusError structure, right?
http://dbus.freedesktop.org/doc/api/html/group__DBusErrors.html
If so, then maybe it would be appropriate to rewrite the VAPI so
that this function is the constructor (I have no idea if this is
even possible to do though, I'm sure someone else can give a
much better answer to this question).



                Martin

Jaap A. Haitsma wrote:
Hi,

I've wanted to restart working on my vala branch of cheese. In the
meantime vala has received quite some changes. Therefore it does not
compile anymore. The main problem I have are "ref" variables. For
example with the text_extents method of Cairo

                TextExtents extents;
                text_extents ("hello", ref extents);

This does not compile because the compiler says.
"use of possibly unassigned local variable `extents' text_extents
("hello", ref extents);"

What should I do here or is it a bug in text_extents?

or also this code

                RawError dbus_error;
                
                dbus_error.init ();
                var hal = new Hal.Context ();

                if (hal == null)
                        throw new WebcamError.FAILED ("Error getting HAL context");

                if (!hal.set_dbus_connection (RawBus.get (BusType.SYSTEM, ref dbus_error)))
                        throw new WebcamError.FAILED ("Error setting dbus connection:
%s".printf (dbus_error.message));

complains about the fact that dbus_error is unassigned.

Any help will be highly appreciated

Thanks

Jaap
_______________________________________________
Vala-list mailing list
Vala-list gnome org
http://mail.gnome.org/mailman/listinfo/vala-list





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