Skip to content

Commit

Permalink
fix doc and QualifiedName params
Browse files Browse the repository at this point in the history
  • Loading branch information
rbran committed May 9, 2024
1 parent 75f77e8 commit 99fa98f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
14 changes: 7 additions & 7 deletions rust/src/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use binaryninjacore_sys::*;
use crate::rc::*;
use crate::string::*;
use crate::tags::{Tag, TagType};
use crate::types::{QualifiedName, QualifiedNameAndType, Variable};
use crate::types::{QualifiedName, Variable};
use crate::{
architecture::CoreArchitecture,
basicblock::{BasicBlock, BlockContext},
Expand Down Expand Up @@ -494,16 +494,16 @@ impl Function {
/// ```no_run
/// # use binaryninja::function::Function;
/// # let fun: Function = todo!();
/// fun.add_user_code_ref(0x1337, "A", None);
/// fun.add_user_type_ref(0x1337, &"A".into(), None);
/// ```
pub fn add_user_type_ref(
&self,
from_addr: u64,
name: &QualifiedNameAndType,
name: &QualifiedName,
arch: Option<CoreArchitecture>,
) {
let arch = arch.unwrap_or_else(|| self.arch());
let name_ptr = &name.0 as *const _ as *mut _;
let name_ptr = &name.0 as *const BNQualifiedName as *mut _;
unsafe { BNAddUserTypeReference(self.handle, arch.0, from_addr, name_ptr) }
}

Expand All @@ -519,16 +519,16 @@ impl Function {
/// ```no_run
/// # use binaryninja::function::Function;
/// # let fun: Function = todo!();
/// fun.remove_user_type_ref(0x1337, "A", None);
/// fun.remove_user_type_ref(0x1337, &"A".into(), None);
/// ```
pub fn remove_user_type_ref(
&self,
from_addr: u64,
name: &QualifiedNameAndType,
name: &QualifiedName,
arch: Option<CoreArchitecture>,
) {
let arch = arch.unwrap_or_else(|| self.arch());
let name_ptr = &name.0 as *const _ as *mut _;
let name_ptr = &name.0 as *const BNQualifiedName as *mut _;
unsafe { BNRemoveUserTypeReference(self.handle, arch.0, from_addr, name_ptr) }
}

Expand Down
13 changes: 7 additions & 6 deletions rust/src/mlil/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,13 @@ impl MediumLevelILFunction {
///
/// # Example
/// ```no_run
/// # use binaryninja::function::Function;
/// # let fun: Function = todo!();
/// mlil_var = current_mlil[0].operands[0]
/// def_address = 0x40108d
/// var_value = PossibleValueSet.constant(5)
/// current_function.set_user_var_value(mlil_var, def_address, var_value)
/// # use binaryninja::mlil::MediumLevelILFunction;
/// # use binaryninja::types::PossibleValueSet;
/// # let mlil_fun: MediumLevelILFunction = todo!();
/// let (mlil_var, arch_addr, _val) = mlil_fun.user_var_values().all().next().unwrap();
/// let def_address = arch_addr.address;
/// let var_value = PossibleValueSet::ConstantValue{value: 5};
/// mlil_fun.set_user_var_value(&mlil_var, def_address, var_value).unwrap();
/// ```
pub fn set_user_var_value(
&self,
Expand Down

0 comments on commit 99fa98f

Please sign in to comment.