diff options
Diffstat (limited to 'rust/src')
| -rw-r--r-- | rust/src/debuginfo.rs | 21 | ||||
| -rw-r--r-- | rust/src/types.rs | 4 |
2 files changed, 17 insertions, 8 deletions
diff --git a/rust/src/debuginfo.rs b/rust/src/debuginfo.rs index 34daeac1..1353f8b1 100644 --- a/rust/src/debuginfo.rs +++ b/rust/src/debuginfo.rs @@ -770,16 +770,25 @@ impl DebugInfo { } /// Adds a function scoped under the current parser's name to the debug info - pub fn add_function(&self, new_func: DebugFunctionInfo) -> bool { - let short_name_bytes = new_func.short_name.map(|name| name.into_bytes_with_nul()); + pub fn add_function(&self, new_func: &DebugFunctionInfo) -> bool { + let short_name_bytes = new_func + .short_name + .as_ref() + .map(|name| name.into_bytes_with_nul()); let short_name = short_name_bytes .as_ref() .map_or(std::ptr::null_mut() as *mut _, |name| name.as_ptr() as _); - let full_name_bytes = new_func.full_name.map(|name| name.into_bytes_with_nul()); + let full_name_bytes = new_func + .full_name + .as_ref() + .map(|name| name.into_bytes_with_nul()); let full_name = full_name_bytes .as_ref() .map_or(std::ptr::null_mut() as *mut _, |name| name.as_ptr() as _); - let raw_name_bytes = new_func.raw_name.map(|name| name.into_bytes_with_nul()); + let raw_name_bytes = new_func + .raw_name + .as_ref() + .map(|name| name.into_bytes_with_nul()); let raw_name = raw_name_bytes .as_ref() .map_or(std::ptr::null_mut() as *mut _, |name| name.as_ptr() as _); @@ -816,11 +825,11 @@ impl DebugInfo { fullName: full_name, rawName: raw_name, address: new_func.address, - type_: match new_func.type_ { + type_: match &new_func.type_ { Some(type_) => type_.handle, _ => std::ptr::null_mut(), }, - platform: match new_func.platform { + platform: match &new_func.platform { Some(platform) => platform.handle, _ => std::ptr::null_mut(), }, diff --git a/rust/src/types.rs b/rust/src/types.rs index cb05a69d..9d1353bd 100644 --- a/rust/src/types.rs +++ b/rust/src/types.rs @@ -771,7 +771,7 @@ impl Type { }; let result = unsafe { - Self::ref_from_raw(BNNewTypeReference(BNCreateFunctionType( + Self::ref_from_raw(BNCreateFunctionType( &mut owned_raw_return_type, &mut raw_calling_convention, raw_parameters.as_mut_ptr(), @@ -785,7 +785,7 @@ impl Type { &mut return_regs, BNNameType::NoNameType, &mut pure, - ))) + )) }; for raw_param in raw_parameters { |
