From 6264254065bbae9d89f51cf3330379b7ace09592 Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Sat, 3 May 2025 23:15:17 -0400 Subject: [Rust] Return `String` instead of `BnString` for cases where lossy conversion can be tolerated Still need to go and audit all usage, but realistically the most important places to give the user control are with symbols, where the data can come from non utf8 sources This is still incomplete, I just looked for usage of -> BnString so any other variant was omitted. --- rust/src/platform.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'rust/src/platform.rs') diff --git a/rust/src/platform.rs b/rust/src/platform.rs index 72f61430..6d2b30f0 100644 --- a/rust/src/platform.rs +++ b/rust/src/platform.rs @@ -160,10 +160,10 @@ impl Platform { } } - pub fn name(&self) -> BnString { + pub fn name(&self) -> String { unsafe { let raw_name = BNGetPlatformName(self.handle); - BnString::from_raw(raw_name) + BnString::into_string(raw_name) } } @@ -301,7 +301,7 @@ impl Platform { assert!(!error_string.is_null()); Err(TypeParserError::new( TypeParserErrorSeverity::FatalSeverity, - unsafe { BnString::from_raw(error_string) }.to_string(), + unsafe { BnString::into_string(error_string) }, file_name.to_string(), 0, 0, -- cgit v1.3.1