[msitools] msiinfo: remove gio-unix dependency



commit c1fd3ca2b91b675c038816076f671e778907d9ce
Author: Paolo Bonzini <pbonzini redhat com>
Date:   Thu Jan 17 15:41:40 2013 +0100

    msiinfo: remove gio-unix dependency
    
    Everything builds now (wixl-heat is disabled), but msibuild
    seems to be still broken on Win32.
    
    Also, testdatabase and testsuminfo do not pass.

 configure.ac    |    1 +
 tools/msiinfo.c |   19 +++++++++++--------
 2 files changed, 12 insertions(+), 8 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 23ed150..f4c8f76 100644
--- a/configure.ac
+++ b/configure.ac
@@ -31,6 +31,7 @@ AC_PATH_PROG(VAPIGEN, vapigen, no)
 AC_SUBST(VAPIGEN)
 AM_CONDITIONAL([VAPI], [test "x$VAPIGEN" != xno])
 
+# used by wixl-heat
 AS_IF([test $win32 = no],
       [WIXL_UNIX="gio-unix-2.0"])
 
diff --git a/tools/msiinfo.c b/tools/msiinfo.c
index 55bf8ca..b68172b 100644
--- a/tools/msiinfo.c
+++ b/tools/msiinfo.c
@@ -372,11 +372,10 @@ static int cmd_extract(struct Command *cmd, int argc, char **argv, GError **erro
     LibmsiDatabase *db = NULL;
     LibmsiQuery *query = NULL;
     LibmsiRecord *rec = NULL;
-    GOutputStream *out = NULL;
     GInputStream *in = NULL;
     int r = 1;
-    char *buf;
-    unsigned size, bufsize;
+    char buffer[4096];
+    size_t n_read, n_written;
 
     if (argc != 3) {
         cmd_usage(stderr, cmd);
@@ -405,17 +404,21 @@ static int cmd_extract(struct Command *cmd, int argc, char **argv, GError **erro
     _setmode(STDOUT_FILENO, O_BINARY);
 #endif
 
-    out = g_unix_output_stream_new(STDOUT_FILENO, FALSE);
     in = G_INPUT_STREAM (libmsi_record_get_stream(rec, 1));
-    if (g_output_stream_splice(out, in, 0, NULL, error) == -1)
-        goto end;
+    for (;;) {
+        n_read = g_input_stream_read (in, buffer, sizeof (buffer), NULL, error);
+        if (n_read == -1)
+            goto end;
+        if (n_read == 0)
+            break;
+
+	full_write (STDOUT_FILENO, buffer, n_read);
+    }
 
     if (!*error)
         r = 0;
 
 end:
-    if (out)
-        g_object_unref(out);
     if (in)
         g_object_unref(in);
     if (rec)



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