From 48e705fd2ea86f985483312fa8ac98d5c5300466 Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Wed, 2 Jul 2025 23:10:11 -0400 Subject: [Rust] Misc cleanup --- rust/src/function.rs | 3 +-- rust/src/tags.rs | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/rust/src/function.rs b/rust/src/function.rs index 55a609cf..c61e4291 100644 --- a/rust/src/function.rs +++ b/rust/src/function.rs @@ -1146,8 +1146,7 @@ impl Function { // Create tag let tag = Tag::new(tag_type, data); - let binaryview = unsafe { BinaryView::ref_from_raw(BNGetFunctionData(self.handle)) }; - unsafe { BNAddTag(binaryview.handle, tag.handle, user) }; + unsafe { BNAddTag(self.view().handle, tag.handle, user) }; unsafe { match (user, addr) { diff --git a/rust/src/tags.rs b/rust/src/tags.rs index a8c4d5d4..4817f596 100644 --- a/rust/src/tags.rs +++ b/rust/src/tags.rs @@ -138,6 +138,7 @@ impl TagType { let tag_type = unsafe { Self::ref_from_raw(BNCreateTagType(view.handle)) }; tag_type.set_name(name); tag_type.set_icon(icon); + tag_type.set_type(TagTypeType::UserTagType); tag_type } @@ -179,10 +180,9 @@ impl TagType { unsafe { BNTagTypeGetType(self.handle) } } - pub fn set_type(&self, t: &str) { - let t = t.to_cstr(); + pub fn set_type(&self, ty: TagTypeType) { unsafe { - BNTagTypeSetName(self.handle, t.as_ptr()); + BNTagTypeSetType(self.handle, ty); } } -- cgit v1.3.1