From 3f9ca97d88508aec0bcd7d77a919ab93b44ef413 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eckhard=20V=C3=B6llm?= <34288016+iltis42@users.noreply.github.com> Date: Fri, 7 Jan 2022 19:22:26 +0100 Subject: [PATCH 1/2] change parameter to signed int As of wrong paramater, the following problem existed, that will be fixed now with this change. BTScanResultsSet.cpp:67:8: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits] if (i < 0) --- libraries/BluetoothSerial/src/BTScan.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libraries/BluetoothSerial/src/BTScan.h b/libraries/BluetoothSerial/src/BTScan.h index 3650d41625b..2851fdd3626 100644 --- a/libraries/BluetoothSerial/src/BTScan.h +++ b/libraries/BluetoothSerial/src/BTScan.h @@ -24,14 +24,14 @@ class BTScanResults { virtual void dump(Print *print = nullptr); virtual int getCount(); - virtual BTAdvertisedDevice* getDevice(uint32_t i); + virtual BTAdvertisedDevice* getDevice(int i); }; class BTScanResultsSet : public BTScanResults { public: void dump(Print *print = nullptr); int getCount(); - BTAdvertisedDevice* getDevice(uint32_t i); + BTAdvertisedDevice* getDevice(int i); bool add(BTAdvertisedDeviceSet advertisedDevice, bool unique = true); void clear(); @@ -39,4 +39,4 @@ class BTScanResultsSet : public BTScanResults { std::map m_vectorAdvertisedDevices; }; -#endif \ No newline at end of file +#endif From 9bd423ec5848348a7d6502cbea9bb968754dcfc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eckhard=20V=C3=B6llm?= <34288016+iltis42@users.noreply.github.com> Date: Fri, 7 Jan 2022 19:23:49 +0100 Subject: [PATCH 2/2] Change parameter and variable to int As of wrong paramater, the following problem existed, that will be fixed now with this change. BTScanResultsSet.cpp:67:8: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits] if (i < 0) --- libraries/BluetoothSerial/src/BTScanResultsSet.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libraries/BluetoothSerial/src/BTScanResultsSet.cpp b/libraries/BluetoothSerial/src/BTScanResultsSet.cpp index 79d23e463cd..e347228c848 100644 --- a/libraries/BluetoothSerial/src/BTScanResultsSet.cpp +++ b/libraries/BluetoothSerial/src/BTScanResultsSet.cpp @@ -63,11 +63,11 @@ int BTScanResultsSet::getCount() { * @param [in] i The index of the device. * @return The device at the specified index. */ -BTAdvertisedDevice* BTScanResultsSet::getDevice(uint32_t i) { +BTAdvertisedDevice* BTScanResultsSet::getDevice(int i) { if (i < 0) return nullptr; - uint32_t x = 0; + int x = 0; BTAdvertisedDeviceSet* pDev = &m_vectorAdvertisedDevices.begin()->second; for (auto it = m_vectorAdvertisedDevices.begin(); it != m_vectorAdvertisedDevices.end(); it++) { pDev = &it->second; @@ -92,4 +92,4 @@ bool BTScanResultsSet::add(BTAdvertisedDeviceSet advertisedDevice, bool unique) return false; } -#endif \ No newline at end of file +#endif