summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorMason Reed <mason@vector35.com>2024-11-07 16:46:57 -0500
committerMason Reed <mason@vector35.com>2024-11-08 03:13:53 -0500
commit66b7926e976185111dbbf1ccb6696bddde6555de (patch)
tree702efc2f568cc13d7079a49efdd820406f45d87d /plugins
parentd6e1624cff2b5d5eac57e0bf99ca1dac8437f9a5 (diff)
WARP: Remove unneeded ref in type conversion
Diffstat (limited to 'plugins')
-rw-r--r--plugins/warp/src/convert.rs24
-rw-r--r--plugins/warp/src/lib.rs2
-rw-r--r--plugins/warp/src/plugin/create.rs2
3 files changed, 14 insertions, 14 deletions
diff --git a/plugins/warp/src/convert.rs b/plugins/warp/src/convert.rs
index 728dd599..57b23604 100644
--- a/plugins/warp/src/convert.rs
+++ b/plugins/warp/src/convert.rs
@@ -117,14 +117,14 @@ pub fn to_bn_symbol_at_address(view: &BinaryView, symbol: &Symbol, addr: u64) ->
symbol_builder.create()
}
-pub fn from_bn_type(view: &BinaryView, raw_ty: BNRef<BNType>, confidence: u8) -> Type {
+pub fn from_bn_type(view: &BinaryView, raw_ty: &BNType, confidence: u8) -> Type {
from_bn_type_internal(view, &mut HashSet::new(), raw_ty, confidence)
}
fn from_bn_type_internal(
view: &BinaryView,
visited_refs: &mut HashSet<String>,
- raw_ty: BNRef<BNType>,
+ raw_ty: &BNType,
confidence: u8,
) -> Type {
let bytes_to_bits = |val| val * 8;
@@ -175,7 +175,7 @@ fn from_bn_type_internal(
ty: from_bn_type_internal(
view,
visited_refs,
- raw_member.ty.contents,
+ &raw_member.ty.contents,
raw_member.ty.confidence,
),
modifiers,
@@ -192,7 +192,7 @@ fn from_bn_type_internal(
let base_struct_ty = from_bn_type_internal(
view,
visited_refs,
- BNType::named_type(&base_struct.ty),
+ &BNType::named_type(&base_struct.ty),
255,
);
StructureMember {
@@ -239,7 +239,7 @@ fn from_bn_type_internal(
child_type: from_bn_type_internal(
view,
visited_refs,
- raw_child_ty.contents,
+ &raw_child_ty.contents,
raw_child_ty.confidence,
),
// TODO: Handle addressing.
@@ -255,7 +255,7 @@ fn from_bn_type_internal(
member_type: from_bn_type_internal(
view,
visited_refs,
- raw_member_ty.contents,
+ &raw_member_ty.contents,
raw_member_ty.confidence,
),
modifiers: ArrayModifiers::empty(),
@@ -275,7 +275,7 @@ fn from_bn_type_internal(
ty: from_bn_type_internal(
view,
visited_refs,
- raw_member.t.contents,
+ &raw_member.t.contents,
raw_member.t.confidence,
),
// TODO: Just omit location for now?
@@ -292,7 +292,7 @@ fn from_bn_type_internal(
ty: from_bn_type_internal(
view,
visited_refs,
- return_ty.contents,
+ &return_ty.contents,
return_ty.confidence,
),
locations: vec![],
@@ -334,7 +334,7 @@ fn from_bn_type_internal(
cached_type.value().to_owned()
} else {
let ntr_ty =
- from_bn_type_internal(view, visited_refs, raw_ntr_ty.unwrap(), confidence);
+ from_bn_type_internal(view, visited_refs, &raw_ntr_ty.unwrap(), confidence);
visited_refs.remove(&ref_id_str);
// NOTE: The GUID here must always equal the same for any given type for this to work effectively.
let ntr_guid = TypeGUID::from(&ntr_ty);
@@ -618,7 +618,7 @@ mod tests {
.types()
.iter()
.map(|t| {
- let ty = from_bn_type(&bv, t.type_object().clone(), u8::MAX);
+ let ty = from_bn_type(&bv, &t.type_object(), u8::MAX);
(TypeGUID::from(&ty), ty)
})
.collect();
@@ -642,7 +642,7 @@ mod tests {
.types()
.iter()
.map(|t| {
- let ty = from_bn_type(&inital_bv, t.type_object().clone(), u8::MAX);
+ let ty = from_bn_type(&inital_bv, &t.type_object(), u8::MAX);
(TypeGUID::from(&ty), ty)
})
.collect();
@@ -663,7 +663,7 @@ mod tests {
.types()
.iter()
.map(|t| {
- let ty = from_bn_type(&second_bv, t.type_object().clone(), u8::MAX);
+ let ty = from_bn_type(&second_bv, &t.type_object(), u8::MAX);
(TypeGUID::from(&ty), ty)
})
.collect();
diff --git a/plugins/warp/src/lib.rs b/plugins/warp/src/lib.rs
index 4240c79f..d098cd5b 100644
--- a/plugins/warp/src/lib.rs
+++ b/plugins/warp/src/lib.rs
@@ -32,7 +32,7 @@ pub fn build_function<A: Architecture, M: FunctionMutability, V: NonSSAVariant>(
Function {
guid: cached_function_guid(func, llil),
symbol: from_bn_symbol(&func.symbol()),
- ty: from_bn_type(&func.view(), bn_fn_ty, 255),
+ ty: from_bn_type(&func.view(), &bn_fn_ty, 255),
constraints: FunctionConstraints {
// NOTE: Adding adjacent only works if analysis is complete.
adjacent: cached_adjacency_constraints(func),
diff --git a/plugins/warp/src/plugin/create.rs b/plugins/warp/src/plugin/create.rs
index 966c69ca..d2f1924b 100644
--- a/plugins/warp/src/plugin/create.rs
+++ b/plugins/warp/src/plugin/create.rs
@@ -38,7 +38,7 @@ impl Command for CreateSignatureFile {
}));
data.types.extend(view.types().iter().map(|ty| {
let ref_ty = ty.type_object().to_owned();
- ComputedType::new(from_bn_type(&view, ref_ty, u8::MAX))
+ ComputedType::new(from_bn_type(&view, &ref_ty, u8::MAX))
}));
// And type generation :3