[librsvg] viewbox.rs: Use gboolean, not bool for field in a repr(C) struct



commit 28227ae6decbac86efefc74ce2bffbbc2c34ddfd
Author: Federico Mena Quintero <federico gnome org>
Date:   Wed Apr 26 14:27:10 2017 -0500

    viewbox.rs: Use gboolean, not bool for field in a repr(C) struct
    
    See https://github.com/rust-lang/rfcs/issues/992 - bool in Rust does not
    repr(C) as any C type in particular.  I was naively assuming that it
    would repr(C) as int, which is equivalent to gboolean.
    
    This makes tests/fixtures/dimensions/bug612951.svg pass again.  We were
    calling rsvg_node_svg_get_view_box() and getting a garbage value inside
    vbox.active - the low byte actually set as expected, and the high bits
    set to garbage.

 rust/src/viewbox.rs |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/rust/src/viewbox.rs b/rust/src/viewbox.rs
index df36f19..f25bb4c 100644
--- a/rust/src/viewbox.rs
+++ b/rust/src/viewbox.rs
@@ -1,4 +1,5 @@
 extern crate cairo;
+extern crate glib;
 
 use std::str::FromStr;
 
@@ -6,12 +7,14 @@ use error::*;
 use parsers::ParseError;
 use parsers;
 
+use glib::translate::*;
+
 /* Keep this in sync with rsvg-private.h:RsvgViewBox */
 #[repr(C)]
 #[derive(Debug, Copy, Clone, PartialEq)]
 pub struct RsvgViewBox {
     pub rect:   cairo::Rectangle,
-    pub active: bool
+    pub active: glib::ffi::gboolean
 }
 
 impl RsvgViewBox {


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