[librsvg/wip/rust-api: 10/11] Hack to avoid using rsvg_sax_error_cb() when building librsvg_crate



commit c077954605d2ffc8d9d511c144a9c42e51561328
Author: Federico Mena Quintero <federico gnome org>
Date:   Wed Feb 13 19:38:32 2019 -0600

    Hack to avoid using rsvg_sax_error_cb() when building librsvg_crate

 rsvg_internals/src/xml2_load.rs | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
---
diff --git a/rsvg_internals/src/xml2_load.rs b/rsvg_internals/src/xml2_load.rs
index d2dfb091..8c115a2a 100644
--- a/rsvg_internals/src/xml2_load.rs
+++ b/rsvg_internals/src/xml2_load.rs
@@ -20,8 +20,16 @@ use util::utf8_cstr;
 use xml::XmlState;
 use xml2::*;
 
+#[cfg(feature = "c-library")]
 extern "C" {
-    fn rsvg_sax_error_cb(data: *mut libc::c_void);
+    fn rsvg_sax_error_cb(ctx: *mut libc::c_void);
+}
+
+#[cfg(not(feature = "c-library"))]
+extern "C" fn rsvg_sax_error_cb(ctx: *mut libc::c_void) {
+    let xml = unsafe { &mut *(ctx as *mut XmlState) };
+
+    xml.error("FIXME: need to take a varargs to format libxml2's error message");
 }
 
 fn get_xml2_sax_handler() -> xmlSAXHandler {


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