[gnome-boxes] Add workaround for broken IOError.from_errno binding



commit 78ca89947e72bd9559a44e5d81254f97f7b81308
Author: Christophe Fergeau <cfergeau redhat com>
Date:   Fri May 25 14:17:20 2012 +0200

    Add workaround for broken IOError.from_errno binding
    
    g_io_error_from_errno returns a GIOErrorEnum, and vala doesn't know
    it should convert it to a GIOError *, which causes compilation issues
    with:
    
    // valac-0.16 --pkg gio-2.0 foo.vala
    // /home/teuf/jhbuild-boxes/sources/gnome-boxes/foo.vala.c: In function âtestâ:
    // /home/teuf/jhbuild-boxes/sources/gnome-boxes/foo.vala.c:26:9: erreur:
    // incompatible types when assigning to type âstruct GError *â from type âGIOErrorEnumâ
    // error: cc exited with status 26
    // Compilation failed: 1 error(s), 0 warning(s)
    
    void test () throws GLib.Error {
        throw GLib.IOError.from_errno(22); // EINVAL
    }
    
    int main () {
        try {
            test ();
        } catch (GLib.Error e) {}
    
        return 0;
    }
    
    This is vala bug 664530. This workaround was suggested by vala
    maintainers as the bug isn't trivial to fix.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=679752

 src/Makefile.am              |    1 +
 vapi/gio-2.0-workaround.vapi |    6 ++++++
 2 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 006171a..c702f99 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -24,6 +24,7 @@ AM_VALAFLAGS =						\
 	--pkg common					\
 	--pkg gd-1.0					\
 	--pkg gdk-pixbuf-2.0				\
+	--pkg gio-2.0-workaround			\
 	--pkg glib-2.0					\
 	--pkg gtk-vnc-2.0				\
 	--pkg gudev-1.0					\
diff --git a/vapi/gio-2.0-workaround.vapi b/vapi/gio-2.0-workaround.vapi
new file mode 100644
index 0000000..6f48643
--- /dev/null
+++ b/vapi/gio-2.0-workaround.vapi
@@ -0,0 +1,6 @@
+// Workaround non-working GLib.g_io_error_from_errno
+[CCode (cheader_filename = "gio/gio.h")]
+public const int G_IO_ERROR;
+
+[CCode (cheader_filename = "gio/gio.h")]
+public int g_io_error_from_errno (int err_no);



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