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/types.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'rust/src/types.rs') diff --git a/rust/src/types.rs b/rust/src/types.rs index 9d1353bd..8dbeeb48 100644 --- a/rust/src/types.rs +++ b/rust/src/types.rs @@ -932,9 +932,9 @@ impl Type { } } - pub fn generate_auto_demangled_type_id>(name: T) -> BnString { + pub fn generate_auto_demangled_type_id>(name: T) -> String { let mut raw_name = QualifiedName::into_raw(name.into()); - let type_id = unsafe { BnString::from_raw(BNGenerateAutoDemangledTypeId(&mut raw_name)) }; + let type_id = unsafe { BnString::into_string(BNGenerateAutoDemangledTypeId(&mut raw_name)) }; QualifiedName::free_raw(raw_name); type_id } @@ -2334,7 +2334,7 @@ impl NameAndType { } pub(crate) fn free_raw(value: BNNameAndType) { - let _ = unsafe { BnString::from_raw(value.name) }; + unsafe { BnString::free_raw(value.name) }; let _ = unsafe { Type::ref_from_raw(value.type_) }; } -- cgit v1.3.1