From 447d7604828ce2d873f22608602aede8d496c9c7 Mon Sep 17 00:00:00 2001 From: capitalistspz Date: Thu, 26 Sep 2024 05:52:40 +0100 Subject: [PATCH] `WiimoteDevice`: Make equality actually constant --- src/input/api/Wiimote/WiimoteDevice.h | 2 +- src/input/api/Wiimote/hidapi/HidapiWiimote.cpp | 4 ++-- src/input/api/Wiimote/hidapi/HidapiWiimote.h | 2 +- src/input/api/Wiimote/l2cap/L2CapWiimote.cpp | 2 +- src/input/api/Wiimote/l2cap/L2CapWiimote.h | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/input/api/Wiimote/WiimoteDevice.h b/src/input/api/Wiimote/WiimoteDevice.h index 932b7bd9..8ea5b321 100644 --- a/src/input/api/Wiimote/WiimoteDevice.h +++ b/src/input/api/Wiimote/WiimoteDevice.h @@ -9,7 +9,7 @@ public: virtual bool write_data(const std::vector& data) = 0; virtual std::optional> read_data() = 0; - virtual bool operator==(WiimoteDevice& o) const = 0; + virtual bool operator==(const WiimoteDevice& o) const = 0; }; using WiimoteDevicePtr = std::shared_ptr; diff --git a/src/input/api/Wiimote/hidapi/HidapiWiimote.cpp b/src/input/api/Wiimote/hidapi/HidapiWiimote.cpp index 9ba56321..5780909f 100644 --- a/src/input/api/Wiimote/hidapi/HidapiWiimote.cpp +++ b/src/input/api/Wiimote/hidapi/HidapiWiimote.cpp @@ -47,8 +47,8 @@ std::vector HidapiWiimote::get_devices() { return wiimote_devices; } -bool HidapiWiimote::operator==(WiimoteDevice& rhs) const { - auto other = dynamic_cast(&rhs); +bool HidapiWiimote::operator==(const WiimoteDevice& rhs) const { + auto other = dynamic_cast(&rhs); if (!other) return false; return m_path == other->m_path; diff --git a/src/input/api/Wiimote/hidapi/HidapiWiimote.h b/src/input/api/Wiimote/hidapi/HidapiWiimote.h index c914d007..952a36f0 100644 --- a/src/input/api/Wiimote/hidapi/HidapiWiimote.h +++ b/src/input/api/Wiimote/hidapi/HidapiWiimote.h @@ -10,7 +10,7 @@ public: bool write_data(const std::vector &data) override; std::optional> read_data() override; - bool operator==(WiimoteDevice& o) const override; + bool operator==(const WiimoteDevice& o) const override; static std::vector get_devices(); diff --git a/src/input/api/Wiimote/l2cap/L2CapWiimote.cpp b/src/input/api/Wiimote/l2cap/L2CapWiimote.cpp index 515de491..7808adee 100644 --- a/src/input/api/Wiimote/l2cap/L2CapWiimote.cpp +++ b/src/input/api/Wiimote/l2cap/L2CapWiimote.cpp @@ -112,7 +112,7 @@ std::optional> L2CapWiimote::read_data() } -bool L2CapWiimote::operator==(WiimoteDevice& rhs) const +bool L2CapWiimote::operator==(const WiimoteDevice& rhs) const { auto mote = dynamic_cast(&rhs); if (!mote) diff --git a/src/input/api/Wiimote/l2cap/L2CapWiimote.h b/src/input/api/Wiimote/l2cap/L2CapWiimote.h index d32d9b7b..04c9151b 100644 --- a/src/input/api/Wiimote/l2cap/L2CapWiimote.h +++ b/src/input/api/Wiimote/l2cap/L2CapWiimote.h @@ -10,7 +10,7 @@ class L2CapWiimote : public WiimoteDevice bool write_data(const std::vector& data) override; std::optional> read_data() override; - bool operator==(WiimoteDevice& o) const override; + bool operator==(const WiimoteDevice& o) const override; static void AddCandidateAddress(bdaddr_t addr); static std::vector get_devices();