summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/bluez
diff options
context:
space:
mode:
authorOliver Wolff <oliver.wolff@qt.io>2018-08-14 11:08:18 +0200
committerOliver Wolff <oliver.wolff@qt.io>2018-08-15 07:56:46 +0000
commita0ade068004ad869d6235ae8d6cd5e2050bf765d (patch)
tree42c949ba2fa7fcd4ab5356293d1ef3cad1c436f6 /src/bluetooth/bluez
parent84f0e76c647e7f09529b79525b2d4fbc698576d8 (diff)
Replace foreach with for loop and set QT_NO_FOREACH
To avoid unnecessary copies, const is used wherever possible. Change-Id: Ic743716512751cfd24fad5bd37c244b115dd26fe Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/bluetooth/bluez')
-rw-r--r--src/bluetooth/bluez/bluez5_helper.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/bluetooth/bluez/bluez5_helper.cpp b/src/bluetooth/bluez/bluez5_helper.cpp
index f798088e..2beb533c 100644
--- a/src/bluetooth/bluez/bluez5_helper.cpp
+++ b/src/bluetooth/bluez/bluez5_helper.cpp
@@ -331,7 +331,8 @@ QtBluezDiscoveryManager::~QtBluezDiscoveryManager()
{
qCDebug(QT_BT_BLUEZ) << "Destroying QtBluezDiscoveryManager";
- foreach (const QString &adapterPath, d->references.keys()) {
+ const QList<QString> adapterPaths = d->references.keys();
+ for (const QString &adapterPath : adapterPaths) {
AdapterData *data = d->references.take(adapterPath);
delete data->propteryListener;
@@ -416,7 +417,8 @@ void QtBluezDiscoveryManager::unregisterDiscoveryInterest(const QString &adapter
// if (d->references.isEmpty()) {
// qCDebug(QT_BT_BLUEZ) << "No running registration";
// } else {
-// foreach (const QString &path, d->references.keys()) {
+// const QList<QString> paths = d->references.keys();
+// for (const QString &path : paths) {
// qCDebug(QT_BT_BLUEZ) << path << "->" << d->references[path]->reference;
// }
// }
@@ -536,7 +538,7 @@ QString findAdapterForAddress(const QBluetoothAddress &wantedAddress, bool *ok =
if (wantedAddress.isNull())
return localAdapters.front().first; // -> return first found adapter
- foreach (const AddressForPathType &pair, localAdapters) {
+ for (const AddressForPathType &pair : qAsConst(localAdapters)) {
if (pair.second == wantedAddress)
return pair.first; // -> found local adapter with wanted address
}