From 4fb61322d91e5e8209678ba8cd37a665a2e470c9 Mon Sep 17 00:00:00 2001 From: Christopher Tam Date: Tue, 31 Dec 2024 01:13:10 -0500 Subject: [PATCH] uplink(fix): Use `c_char` for `char` FFI `char` in C maps to different types in x86 vs. ARM (`i8` vs `u8`). This may affect other architectures as well. Use `c_char` for FFI instead to avoid compile errors on different architectures. --- uplink/src/metadata.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/uplink/src/metadata.rs b/uplink/src/metadata.rs index efc8aa0..97b20cd 100644 --- a/uplink/src/metadata.rs +++ b/uplink/src/metadata.rs @@ -1,6 +1,7 @@ //! Storj DCS metadata types. use std::collections::HashMap; +use std::ffi::c_char; use std::ptr; use std::time::Duration; use std::vec::Vec; @@ -158,9 +159,9 @@ impl UplinkCustomMetadataWrapper { let mut entries = Vec::with_capacity(num_entries); for (k, v) in custom.iter() { entries.push(ulksys::UplinkCustomMetadataEntry { - key: k.as_ptr() as *mut i8, + key: k.as_ptr() as *mut c_char, key_length: k.len(), - value: v.as_ptr() as *mut i8, + value: v.as_ptr() as *mut c_char, value_length: v.len(), }); }