From d552ae9beae6404c13548b98ec7a7ec4e6b3dd90 Mon Sep 17 00:00:00 2001 From: Glenn Smith Date: Thu, 21 Jul 2022 15:24:16 -0400 Subject: [Rust API] Better name for this trait fn, more CC support --- rust/src/binaryview.rs | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'rust/src/binaryview.rs') diff --git a/rust/src/binaryview.rs b/rust/src/binaryview.rs index 43eb1dfc..ff556d54 100644 --- a/rust/src/binaryview.rs +++ b/rust/src/binaryview.rs @@ -299,7 +299,7 @@ pub trait BinaryViewExt: BinaryViewBase { } fn symbol_by_raw_name(&self, raw_name: S) -> Result> { - let raw_name = raw_name.as_bytes_with_nul(); + let raw_name = raw_name.into_bytes_with_nul(); unsafe { let raw_sym = BNGetSymbolByRawName( @@ -326,7 +326,7 @@ pub trait BinaryViewExt: BinaryViewBase { } fn symbols_by_name(&self, name: S) -> Array { - let raw_name = name.as_bytes_with_nul(); + let raw_name = name.into_bytes_with_nul(); unsafe { let mut count = 0; @@ -481,7 +481,7 @@ pub trait BinaryViewExt: BinaryViewBase { } fn remove_auto_section(&self, name: S) { - let name = name.as_bytes_with_nul(); + let name = name.into_bytes_with_nul(); let name_ptr = name.as_ref().as_ptr() as *mut _; unsafe { @@ -490,7 +490,7 @@ pub trait BinaryViewExt: BinaryViewBase { } fn remove_user_section(&self, name: S) { - let name = name.as_bytes_with_nul(); + let name = name.into_bytes_with_nul(); let name_ptr = name.as_ref().as_ptr() as *mut _; unsafe { @@ -500,7 +500,7 @@ pub trait BinaryViewExt: BinaryViewBase { fn section_by_name(&self, name: S) -> Result
{ unsafe { - let raw_name = name.as_bytes_with_nul(); + let raw_name = name.into_bytes_with_nul(); let name_ptr = raw_name.as_ref().as_ptr() as *mut _; let raw_section = BNGetSectionByName(self.as_ref().handle, name_ptr); @@ -646,7 +646,7 @@ pub trait BinaryViewExt: BinaryViewBase { } fn show_graph_report(&self, raw_name: S, graph: FlowGraph) { - let raw_name = raw_name.as_bytes_with_nul(); + let raw_name = raw_name.into_bytes_with_nul(); unsafe { BNShowGraphReport( self.as_ref().handle, @@ -657,7 +657,7 @@ pub trait BinaryViewExt: BinaryViewBase { } fn load_settings(&self, view_type_name: S) -> Result> { - let view_type_name = view_type_name.as_bytes_with_nul(); + let view_type_name = view_type_name.into_bytes_with_nul(); let settings_handle = unsafe { BNBinaryViewGetLoadSettings( self.as_ref().handle, @@ -673,7 +673,7 @@ pub trait BinaryViewExt: BinaryViewBase { } fn set_load_settings(&self, view_type_name: S, settings: &Settings) { - let view_type_name = view_type_name.as_bytes_with_nul(); + let view_type_name = view_type_name.into_bytes_with_nul(); unsafe { BNBinaryViewSetLoadSettings( @@ -715,7 +715,7 @@ pub trait BinaryViewExt: BinaryViewBase { /// Get a tag type by its name fn get_tag_type_by_name(&self, name: S) -> Option> { - let name = name.as_bytes_with_nul(); + let name = name.into_bytes_with_nul(); unsafe { let handle = BNGetTagType(self.as_ref().handle, name.as_ref().as_ptr() as *mut _); @@ -728,7 +728,7 @@ pub trait BinaryViewExt: BinaryViewBase { /// Get a tag type by its id fn get_tag_type_by_id(&self, id: S) -> Option> { - let id = id.as_bytes_with_nul(); + let id = id.into_bytes_with_nul(); unsafe { let handle = BNGetTagTypeById(self.as_ref().handle, id.as_ref().as_ptr() as *mut _); @@ -757,7 +757,7 @@ pub trait BinaryViewExt: BinaryViewBase { /// /// Note this does not tell you anything about where it is used. fn get_tag(&self, id: S) -> Option> { - let id = id.as_bytes_with_nul(); + let id = id.into_bytes_with_nul(); unsafe { let handle = BNGetTag(self.as_ref().handle, id.as_ref().as_ptr() as *mut _); if handle.is_null() { @@ -842,7 +842,7 @@ pub trait BinaryViewExt: BinaryViewBase { let value: *mut BNMetadata = unsafe { BNBinaryViewQueryMetadata( self.as_ref().handle, - key.as_bytes_with_nul().as_ref().as_ptr() as *const c_char, + key.into_bytes_with_nul().as_ref().as_ptr() as *const c_char, ) }; if value.is_null() { @@ -864,7 +864,7 @@ pub trait BinaryViewExt: BinaryViewBase { unsafe { BNBinaryViewRemoveMetadata( self.as_ref().handle, - key.as_bytes_with_nul().as_ref().as_ptr() as *const c_char, + key.into_bytes_with_nul().as_ref().as_ptr() as *const c_char, ) }; } @@ -888,7 +888,7 @@ impl BinaryView { meta: &mut FileMetadata, filename: S, ) -> Result> { - let file = filename.as_bytes_with_nul(); + let file = filename.into_bytes_with_nul(); let handle = unsafe { BNCreateBinaryDataViewFromFilename(meta.handle, file.as_ref().as_ptr() as *mut _) -- cgit v1.3.1