[librsvg: 1/2] Declare externs for g_win32_*_stream_new() manually
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 1/2] Declare externs for g_win32_*_stream_new() manually
- Date: Wed, 31 Mar 2021 16:59:40 +0000 (UTC)
commit f786636c80cc3cb254c670ecc9c97be33ef63c65
Author: Federico Mena Quintero <federico gnome org>
Date: Wed Mar 31 10:38:10 2021 -0600
Declare externs for g_win32_*_stream_new() manually
They are not in gio-sys 0.10.1 which is the latest released version,
it seems.
src/bin/rsvg-convert.rs | 29 ++++++++++++++++++-----------
1 file changed, 18 insertions(+), 11 deletions(-)
---
diff --git a/src/bin/rsvg-convert.rs b/src/bin/rsvg-convert.rs
index a8479fd4..bc6a8517 100644
--- a/src/bin/rsvg-convert.rs
+++ b/src/bin/rsvg-convert.rs
@@ -13,9 +13,6 @@ use std::io;
#[cfg(windows)]
use std::os::windows::io::AsRawHandle;
-#[cfg(windows)]
-use gio_sys;
-
use librsvg::rsvg_convert_only::{LegacySize, PathOrUrl};
use librsvg::{CairoRenderer, Color, Loader, Parse, RenderingError};
use once_cell::unsync::OnceCell;
@@ -346,12 +343,17 @@ impl Stdin {
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(gio_sys::g_win32_input_stream_new(
- raw_handle,
- false.to_glib(),
- ))
+ InputStream::from_glib_full(g_win32_input_stream_new(raw_handle, false.to_glib()))
}
}
}
@@ -369,12 +371,17 @@ impl Stdout {
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(gio_sys::g_win32_output_stream_new(
- raw_handle,
- false.to_glib(),
- ))
+ OutputStream::from_glib_full(g_win32_output_stream_new(raw_handle, false.to_glib()))
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]