[librsvg/master.msvc: 1/5] rsvg-convert.rs: Fix building on Windows




commit ac0bfe2d9edd6ccc4f2d7956b8f4c42661d23dec
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Thu Jul 8 12:13:38 2021 +0800

    rsvg-convert.rs: Fix building on Windows
    
    Make sure we import the things we really need, and like what is
    happening on *nix, the Win32 HANDLES that we get for stdin/stdout
    need to be marked as unsafe before we can cast the resulting items.
    
    Also make sure we deal with OutPutStream with the corresponding
    Win32OutputStream.

 src/bin/rsvg-convert.rs | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/src/bin/rsvg-convert.rs b/src/bin/rsvg-convert.rs
index cd1a699e..589f583f 100644
--- a/src/bin/rsvg-convert.rs
+++ b/src/bin/rsvg-convert.rs
@@ -9,7 +9,7 @@ use gio::{UnixInputStream, UnixOutputStream};
 
 #[cfg(windows)]
 mod windows_imports {
-    pub use gio::ffi::{GInputStream, GOutputStream};
+    pub use gio::{Win32InputStream, Win32OutputStream};
     pub use glib::ffi::gboolean;
     pub use glib::translate::*;
     pub use libc::c_void;
@@ -357,7 +357,8 @@ impl Stdin {
 
     #[cfg(windows)]
     pub fn stream() -> InputStream {
-        Win32InputStream::with_handle(io::stdin()).upcast::<InputStream>()
+        let stream = unsafe { Win32InputStream::with_handle(io::stdin()) };
+        stream.upcast::<InputStream>()
     }
 }
 
@@ -372,7 +373,8 @@ impl Stdout {
 
     #[cfg(windows)]
     pub fn stream() -> OutputStream {
-        Win32InputStream::with_handle(io::stdout()).upcast::<OutputStream>()
+        let stream = unsafe { Win32OutputStream::with_handle(io::stdout()) };
+        stream.upcast::<OutputStream>()
     }
 }
 


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