[librsvg/rustify-rsvg-convert] rsvg-convert: explicitely use as_raw_fd



commit 5725a72346f974c15b652a4d1afc9477b74764bf
Author: Paolo Borelli <pborelli gnome org>
Date:   Sat Jan 9 20:54:23 2021 +0100

    rsvg-convert: explicitely use as_raw_fd
    
    The AsRawFd trait is implemented for integers only in rust 1.48

 src/bin/rsvg-convert/main.rs | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/src/bin/rsvg-convert/main.rs b/src/bin/rsvg-convert/main.rs
index 91e9b18a..859753ea 100644
--- a/src/bin/rsvg-convert/main.rs
+++ b/src/bin/rsvg-convert/main.rs
@@ -9,6 +9,7 @@ use gio::{
 use librsvg::rsvg_convert_only::LegacySize;
 use librsvg::{CairoRenderer, Color, Loader, Parse, RenderingError};
 use std::ops::Deref;
+use std::os::unix::io::AsRawFd;
 use std::path::PathBuf;
 
 #[derive(Clone, Copy, Debug)]
@@ -614,7 +615,7 @@ fn main() {
     for input in &args.input {
         let (stream, basefile) = match input {
             Input::Stdin => {
-                let stream = unsafe { UnixInputStream::new(0) };
+                let stream = unsafe { UnixInputStream::new(std::io::stdin().as_raw_fd()) };
                 (stream.upcast::<InputStream>(), None)
             }
             Input::Path(p) => {
@@ -675,7 +676,8 @@ fn main() {
 
                 let output_stream = match args.output {
                     Output::Stdout => {
-                        let stream = unsafe { UnixOutputStream::new(1) };
+                        let stream =
+                            unsafe { UnixOutputStream::new(std::io::stdout().as_raw_fd()) };
                         stream.upcast::<OutputStream>()
                     }
                     Output::Path(ref p) => {


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