diff options
| author | Rusty Wagner <rusty.wagner@gmail.com> | 2025-06-24 17:55:48 -0400 |
|---|---|---|
| committer | Alexander Taylor <alex@vector35.com> | 2025-06-25 18:36:47 -0400 |
| commit | c41f264a1dba68c89b4a224a70e3a5783f7fa879 (patch) | |
| tree | 00bb6e91d86b708bff7265ed7179a6ef2793b7fb /function.cpp | |
| parent | b1a7666164a000c5255f90568ed9597b58ce276a (diff) | |
Remove implicit conversions from Confidence to underlying type, these can cause bugs and also issues with C++20
Diffstat (limited to 'function.cpp')
| -rw-r--r-- | function.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
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<Ref<Type>>& 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<std::vector<uint32_t>>& r void Function::SetAutoCallingConvention(const Confidence<Ref<CallingConvention>>& 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<Ref<Type>>& 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<std::vector<uint32_t>>& retur void Function::SetCallingConvention(const Confidence<Ref<CallingConvention>>& 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<Ref<Type>>& 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<Ref<Type>>& 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); } |
