Skip to content

Commit a0beb81

Browse files
authored
Consistently change device index to singed integer in BluetoothSerial lib (#6109)
* 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) * 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)
1 parent 460af2e commit a0beb81

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

Diff for: libraries/BluetoothSerial/src/BTScan.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,19 @@ class BTScanResults {
2424

2525
virtual void dump(Print *print = nullptr);
2626
virtual int getCount();
27-
virtual BTAdvertisedDevice* getDevice(uint32_t i);
27+
virtual BTAdvertisedDevice* getDevice(int i);
2828
};
2929

3030
class BTScanResultsSet : public BTScanResults {
3131
public:
3232
void dump(Print *print = nullptr);
3333
int getCount();
34-
BTAdvertisedDevice* getDevice(uint32_t i);
34+
BTAdvertisedDevice* getDevice(int i);
3535

3636
bool add(BTAdvertisedDeviceSet advertisedDevice, bool unique = true);
3737
void clear();
3838

3939
std::map<std::string, BTAdvertisedDeviceSet> m_vectorAdvertisedDevices;
4040
};
4141

42-
#endif
42+
#endif

Diff for: libraries/BluetoothSerial/src/BTScanResultsSet.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,11 @@ int BTScanResultsSet::getCount() {
6363
* @param [in] i The index of the device.
6464
* @return The device at the specified index.
6565
*/
66-
BTAdvertisedDevice* BTScanResultsSet::getDevice(uint32_t i) {
66+
BTAdvertisedDevice* BTScanResultsSet::getDevice(int i) {
6767
if (i < 0)
6868
return nullptr;
6969

70-
uint32_t x = 0;
70+
int x = 0;
7171
BTAdvertisedDeviceSet* pDev = &m_vectorAdvertisedDevices.begin()->second;
7272
for (auto it = m_vectorAdvertisedDevices.begin(); it != m_vectorAdvertisedDevices.end(); it++) {
7373
pDev = &it->second;
@@ -92,4 +92,4 @@ bool BTScanResultsSet::add(BTAdvertisedDeviceSet advertisedDevice, bool unique)
9292
return false;
9393
}
9494

95-
#endif
95+
#endif

0 commit comments

Comments
 (0)