diff options
author | Chun-wei Fan <fanchunwei@src.gnome.org> | 2021-07-08 12:13:38 +0800 |
---|---|---|
committer | Chun-wei Fan <fanchunwei@src.gnome.org> | 2021-07-08 12:13:38 +0800 |
commit | 0370d84f425630f41de043c071ebea435025fbb3 (patch) | |
tree | 3a7564e7f08772996d3425ee63f9128be988e835 | |
parent | fc0dcc9d0d013a3919f981addf867b756983c8fe (diff) | |
download | librsvg-0370d84f425630f41de043c071ebea435025fbb3.tar.gz |
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.
Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/565>
-rw-r--r-- | src/bin/rsvg-convert.rs | 8 |
1 files 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>() } } |