mirror of
https://github.com/aljazceru/notedeck.git
synced 2025-12-17 00:44:18 +01:00
fix nostrdb-rs platform independence
commit 6956b9f955463404b8eff3b7abe0cc3092cb5958 Author: Martti Malmi <sirius@iki.fi> Date: Fri Nov 7 17:35:31 2025 +0200 fix non-android target metadata.rs u8 platform-independent fix diff --git a/src/metadata.rs b/src/metadata.rs index 977cfc859915..bbaa0e4e724c 100644 --- a/src/metadata.rs +++ b/src/metadata.rs @@ -117,11 +117,9 @@ impl<'a> ReactionEntry<'a> { pub fn as_str(&'a self, buf: &'a mut [i8; 128]) -> &'a str { unsafe { let rstr = bindings::ndb_note_meta_reaction_str(self.as_ptr()); - // weird android compilation issue - #[cfg(target_os = "android")] - let ptr = { bindings::ndb_reaction_to_str(rstr, buf.as_mut_ptr() as *mut u8) }; - #[cfg(not(target_os = "android"))] - let ptr = { bindings::ndb_reaction_to_str(rstr, buf.as_mut_ptr()) }; + // Cast to c_char for platform independence (i8 on Linux, u8 on macOS) + let ptr = + bindings::ndb_reaction_to_str(rstr, buf.as_mut_ptr() as *mut std::os::raw::c_char); let byte_slice: &[u8] = std::slice::from_raw_parts(ptr as *mut u8, libc::strlen(ptr)); std::str::from_utf8_unchecked(byte_slice) } Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -3520,7 +3520,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "nostrdb"
|
||||
version = "0.8.0"
|
||||
source = "git+https://github.com/damus-io/nostrdb-rs?rev=035bb156dbedd7b058c7ccc176b7141b15436a41#035bb156dbedd7b058c7ccc176b7141b15436a41"
|
||||
source = "git+https://github.com/damus-io/nostrdb-rs?rev=6956b9f955463404b8eff3b7abe0cc3092cb5958#6956b9f955463404b8eff3b7abe0cc3092cb5958"
|
||||
dependencies = [
|
||||
"bindgen",
|
||||
"cc",
|
||||
|
||||
@@ -46,7 +46,7 @@ md5 = "0.7.0"
|
||||
nostr = { version = "0.37.0", default-features = false, features = ["std", "nip49"] }
|
||||
nwc = "0.39.0"
|
||||
mio = { version = "1.0.3", features = ["os-poll", "net"] }
|
||||
nostrdb = { git = "https://github.com/damus-io/nostrdb-rs", rev = "035bb156dbedd7b058c7ccc176b7141b15436a41" }
|
||||
nostrdb = { git = "https://github.com/damus-io/nostrdb-rs", rev = "6956b9f955463404b8eff3b7abe0cc3092cb5958" }
|
||||
#nostrdb = "0.6.1"
|
||||
notedeck = { path = "crates/notedeck" }
|
||||
notedeck_chrome = { path = "crates/notedeck_chrome" }
|
||||
|
||||
Reference in New Issue
Block a user