summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/osx
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/osx
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/osx')
-rw-r--r--src/bluetooth/osx/osxbtobexsession.mm4
-rw-r--r--src/bluetooth/osx/osxbtsdpinquiry.mm2
-rw-r--r--src/bluetooth/osx/osxbtservicerecord.mm6
3 files changed, 6 insertions, 6 deletions
diff --git a/src/bluetooth/osx/osxbtobexsession.mm b/src/bluetooth/osx/osxbtobexsession.mm
index e228d6db..9fbc2c12 100644
--- a/src/bluetooth/osx/osxbtobexsession.mm
+++ b/src/bluetooth/osx/osxbtobexsession.mm
@@ -537,14 +537,14 @@ QT_USE_NAMESPACE
const OBEXConnectCommandResponseData *const response = &event->u.connectCommandResponseData;
if (response->headerDataPtr && response->headerDataLength >= 2) {
// 2 == 1 byte headerID + at least 1 byte headerValue ...
- QList<OBEXHeader> headers(qt_bluetooth_headers(static_cast<const uint8_t *>(response->headerDataPtr),
+ const QList<OBEXHeader> headers(qt_bluetooth_headers(static_cast<const uint8_t *>(response->headerDataPtr),
response->headerDataLength));
// ConnectionID is used when multiplexing OBEX connections
// to identify which particular connection this object is
// being sent on. When used, this _must_ be the first
// header sent.
- foreach (const OBEXHeader &header, headers) {
+ for (const OBEXHeader &header : headers) {
if (header.headerID == kOBEXHeaderIDConnectionID) {
connectionID = header.value.value<quint32>();
connectionIDFound = true;
diff --git a/src/bluetooth/osx/osxbtsdpinquiry.mm b/src/bluetooth/osx/osxbtsdpinquiry.mm
index a0bfdeef..6df2d16e 100644
--- a/src/bluetooth/osx/osxbtsdpinquiry.mm
+++ b/src/bluetooth/osx/osxbtsdpinquiry.mm
@@ -188,7 +188,7 @@ using namespace OSXBluetooth;
return kIOReturnError;
}
- foreach (const QBluetoothUuid &qUuid, qtFilters) {
+ for (const QBluetoothUuid &qUuid : qtFilters) {
ObjCStrongReference<IOBluetoothSDPUUID> uuid(iobluetooth_uuid(qUuid));
if (uuid)
[array addObject:uuid];
diff --git a/src/bluetooth/osx/osxbtservicerecord.mm b/src/bluetooth/osx/osxbtservicerecord.mm
index d12169bb..23d55d13 100644
--- a/src/bluetooth/osx/osxbtservicerecord.mm
+++ b/src/bluetooth/osx/osxbtservicerecord.mm
@@ -386,7 +386,7 @@ bool add_sequence_attribute(const QVariant &var, AttributeId key, NSMutableArray
return false;
const Sequence sequence(var.value<Sequence>());
- foreach (const QVariant &var, sequence) {
+ for (const QVariant &var : sequence) {
if (var.canConvert<Sequence>()) {
NSMutableArray *const nested = [NSMutableArray array];
add_sequence_attribute(var, key, nested);
@@ -411,7 +411,7 @@ bool add_sequence_attribute(const QBluetoothServiceInfo &serviceInfo, AttributeI
NSMutableArray *const list = [NSMutableArray array];
const Sequence sequence(var.value<Sequence>());
- foreach (const QVariant &element, sequence) {
+ for (const QVariant &element : sequence) {
if (!add_sequence_attribute(element, key, list))
add_attribute(element, key, list);
}
@@ -433,7 +433,7 @@ Dictionary iobluetooth_service_dictionary(const QBluetoothServiceInfo &serviceIn
dict.reset([[NSMutableDictionary alloc] init]);
- foreach (quint16 key, attributeIds) {
+ for (quint16 key : attributeIds) {
if (key == QSInfo::ProtocolDescriptorList) // We handle it in a special way.
continue;
// TODO: check if non-sequence QVariant still must be