[librsvg/librsvg-2.44] css.rs: Fix usize cast



commit ad46cc3a44e39f543d8acc5a0e3c298a9b844ce5
Author: Jordan Petridis <jpetridis gnome org>
Date:   Fri Sep 28 02:32:30 2018 +0300

    css.rs: Fix usize cast
    
    Previously we were casting usize, returned from the .len() method,
    to a u64 and later convert that to libc::c_ulong in the C bindings.
    
    But libc::ulong is u64 in amd64, but represented as u32 in i686,
    which results into a type missmatch whe compiled in i686.
    
    Givem that libc::c_ulong seems to behave like usize, it should be
    safe cast usize to libc::c_ulong directly.

 rsvg_internals/src/css.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/rsvg_internals/src/css.rs b/rsvg_internals/src/css.rs
index d4ef1df1..40151ddd 100644
--- a/rsvg_internals/src/css.rs
+++ b/rsvg_internals/src/css.rs
@@ -99,7 +99,7 @@ fn parse_into_handle(handle: *mut RsvgHandle, buf: &str) {
         (*doc_handler).app_data = &handler_data as *const _ as gpointer;
 
         let buf_ptr = buf.as_ptr() as *mut _;
-        let buf_len = buf.len() as u64;
+        let buf_len = buf.len() as libc::c_ulong;
 
         let parser = cr_parser_new_from_buf(buf_ptr, buf_len, CR_UTF_8, false.to_glib());
         if parser.is_null() {


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