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 /binaryninjaapi.h | |
| parent | b1a7666164a000c5255f90568ed9597b58ce276a (diff) | |
Remove implicit conversions from Confidence to underlying type, these can cause bugs and also issues with C++20
Diffstat (limited to 'binaryninjaapi.h')
| -rw-r--r-- | binaryninjaapi.h | 42 |
1 files changed, 38 insertions, 4 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h index 48f11f24..3cdb1498 100644 --- a/binaryninjaapi.h +++ b/binaryninjaapi.h @@ -366,6 +366,24 @@ namespace BinaryNinja { T* GetPtr() const { return m_obj; } }; + template <class T> + bool operator==(T* a, const Ref<T>& b) + { + return a == b.GetPtr(); + } + + template <class T> + bool operator!=(T* a, const Ref<T>& b) + { + return a != b.GetPtr(); + } + + template <class T> + bool operator<(T* a, const Ref<T>& b) + { + return a < b.GetPtr(); + } + /*! \ingroup refcount */ @@ -389,8 +407,26 @@ namespace BinaryNinja { T* GetPtr() const { return m_obj; } }; + template <class T> + bool operator==(T* a, const CallbackRef<T>& b) + { + return a == b.GetPtr(); + } + + template <class T> + bool operator!=(T* a, const CallbackRef<T>& b) + { + return a != b.GetPtr(); + } + + template <class T> + bool operator<(T* a, const CallbackRef<T>& b) + { + return a < b.GetPtr(); + } + /*! - \ingroup confidence + \ingroup confidence */ class ConfidenceBase { @@ -499,8 +535,6 @@ namespace BinaryNinja { Confidence(const Confidence<Ref<T>>& v) : ConfidenceBase(v.m_confidence), m_value(v.m_value) {} - operator Ref<T>() const { return m_value; } - operator T*() const { return m_value.GetPtr(); } T* operator->() const { return m_value.GetPtr(); } bool operator!() const { return !m_value; } @@ -4281,7 +4315,7 @@ namespace BinaryNinja { struct DataVariable { DataVariable() {} - DataVariable(uint64_t a, Type* t, bool d) : address(a), type(t), autoDiscovered(d) {} + DataVariable(uint64_t a, const Confidence<Ref<Type>>& t, bool d) : address(a), type(t), autoDiscovered(d) {} uint64_t address; Confidence<Ref<Type>> type; |
