[Vala] Problem with Pango bindings for parse_markup



Hi,
I've run into a few issues while using the Pango bindings.
I have the following test case:

/* pango-test.vala */
int main (string[] args) {
    string markup = "<b>Hello, World!</b>";

    Pango.AttrList attrs;
    string text;
    Pango.parse_markup (markup, -1, 0, out attrs, out text, null);

    stdout.printf ("%s\n", text);

    return 0;
}

When I try to compile this I get:

$ valac --pkg=pango pango-test.vala
pango-test.vala:8.58-8.61: error: Argument 6: Cannot convert from
`null' to `unichar'
Pango.parse_markup (markup, -1, 0, out attrs, out text, null);
                                                       ^^^^
Compilation failed: 1 error(s), 0 warning(s)


I believe that the binding of Pango.parse_markup in pango.vapi is
incorrect and I've filed a bug report:
https://bugzilla.gnome.org/show_bug.cgi?id=642293

The binding "pango.vapi" is:

[CCode (cheader_filename = "pango/pango.h")]
public static bool parse_markup (string markup_text, int length,
unichar accel_marker, out unowned Pango.AttrList attr_list, out
unowned string text, unichar accel_char) throws GLib.Error;

Based on the Pango API docs
(http://library.gnome.org/devel/pango/unstable/pango-Text-Attributes.html#pango-parse-markup)
I believe it should be:

[CCode (cheader_filename = "pango/pango.h")]
public static bool parse_markup (string markup_text, int length,
unichar accel_marker, out unowned Pango.AttrList attr_list, out
unowned string text, out unichar accel_char) throws GLib.Error;

After making this change my test case compiles but I still get a
warning about another parameter:

$ valac --pkg=pango pango-test.vala

pango-test.vala:8.2-8.62: warning: unhandled error `GLib.Error'
    Pango.parse_markup (markup, -1, 0, out attrs, out text, null);
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/home/graham/pango-test.vala.c: In function ‘_vala_main’:
/home/graham/pango-test.vala.c:39: warning: passing argument 5 of
‘pango_parse_markup’ from incompatible pointer type
/usr/include/pango-1.0/pango/pango-attributes.h:270: note: expected ‘char **’
but argument is of type ‘const gchar **’
Compilation succeeded - 1 warning(s)

Is this another error in the bindings or a bug in my test case?

- Graham



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