nostrdb-rs

nostrdb in rust!
git clone git://jb55.com/nostrdb-rs
Log | Files | Refs | Submodules | README | LICENSE

commit 6956b9f955463404b8eff3b7abe0cc3092cb5958
parent 035bb156dbedd7b058c7ccc176b7141b15436a41
Author: Martti Malmi <sirius@iki.fi>
Date:   Fri,  7 Nov 2025 17:35:31 +0200

fix non-android target metadata.rs u8

platform-independent fix

Diffstat:
Msrc/metadata.rs | 8+++-----
1 file changed, 3 insertions(+), 5 deletions(-)

diff --git 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) }