summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/qbluetoothdevicediscoveryagent_bluez.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2022-04-11 11:18:52 +0200
committerMarc Mutz <marc.mutz@qt.io>2022-04-11 19:44:41 +0000
commitb3713b3ba84f1cccd998c49248e9b8f030b9587a (patch)
treeacdac020995f6381f2daef3314e1be4f00716a50 /src/bluetooth/qbluetoothdevicediscoveryagent_bluez.cpp
parent56a1b19b0cce97374fcd21c165e23d2cd80a6417 (diff)
Port indexed for-loops from int to qsizetype
... and port (already or soon-expected-to-be) count() to size(). These changes are considered trivial, in that nothing but the loop variable needs adjustment. The alternative, a port to ranged for-loops, I dismissed for these loops, either because the loop index was used for something else (first/last check, zip iteration) or I was just too lazy to prove that the container under iteration isn't changed. In some cases, I may have forgotten to port to ranged loops, even though it would be trivially safe. This was already much more complex than anticipated :) Also fix post-increment to pre-increment. It doesn't matter for integral types, but developers that regularly read and write post-increment for integral types will likely fail to switch to pre-increment for iterators types, where the difference does matter, so increase the exposure of code readers to the idiomatic form. Pick-to: 6.3 Task-number: QTBUG-102463 Change-Id: Ia6f2960dc52d46ffbd48f12446e9b0f7c70df162 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Diffstat (limited to 'src/bluetooth/qbluetoothdevicediscoveryagent_bluez.cpp')
-rw-r--r--src/bluetooth/qbluetoothdevicediscoveryagent_bluez.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent_bluez.cpp b/src/bluetooth/qbluetoothdevicediscoveryagent_bluez.cpp
index c4787779..3945e918 100644
--- a/src/bluetooth/qbluetoothdevicediscoveryagent_bluez.cpp
+++ b/src/bluetooth/qbluetoothdevicediscoveryagent_bluez.cpp
@@ -318,7 +318,7 @@ void QBluetoothDeviceDiscoveryAgentPrivate::deviceFound(const QString &devicePat
// Cache the properties so we do not have to access dbus every time to get a value
devicesProperties[devicePath] = properties;
- for (int i = 0; i < discoveredDevices.size(); i++) {
+ for (qsizetype i = 0; i < discoveredDevices.size(); ++i) {
if (discoveredDevices[i].address() == deviceInfo.address()) {
if (lowEnergySearchTimeout > 0 && discoveredDevices[i] == deviceInfo) {
qCDebug(QT_BT_BLUEZ) << "Duplicate: " << deviceInfo.address();
@@ -436,7 +436,7 @@ void QBluetoothDeviceDiscoveryAgentPrivate::_q_PropertiesChanged(const QString &
if (changed_properties.contains(QStringLiteral("RSSI"))
|| changed_properties.contains(QStringLiteral("ManufacturerData"))) {
- for (int i = 0; i < discoveredDevices.size(); i++) {
+ for (qsizetype i = 0; i < discoveredDevices.size(); ++i) {
if (discoveredDevices[i].address() == info.address()) {
QBluetoothDeviceInfo::Fields updatedFields = QBluetoothDeviceInfo::Field::None;
if (changed_properties.contains(QStringLiteral("RSSI"))) {