[gjs/master.windows: 7/9] gjs-util.c: Fix building gjs_open_bytes() on Windows



commit 6072354529ee08d9bc1a1d2ad4611b51c5b4f495
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Fri Feb 22 15:38:20 2019 +0800

    gjs-util.c: Fix building gjs_open_bytes() on Windows
    
    Show a message that the function is currently only supported on UNIX,
    due to the use of g_unix_open_pipe().

 libgjs-private/gjs-util.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
---
diff --git a/libgjs-private/gjs-util.c b/libgjs-private/gjs-util.c
index ea691f56..33ff4b5a 100644
--- a/libgjs-private/gjs-util.c
+++ b/libgjs-private/gjs-util.c
@@ -27,7 +27,11 @@
 #include <string.h>
 
 #include <gio/gio.h>
-#include <glib-unix.h>
+
+#ifndef G_OS_WIN32
+# include <glib-unix.h>
+#endif
+
 #include <glib.h>
 #include <glib/gi18n.h>
 
@@ -164,6 +168,7 @@ int gjs_open_bytes(GBytes* bytes, GError** error) {
     g_return_val_if_fail(bytes, -1);
     g_return_val_if_fail(error == NULL || *error == NULL, -1);
 
+#ifdef G_OS_UNIX
     if (!g_unix_open_pipe(pipefd, FD_CLOEXEC, error))
         return -1;
 
@@ -186,4 +191,8 @@ int gjs_open_bytes(GBytes* bytes, GError** error) {
     }
 
     return pipefd[0];
+#else
+    g_warning ("%s is currently supported on UNIX only", __func__);
+    return -1;
+#endif
 }


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