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:
William Casarin
2025-11-07 11:56:45 -08:00
parent 952ba14d46
commit eac5d41e3c
2 changed files with 2 additions and 2 deletions

2
Cargo.lock generated
View File

@@ -3520,7 +3520,7 @@ dependencies = [
[[package]] [[package]]
name = "nostrdb" name = "nostrdb"
version = "0.8.0" 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 = [ dependencies = [
"bindgen", "bindgen",
"cc", "cc",

View File

@@ -46,7 +46,7 @@ md5 = "0.7.0"
nostr = { version = "0.37.0", default-features = false, features = ["std", "nip49"] } nostr = { version = "0.37.0", default-features = false, features = ["std", "nip49"] }
nwc = "0.39.0" nwc = "0.39.0"
mio = { version = "1.0.3", features = ["os-poll", "net"] } 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" #nostrdb = "0.6.1"
notedeck = { path = "crates/notedeck" } notedeck = { path = "crates/notedeck" }
notedeck_chrome = { path = "crates/notedeck_chrome" } notedeck_chrome = { path = "crates/notedeck_chrome" }