[librsvg/alatiera/ulong] css.rs: Fix usize cast
- From: Jordan Petridis <jpetridis src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg/alatiera/ulong] css.rs: Fix usize cast
- Date: Thu, 27 Sep 2018 23:37:25 +0000 (UTC)
commit 2801ac01a5bf820b269be3becb45f274b9b8df66
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]