From c41f264a1dba68c89b4a224a70e3a5783f7fa879 Mon Sep 17 00:00:00 2001 From: Rusty Wagner Date: Tue, 24 Jun 2025 17:55:48 -0400 Subject: Remove implicit conversions from Confidence to underlying type, these can cause bugs and also issues with C++20 --- function.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'function.cpp') diff --git a/function.cpp b/function.cpp index 2f04af9a..bb5ae370 100644 --- a/function.cpp +++ b/function.cpp @@ -1031,7 +1031,7 @@ void Function::SetAutoType(Type* type) void Function::SetAutoReturnType(const Confidence>& type) { BNTypeWithConfidence tc; - tc.type = type ? type->GetObject() : nullptr; + tc.type = type.GetValue() ? type->GetObject() : nullptr; tc.confidence = type.GetConfidence(); BNSetAutoFunctionReturnType(m_object, &tc); } @@ -1053,7 +1053,7 @@ void Function::SetAutoReturnRegisters(const Confidence>& r void Function::SetAutoCallingConvention(const Confidence>& convention) { BNCallingConventionWithConfidence cc; - cc.convention = convention ? convention->GetObject() : nullptr; + cc.convention = convention.GetValue() ? convention->GetObject() : nullptr; cc.confidence = convention.GetConfidence(); BNSetAutoFunctionCallingConvention(m_object, &cc); } @@ -1160,7 +1160,7 @@ bool Function::HasUserType() const void Function::SetReturnType(const Confidence>& type) { BNTypeWithConfidence tc; - tc.type = type ? type->GetObject() : nullptr; + tc.type = type.GetValue() ? type->GetObject() : nullptr; tc.confidence = type.GetConfidence(); BNSetUserFunctionReturnType(m_object, &tc); } @@ -1182,7 +1182,7 @@ void Function::SetReturnRegisters(const Confidence>& retur void Function::SetCallingConvention(const Confidence>& convention) { BNCallingConventionWithConfidence cc; - cc.convention = convention ? convention->GetObject() : nullptr; + cc.convention = convention.GetValue() ? convention->GetObject() : nullptr; cc.confidence = convention.GetConfidence(); BNSetUserFunctionCallingConvention(m_object, &cc); } @@ -1872,9 +1872,9 @@ bool Function::HasUnresolvedIndirectBranches() void Function::SetAutoCallTypeAdjustment(Architecture* arch, uint64_t addr, const Confidence>& adjust) { BNTypeWithConfidence apiObject; - apiObject.type = adjust ? adjust->GetObject() : nullptr; + apiObject.type = adjust.GetValue() ? adjust->GetObject() : nullptr; apiObject.confidence = adjust.GetConfidence(); - BNSetAutoCallTypeAdjustment(m_object, arch->GetObject(), addr, adjust ? &apiObject : nullptr); + BNSetAutoCallTypeAdjustment(m_object, arch->GetObject(), addr, adjust.GetValue() ? &apiObject : nullptr); } @@ -1912,9 +1912,9 @@ void Function::SetAutoCallRegisterStackAdjustment( void Function::SetUserCallTypeAdjustment(Architecture* arch, uint64_t addr, const Confidence>& adjust) { BNTypeWithConfidence apiObject; - apiObject.type = adjust ? adjust->GetObject() : nullptr; + apiObject.type = adjust.GetValue() ? adjust->GetObject() : nullptr; apiObject.confidence = adjust.GetConfidence(); - BNSetUserCallTypeAdjustment(m_object, arch->GetObject(), addr, adjust ? &apiObject : nullptr); + BNSetUserCallTypeAdjustment(m_object, arch->GetObject(), addr, adjust.GetValue() ? &apiObject : nullptr); } -- cgit v1.3.1