From eac5d41e3cb1587c65d1fe29cbc23df0ec302ed5 Mon Sep 17 00:00:00 2001 From: William Casarin Date: Fri, 7 Nov 2025 11:56:45 -0800 Subject: [PATCH] fix nostrdb-rs platform independence commit 6956b9f955463404b8eff3b7abe0cc3092cb5958 Author: Martti Malmi 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 --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e581f1e..9cfd955 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -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", diff --git a/Cargo.toml b/Cargo.toml index 9f5b773..9cacf6b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" }