Debian Codegraph @

debian/patches/0002-Use-c_char-instead-of-i8-for-ffi.patch

raw
1 From e5261398fcb4cd3406d727973486d0178130825a Mon Sep 17 00:00:00 2001
2 From: Wolfgang Silbermayr <[email protected]>
3 Date: Sat, 8 Dec 2018 09:39:56 +0100
4 Subject: [PATCH 2/2] Use c_char instead of i8 for ffi
5
6 This allows the project to build on architectures which define c_char as u8.
7 Fixes build problems in architectures provided by debian.
8 ---
9 src/codecs.rs | 5 +++--
10 1 file changed, 3 insertions(+), 2 deletions(-)
11
12 diff --git a/src/codecs.rs b/src/codecs.rs
13 index b28f835..749e7a2 100644
14 --- a/src/codecs.rs
15 +++ b/src/codecs.rs
16 @@ -6,14 +6,15 @@ use std::slice;
17 use std::str;
18 use std::ptr;
19 use std::ffi::CStr;
20 +use std::os::raw::c_char;
21
22 pub fn decode_c_str(c_str: *const ffi::yaml_char_t) -> Option<String> {
23 if c_str == ptr::null() {
24 None
25 } else {
26 unsafe {
27 - let i8_str = c_str as *const i8;
28 - str::from_utf8(CStr::from_ptr(i8_str).to_bytes()).map(|s| s.to_string()).ok()
29 + let c_char_str = c_str as *const c_char;
30 + str::from_utf8(CStr::from_ptr(c_char_str).to_bytes()).map(|s| s.to_string()).ok()
31 }
32 }
33 }
34 --
35 2.20.0.rc2
36