[librsvg: 11/30] rsvg-convert: use the new win32 io streams APIs




commit 4e0fb678a957e53465a9346c3c2883506d2c8674
Author: Bilal Elmoussaoui <bil elmoussaoui gmail com>
Date:   Thu Jun 10 20:39:50 2021 +0200

    rsvg-convert: use the new win32 io streams APIs
    
    Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/516>

 src/bin/rsvg-convert.rs | 30 ++----------------------------
 1 file changed, 2 insertions(+), 28 deletions(-)
---
diff --git a/src/bin/rsvg-convert.rs b/src/bin/rsvg-convert.rs
index 00f95471..6b5d2947 100644
--- a/src/bin/rsvg-convert.rs
+++ b/src/bin/rsvg-convert.rs
@@ -357,20 +357,7 @@ impl Stdin {
 
     #[cfg(windows)]
     pub fn stream() -> InputStream {
-        // https://github.com/gtk-rs/gtk-rs/issues/381 - do this with
-        // Win32InputStream::with_handle when this is fixed
-
-        extern "C" {
-            pub fn g_win32_input_stream_new(
-                handle: *mut c_void,
-                close_handle: gboolean,
-            ) -> *mut GInputStream;
-        }
-
-        let raw_handle = io::stdin().as_raw_handle();
-        unsafe {
-            InputStream::from_glib_full(g_win32_input_stream_new(raw_handle, false.into_glib()))
-        }
+        Win32InputStream::with_handle(io::stdin()).upcast::<InputStream>()
     }
 }
 
@@ -385,20 +372,7 @@ impl Stdout {
 
     #[cfg(windows)]
     pub fn stream() -> OutputStream {
-        // https://github.com/gtk-rs/gtk-rs/issues/381 - do this with
-        // Win32OutputStream::with_handle when this is fixed
-
-        extern "C" {
-            pub fn g_win32_output_stream_new(
-                handle: *mut c_void,
-                close_handle: gboolean,
-            ) -> *mut GOutputStream;
-        }
-
-        let raw_handle = io::stdout().as_raw_handle();
-        unsafe {
-            OutputStream::from_glib_full(g_win32_output_stream_new(raw_handle, false.into_glib()))
-        }
+        Win32InputStream::with_handle(io::stdout()).upcast::<OutputStream>()
     }
 }
 


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