summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2022-11-11 16:26:04 +0100
committerMarc Mutz <marc.mutz@qt.io>2022-11-12 08:42:25 +0100
commit2f2e25c3beea21c14bb75b2f32b5ee4700759a89 (patch)
treeeff1132b9135642b076cec6796691f91bbd07188
parentcad49b3be482b41f1ae43b5c9ce4d009a810240b (diff)
Port from qAsConst() to std::as_const()
We've been requiring C++17 since Qt 6.0, and our qAsConst use finally starts to bother us (QTBUG-99313), so time to port away from it now. Since qAsConst has exactly the same semantics as std::as_const (down to rvalue treatment, constexpr'ness and noexcept'ness), there's really nothing more to it than a global search-and-replace. This is a 6.4 re-run of the script we ran in dev, in order to avoid conflicts between the branches when cherry-picking. Change-Id: I5eca3df3179dfb2b2682c75a479ba9a4259cc703 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
-rw-r--r--examples/bluetooth/btchat/chatserver.cpp2
-rw-r--r--examples/bluetooth/btchat/remoteselector.cpp2
-rw-r--r--examples/bluetooth/heartrate-game/devicefinder.cpp2
-rw-r--r--examples/bluetooth/lowenergyscanner/device.cpp4
-rw-r--r--src/bluetooth/bluez/bluez5_helper.cpp2
-rw-r--r--src/bluetooth/qbluetoothdevicediscoveryagent_winrt.cpp2
-rw-r--r--src/bluetooth/qbluetoothservicediscoveryagent_android.cpp2
-rw-r--r--src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp2
-rw-r--r--src/bluetooth/qbluetoothservicediscoveryagent_winrt.cpp2
-rw-r--r--src/bluetooth/qlowenergycharacteristic.cpp2
-rw-r--r--src/bluetooth/qlowenergycontroller_bluez.cpp16
-rw-r--r--src/bluetooth/qlowenergycontroller_bluezdbus.cpp16
-rw-r--r--src/bluetooth/qlowenergycontroller_winrt.cpp6
-rw-r--r--src/bluetooth/qlowenergyservice.cpp2
-rw-r--r--src/nfc/android/androidmainnewintentlistener.cpp2
-rw-r--r--src/nfc/qnearfieldmanager_android.cpp2
-rw-r--r--tests/auto/nfccommons/qnearfieldtagtype1.cpp4
-rw-r--r--tests/auto/qbluetoothservicediscoveryagent/tst_qbluetoothservicediscoveryagent.cpp2
-rw-r--r--tests/auto/qbluetoothserviceinfo/tst_qbluetoothserviceinfo.cpp6
-rw-r--r--tests/auto/qbluetoothsocket/tst_qbluetoothsocket.cpp2
-rw-r--r--tests/auto/qlowenergycharacteristic/tst_qlowenergycharacteristic.cpp2
-rw-r--r--tests/auto/qlowenergycontroller/tst_qlowenergycontroller.cpp8
-rw-r--r--tests/auto/qlowenergydescriptor/tst_qlowenergydescriptor.cpp2
-rw-r--r--tests/bttestui/btlocaldevice.cpp6
24 files changed, 49 insertions, 49 deletions
diff --git a/examples/bluetooth/btchat/chatserver.cpp b/examples/bluetooth/btchat/chatserver.cpp
index d65bb87e..2e6c314d 100644
--- a/examples/bluetooth/btchat/chatserver.cpp
+++ b/examples/bluetooth/btchat/chatserver.cpp
@@ -109,7 +109,7 @@ void ChatServer::sendMessage(const QString &message)
{
QByteArray text = message.toUtf8() + '\n';
- for (QBluetoothSocket *socket : qAsConst(clientSockets))
+ for (QBluetoothSocket *socket : std::as_const(clientSockets))
socket->write(text);
}
//! [sendMessage]
diff --git a/examples/bluetooth/btchat/remoteselector.cpp b/examples/bluetooth/btchat/remoteselector.cpp
index d0e91509..5872cec5 100644
--- a/examples/bluetooth/btchat/remoteselector.cpp
+++ b/examples/bluetooth/btchat/remoteselector.cpp
@@ -68,7 +68,7 @@ void RemoteSelector::serviceDiscovered(const QBluetoothServiceInfo &serviceInfo)
qDebug() << "\tRFCOMM server channel:" << serviceInfo.serverChannel();
#endif
const QBluetoothAddress address = serviceInfo.device().address();
- for (const QBluetoothServiceInfo &info : qAsConst(m_discoveredServices)) {
+ for (const QBluetoothServiceInfo &info : std::as_const(m_discoveredServices)) {
if (info.device().address() == address)
return;
}
diff --git a/examples/bluetooth/heartrate-game/devicefinder.cpp b/examples/bluetooth/heartrate-game/devicefinder.cpp
index 54dbd2bb..1b29b443 100644
--- a/examples/bluetooth/heartrate-game/devicefinder.cpp
+++ b/examples/bluetooth/heartrate-game/devicefinder.cpp
@@ -104,7 +104,7 @@ void DeviceFinder::connectToService(const QString &address)
m_deviceDiscoveryAgent->stop();
DeviceInfo *currentDevice = nullptr;
- for (QObject *entry : qAsConst(m_devices)) {
+ for (QObject *entry : std::as_const(m_devices)) {
auto device = qobject_cast<DeviceInfo *>(entry);
if (device && device->getAddress() == address ) {
currentDevice = device;
diff --git a/examples/bluetooth/lowenergyscanner/device.cpp b/examples/bluetooth/lowenergyscanner/device.cpp
index d6540a2f..d645931c 100644
--- a/examples/bluetooth/lowenergyscanner/device.cpp
+++ b/examples/bluetooth/lowenergyscanner/device.cpp
@@ -106,7 +106,7 @@ void Device::scanServices(const QString &address)
{
// We need the current device for service discovery.
- for (auto d: qAsConst(devices)) {
+ for (auto d: std::as_const(devices)) {
if (auto device = qobject_cast<DeviceInfo *>(d)) {
if (device->getAddress() == address ) {
currentDevice.setDevice(device->getDevice());
@@ -187,7 +187,7 @@ void Device::serviceScanDone()
void Device::connectToService(const QString &uuid)
{
QLowEnergyService *service = nullptr;
- for (auto s: qAsConst(m_services)) {
+ for (auto s: std::as_const(m_services)) {
auto serviceInfo = qobject_cast<ServiceInfo *>(s);
if (!serviceInfo)
continue;
diff --git a/src/bluetooth/bluez/bluez5_helper.cpp b/src/bluetooth/bluez/bluez5_helper.cpp
index 561a39c6..5f252026 100644
--- a/src/bluetooth/bluez/bluez5_helper.cpp
+++ b/src/bluetooth/bluez/bluez5_helper.cpp
@@ -503,7 +503,7 @@ QString findAdapterForAddress(const QBluetoothAddress &wantedAddress, bool *ok =
if (wantedAddress.isNull())
return localAdapters.front().first; // -> return first found adapter
- for (const AddressForPathType &pair : qAsConst(localAdapters)) {
+ for (const AddressForPathType &pair : std::as_const(localAdapters)) {
if (pair.second == wantedAddress)
return pair.first; // -> found local adapter with wanted address
}
diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent_winrt.cpp b/src/bluetooth/qbluetoothdevicediscoveryagent_winrt.cpp
index 1216155b..3839b2d6 100644
--- a/src/bluetooth/qbluetoothdevicediscoveryagent_winrt.cpp
+++ b/src/bluetooth/qbluetoothdevicediscoveryagent_winrt.cpp
@@ -427,7 +427,7 @@ void QWinRTBluetoothDeviceDiscoveryWorker::onAdvertisementDataReceived(
changedFields.setFlag((QBluetoothDeviceInfo::Field::ServiceData));
}
bool newServiceAdded = false;
- for (const QBluetoothUuid &uuid : qAsConst(uuids)) {
+ for (const QBluetoothUuid &uuid : std::as_const(uuids)) {
if (!foundServices.contains(uuid)) {
foundServices.append(uuid);
newServiceAdded = true;
diff --git a/src/bluetooth/qbluetoothservicediscoveryagent_android.cpp b/src/bluetooth/qbluetoothservicediscoveryagent_android.cpp
index f160eb75..8ac1abd0 100644
--- a/src/bluetooth/qbluetoothservicediscoveryagent_android.cpp
+++ b/src/bluetooth/qbluetoothservicediscoveryagent_android.cpp
@@ -400,7 +400,7 @@ void QBluetoothServiceDiscoveryAgentPrivate::populateDiscoveredServices(const QB
if (!uuidFilter.isEmpty()) {
bool match = uuidFilter.contains(serviceInfo.serviceUuid());
match |= uuidFilter.contains(QBluetoothSocketPrivateAndroid::reverseUuid(serviceInfo.serviceUuid()));
- for (const auto &uuid : qAsConst(uuidFilter)) {
+ for (const auto &uuid : std::as_const(uuidFilter)) {
match |= serviceInfo.serviceClassUuids().contains(uuid);
match |= serviceInfo.serviceClassUuids().contains(QBluetoothSocketPrivateAndroid::reverseUuid(uuid));
}
diff --git a/src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp b/src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp
index c3bc4b44..844c79b1 100644
--- a/src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp
+++ b/src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp
@@ -131,7 +131,7 @@ void QBluetoothServiceDiscoveryAgentPrivate::runExternalSdpScan(
// No filter implies PUBLIC_BROWSE_GROUP based SDP scan
if (!uuidFilter.isEmpty()) {
arguments << QLatin1String("-u"); // cmd line option for list of uuids
- for (const QBluetoothUuid& uuid : qAsConst(uuidFilter))
+ for (const QBluetoothUuid& uuid : std::as_const(uuidFilter))
arguments << uuid.toString();
}
diff --git a/src/bluetooth/qbluetoothservicediscoveryagent_winrt.cpp b/src/bluetooth/qbluetoothservicediscoveryagent_winrt.cpp
index 41385547..928dc4b6 100644
--- a/src/bluetooth/qbluetoothservicediscoveryagent_winrt.cpp
+++ b/src/bluetooth/qbluetoothservicediscoveryagent_winrt.cpp
@@ -500,7 +500,7 @@ void QBluetoothServiceDiscoveryAgentPrivate::processFoundService(quint64 deviceA
QBluetoothServiceInfo returnInfo(info);
bool deviceFound;
- for (const QBluetoothDeviceInfo &deviceInfo : qAsConst(discoveredDevices)) {
+ for (const QBluetoothDeviceInfo &deviceInfo : std::as_const(discoveredDevices)) {
if (deviceInfo.address().toUInt64() == deviceAddress) {
deviceFound = true;
returnInfo.setDevice(deviceInfo);
diff --git a/src/bluetooth/qlowenergycharacteristic.cpp b/src/bluetooth/qlowenergycharacteristic.cpp
index 24767c85..d71861c0 100644
--- a/src/bluetooth/qlowenergycharacteristic.cpp
+++ b/src/bluetooth/qlowenergycharacteristic.cpp
@@ -416,7 +416,7 @@ QList<QLowEnergyDescriptor> QLowEnergyCharacteristic::descriptors() const
std::sort(descriptorKeys.begin(), descriptorKeys.end());
- for (const QLowEnergyHandle descHandle : qAsConst(descriptorKeys)) {
+ for (const QLowEnergyHandle descHandle : std::as_const(descriptorKeys)) {
QLowEnergyDescriptor descriptor(d_ptr, data->handle, descHandle);
result.append(descriptor);
}
diff --git a/src/bluetooth/qlowenergycontroller_bluez.cpp b/src/bluetooth/qlowenergycontroller_bluez.cpp
index bc790262..a81ae599 100644
--- a/src/bluetooth/qlowenergycontroller_bluez.cpp
+++ b/src/bluetooth/qlowenergycontroller_bluez.cpp
@@ -1119,7 +1119,7 @@ void QLowEnergyControllerPrivateBluez::processReply(
lastHandle = parseReadByTypeIncludeDiscovery(
&includedServices, &data[offset], elementLength);
p->includedServices = includedServices;
- for (const QBluetoothUuid &uuid : qAsConst(includedServices)) {
+ for (const QBluetoothUuid &uuid : std::as_const(includedServices)) {
if (serviceList.contains(uuid))
serviceList[uuid]->type |= QLowEnergyService::IncludedService;
}
@@ -2514,7 +2514,7 @@ void QLowEnergyControllerPrivateBluez::updateLocalAttributeValue(
QLowEnergyDescriptor &descriptor)
{
localAttributes[handle].value = value;
- for (const auto &service : qAsConst(localServices)) {
+ for (const auto &service : std::as_const(localServices)) {
if (handle < service->startHandle || handle > service->endHandle)
continue;
for (auto charIt = service->characteristicList.begin();
@@ -2560,7 +2560,7 @@ void QLowEnergyControllerPrivateBluez::writeCharacteristicForPeripheral(
= attribute.properties & QLowEnergyCharacteristic::Indicate;
if (!hasNotifyProperty && !hasIndicateProperty)
return;
- for (const QLowEnergyServicePrivate::DescData &desc : qAsConst(charData.descriptorList)) {
+ for (const QLowEnergyServicePrivate::DescData &desc : std::as_const(charData.descriptorList)) {
if (desc.uuid != QBluetoothUuid::DescriptorType::ClientCharacteristicConfiguration)
continue;
@@ -2870,7 +2870,7 @@ void QLowEnergyControllerPrivateBluez::handleExecuteWriteRequest(const QByteArra
QList<QLowEnergyCharacteristic> characteristics;
QList<QLowEnergyDescriptor> descriptors;
if (!cancel) {
- for (const WriteRequest &request : qAsConst(requests)) {
+ for (const WriteRequest &request : std::as_const(requests)) {
Attribute &attribute = localAttributes[request.handle];
if (request.valueOffset > attribute.value.size()) {
sendErrorResponse(static_cast<QBluezConst::AttCommand>(packet.at(0)),
@@ -2901,9 +2901,9 @@ void QLowEnergyControllerPrivateBluez::handleExecuteWriteRequest(const QByteArra
sendPacket(QByteArray(
1, static_cast<quint8>(QBluezConst::AttCommand::ATT_OP_EXECUTE_WRITE_RESPONSE)));
- for (const QLowEnergyCharacteristic &characteristic : qAsConst(characteristics))
+ for (const QLowEnergyCharacteristic &characteristic : std::as_const(characteristics))
emit characteristic.d_ptr->characteristicChanged(characteristic, characteristic.value());
- for (const QLowEnergyDescriptor &descriptor : qAsConst(descriptors))
+ for (const QLowEnergyDescriptor &descriptor : std::as_const(descriptors))
emit descriptor.d_ptr->descriptorWritten(descriptor, descriptor.value());
}
@@ -3084,7 +3084,7 @@ QList<QLowEnergyControllerPrivateBluez::TempClientConfigurationData>
QLowEnergyControllerPrivateBluez::gatherClientConfigData()
{
QList<TempClientConfigurationData> data;
- for (const auto &service : qAsConst(localServices)) {
+ for (const auto &service : std::as_const(localServices)) {
for (auto charIt = service->characteristicList.begin();
charIt != service->characteristicList.end(); ++charIt) {
QLowEnergyServicePrivate::CharData &charData = charIt.value();
@@ -3151,7 +3151,7 @@ void QLowEnergyControllerPrivateBluez::restoreClientConfigurations()
localAttributes[tempConfigData.configHandle].value = tempConfigData.descData->value;
}
- for (const QLowEnergyHandle handle : qAsConst(notifications))
+ for (const QLowEnergyHandle handle : std::as_const(notifications))
sendNotification(handle);
sendNextIndication();
}
diff --git a/src/bluetooth/qlowenergycontroller_bluezdbus.cpp b/src/bluetooth/qlowenergycontroller_bluezdbus.cpp
index e9064aa1..b874945f 100644
--- a/src/bluetooth/qlowenergycontroller_bluezdbus.cpp
+++ b/src/bluetooth/qlowenergycontroller_bluezdbus.cpp
@@ -120,7 +120,7 @@ void QLowEnergyControllerPrivateBluezDBus::devicePropertiesChanged(
// Client Characteristic Notification enabled?
bool cccActive = false;
- for (const QLowEnergyServicePrivate::DescData &descData : qAsConst(charData.descriptorList)) {
+ for (const QLowEnergyServicePrivate::DescData &descData : std::as_const(charData.descriptorList)) {
if (descData.uuid != QBluetoothUuid(QBluetoothUuid::DescriptorType::ClientCharacteristicConfiguration))
continue;
if (descData.value == QByteArray::fromHex("0100")
@@ -662,7 +662,7 @@ void QLowEnergyControllerPrivateBluezDBus::discoverServiceDetails(
}
// descriptor data
- for (const auto &descEntry : qAsConst(dbusChar.descriptors)) {
+ for (const auto &descEntry : std::as_const(dbusChar.descriptors)) {
const QLowEnergyHandle descriptorHandle = runningHandle++;
QLowEnergyServicePrivate::DescData descData;
descData.uuid = QBluetoothUuid(descEntry->uUID());
@@ -953,7 +953,7 @@ void QLowEnergyControllerPrivateBluezDBus::scheduleNextJob()
const QLowEnergyServicePrivate::CharData &charData =
service->characteristicList.value(nextJob.handle);
bool foundChar = false;
- for (const auto &gattChar : qAsConst(dbusServiceData.characteristics)) {
+ for (const auto &gattChar : std::as_const(dbusServiceData.characteristics)) {
if (charData.uuid != QBluetoothUuid(gattChar.characteristic->uUID()))
continue;
@@ -982,7 +982,7 @@ void QLowEnergyControllerPrivateBluezDBus::scheduleNextJob()
const QLowEnergyServicePrivate::CharData &charData =
service->characteristicList.value(nextJob.handle);
bool foundChar = false;
- for (const auto &gattChar : qAsConst(dbusServiceData.characteristics)) {
+ for (const auto &gattChar : std::as_const(dbusServiceData.characteristics)) {
if (charData.uuid != QBluetoothUuid(gattChar.characteristic->uUID()))
continue;
@@ -1024,11 +1024,11 @@ void QLowEnergyControllerPrivateBluezDBus::scheduleNextJob()
const QBluetoothUuid descUuid = charData.descriptorList[nextJob.handle].uuid;
bool foundDesc = false;
- for (const auto &gattChar : qAsConst(dbusServiceData.characteristics)) {
+ for (const auto &gattChar : std::as_const(dbusServiceData.characteristics)) {
if (charData.uuid != QBluetoothUuid(gattChar.characteristic->uUID()))
continue;
- for (const auto &gattDesc : qAsConst(gattChar.descriptors)) {
+ for (const auto &gattDesc : std::as_const(gattChar.descriptors)) {
if (descUuid != QBluetoothUuid(gattDesc->uUID()))
continue;
@@ -1068,11 +1068,11 @@ void QLowEnergyControllerPrivateBluezDBus::scheduleNextJob()
const QBluetoothUuid descUuid = charData.descriptorList[nextJob.handle].uuid;
bool foundDesc = false;
- for (const auto &gattChar : qAsConst(dbusServiceData.characteristics)) {
+ for (const auto &gattChar : std::as_const(dbusServiceData.characteristics)) {
if (charData.uuid != QBluetoothUuid(gattChar.characteristic->uUID()))
continue;
- for (const auto &gattDesc : qAsConst(gattChar.descriptors)) {
+ for (const auto &gattDesc : std::as_const(gattChar.descriptors)) {
if (descUuid != QBluetoothUuid(gattDesc->uUID()))
continue;
diff --git a/src/bluetooth/qlowenergycontroller_winrt.cpp b/src/bluetooth/qlowenergycontroller_winrt.cpp
index e7b87d12..3cebc697 100644
--- a/src/bluetooth/qlowenergycontroller_winrt.cpp
+++ b/src/bluetooth/qlowenergycontroller_winrt.cpp
@@ -847,7 +847,7 @@ void QLowEnergyControllerPrivateWinRT::registerForValueChanges(const QBluetoothU
{
qCDebug(QT_BT_WINDOWS) << "Registering characteristic" << charUuid << "in service"
<< serviceUuid << "for value changes";
- for (const ValueChangedEntry &entry : qAsConst(mValueChangedTokens)) {
+ for (const ValueChangedEntry &entry : std::as_const(mValueChangedTokens)) {
GUID guuid;
HRESULT hr;
hr = entry.characteristic->get_Uuid(&guuid);
@@ -882,7 +882,7 @@ void QLowEnergyControllerPrivateWinRT::unregisterFromValueChanges()
{
qCDebug(QT_BT_WINDOWS) << "Unregistering " << mValueChangedTokens.size() << " value change tokens";
HRESULT hr;
- for (const ValueChangedEntry &entry : qAsConst(mValueChangedTokens)) {
+ for (const ValueChangedEntry &entry : std::as_const(mValueChangedTokens)) {
if (!entry.characteristic) {
qCWarning(QT_BT_WINDOWS) << "Unregistering from value changes for characteristic failed."
<< "Characteristic has been deleted";
@@ -1298,7 +1298,7 @@ void QLowEnergyControllerPrivateWinRT::discoverServiceDetailsHelper(
pointer->endHandle = endHandle;
pointer->characteristicList = charList;
- for (const QBluetoothUuid &indicateChar : qAsConst(indicateChars))
+ for (const QBluetoothUuid &indicateChar : std::as_const(indicateChars))
registerForValueChanges(service, indicateChar);
pointer->setState(QLowEnergyService::RemoteServiceDiscovered);
diff --git a/src/bluetooth/qlowenergyservice.cpp b/src/bluetooth/qlowenergyservice.cpp
index c823c2a0..eee75bd1 100644
--- a/src/bluetooth/qlowenergyservice.cpp
+++ b/src/bluetooth/qlowenergyservice.cpp
@@ -506,7 +506,7 @@ QList<QLowEnergyCharacteristic> QLowEnergyService::characteristics() const
QList<QLowEnergyHandle> handles = d_ptr->characteristicList.keys();
std::sort(handles.begin(), handles.end());
- for (const QLowEnergyHandle &handle : qAsConst(handles)) {
+ for (const QLowEnergyHandle &handle : std::as_const(handles)) {
QLowEnergyCharacteristic characteristic(d_ptr, handle);
results.append(characteristic);
}
diff --git a/src/nfc/android/androidmainnewintentlistener.cpp b/src/nfc/android/androidmainnewintentlistener.cpp
index b110bdf5..307a824a 100644
--- a/src/nfc/android/androidmainnewintentlistener.cpp
+++ b/src/nfc/android/androidmainnewintentlistener.cpp
@@ -30,7 +30,7 @@ bool MainNfcNewIntentListener::handleNewIntent(JNIEnv */*env*/, jobject intent)
return false;
listenersLock.lockForRead();
- for (AndroidNfc::AndroidNfcListenerInterface *listener : qAsConst(listeners)) {
+ for (AndroidNfc::AndroidNfcListenerInterface *listener : std::as_const(listeners)) {
listener->newIntent(QJniObject(intent));
}
listenersLock.unlock();
diff --git a/src/nfc/qnearfieldmanager_android.cpp b/src/nfc/qnearfieldmanager_android.cpp
index bcae71a1..f8c4f1e3 100644
--- a/src/nfc/qnearfieldmanager_android.cpp
+++ b/src/nfc/qnearfieldmanager_android.cpp
@@ -28,7 +28,7 @@ extern "C"
{
QNearFieldManager::AdapterState adapterState = static_cast<QNearFieldManager::AdapterState>((int) state);
- for (const auto listener : qAsConst(*broadcastListener)) {
+ for (const auto listener : std::as_const(*broadcastListener)) {
Q_EMIT listener->adapterStateChanged(adapterState);
}
}
diff --git a/tests/auto/nfccommons/qnearfieldtagtype1.cpp b/tests/auto/nfccommons/qnearfieldtagtype1.cpp
index 11e9ea71..55e25001 100644
--- a/tests/auto/nfccommons/qnearfieldtagtype1.cpp
+++ b/tests/auto/nfccommons/qnearfieldtagtype1.cpp
@@ -244,11 +244,11 @@ void QNearFieldTagType1Private::progressToNextNdefWriteMessageState()
m_tlvWriter = new QTlvWriter(q);
// write old TLVs
- for (const Tlv &tlv : qAsConst(m_tlvs))
+ for (const Tlv &tlv : std::as_const(m_tlvs))
m_tlvWriter->writeTlv(tlv.first, tlv.second);
// write new NDEF message TLVs
- for (const QNdefMessage &message : qAsConst(m_ndefWriteMessages))
+ for (const QNdefMessage &message : std::as_const(m_ndefWriteMessages))
m_tlvWriter->writeTlv(0x03, message.toByteArray());
// write terminator TLV
diff --git a/tests/auto/qbluetoothservicediscoveryagent/tst_qbluetoothservicediscoveryagent.cpp b/tests/auto/qbluetoothservicediscoveryagent/tst_qbluetoothservicediscoveryagent.cpp
index b9e0dfb3..262fac02 100644
--- a/tests/auto/qbluetoothservicediscoveryagent/tst_qbluetoothservicediscoveryagent.cpp
+++ b/tests/auto/qbluetoothservicediscoveryagent/tst_qbluetoothservicediscoveryagent.cpp
@@ -257,7 +257,7 @@ void tst_QBluetoothServiceDiscoveryAgent::tst_serviceDiscovery_data()
// Only need to test the first 5 live devices
int max = 5;
- for (const QBluetoothDeviceInfo &info : qAsConst(devices)) {
+ for (const QBluetoothDeviceInfo &info : std::as_const(devices)) {
if (info.isCached())
continue;
QTest::newRow("default filter") << info << QList<QBluetoothUuid>()
diff --git a/tests/auto/qbluetoothserviceinfo/tst_qbluetoothserviceinfo.cpp b/tests/auto/qbluetoothserviceinfo/tst_qbluetoothserviceinfo.cpp
index f26b9053..fb8b5c4d 100644
--- a/tests/auto/qbluetoothserviceinfo/tst_qbluetoothserviceinfo.cpp
+++ b/tests/auto/qbluetoothserviceinfo/tst_qbluetoothserviceinfo.cpp
@@ -107,7 +107,7 @@ void tst_QBluetoothServiceInfo::tst_construction()
QCOMPARE(serviceInfo.serverChannel(), -1);
QCOMPARE(serviceInfo.protocolServiceMultiplexer(), -1);
- for (QBluetoothUuid::ProtocolUuid u : qAsConst(protUuids))
+ for (QBluetoothUuid::ProtocolUuid u : std::as_const(protUuids))
QCOMPARE(serviceInfo.protocolDescriptor(u).size(), 0);
}
@@ -141,9 +141,9 @@ void tst_QBluetoothServiceInfo::tst_construction()
QCOMPARE(copyInfo.device().address(), alternatedeviceInfo.address());
QCOMPARE(serviceInfo.device().address(), alternatedeviceInfo.address());
- for (QBluetoothUuid::ProtocolUuid u : qAsConst(protUuids))
+ for (QBluetoothUuid::ProtocolUuid u : std::as_const(protUuids))
QCOMPARE(serviceInfo.protocolDescriptor(u).size(), 0);
- for (QBluetoothUuid::ProtocolUuid u : qAsConst(protUuids))
+ for (QBluetoothUuid::ProtocolUuid u : std::as_const(protUuids))
QCOMPARE(copyInfo.protocolDescriptor(u).size(), 0);
}
}
diff --git a/tests/auto/qbluetoothsocket/tst_qbluetoothsocket.cpp b/tests/auto/qbluetoothsocket/tst_qbluetoothsocket.cpp
index 6dbc0359..2784c98c 100644
--- a/tests/auto/qbluetoothsocket/tst_qbluetoothsocket.cpp
+++ b/tests/auto/qbluetoothsocket/tst_qbluetoothsocket.cpp
@@ -362,7 +362,7 @@ void tst_QBluetoothSocket::tst_clientCommunication()
{
/* Send line by line with event loop */
- for (const QString &line : qAsConst(data)) {
+ for (const QString &line : std::as_const(data)) {
QSignalSpy readyReadSpy(&socket, SIGNAL(readyRead()));
QSignalSpy bytesWrittenSpy(&socket, SIGNAL(bytesWritten(qint64)));
diff --git a/tests/auto/qlowenergycharacteristic/tst_qlowenergycharacteristic.cpp b/tests/auto/qlowenergycharacteristic/tst_qlowenergycharacteristic.cpp
index 64bdee2a..32e10b03 100644
--- a/tests/auto/qlowenergycharacteristic/tst_qlowenergycharacteristic.cpp
+++ b/tests/auto/qlowenergycharacteristic/tst_qlowenergycharacteristic.cpp
@@ -99,7 +99,7 @@ void tst_QLowEnergyCharacteristic::initTestCase()
// find first service with descriptor
QLowEnergyController *controller = 0;
- for (const QBluetoothDeviceInfo &remoteDevice : qAsConst(remoteLeDevices)) {
+ for (const QBluetoothDeviceInfo &remoteDevice : std::as_const(remoteLeDevices)) {
controller = QLowEnergyController::createCentral(remoteDevice, this);
qDebug() << "Connecting to" << remoteDevice.name()
<< remoteDevice.address() << remoteDevice.deviceUuid();
diff --git a/tests/auto/qlowenergycontroller/tst_qlowenergycontroller.cpp b/tests/auto/qlowenergycontroller/tst_qlowenergycontroller.cpp
index 5a930dc3..67a9659f 100644
--- a/tests/auto/qlowenergycontroller/tst_qlowenergycontroller.cpp
+++ b/tests/auto/qlowenergycontroller/tst_qlowenergycontroller.cpp
@@ -323,7 +323,7 @@ void tst_QLowEnergyController::tst_connect()
listing.append(v.value<QBluetoothUuid>());
}
- for (const QBluetoothUuid &uuid : qAsConst(foundServices)) {
+ for (const QBluetoothUuid &uuid : std::as_const(foundServices)) {
QVERIFY2(listing.contains(uuid),
uuid.toString().toLatin1());
@@ -342,7 +342,7 @@ void tst_QLowEnergyController::tst_connect()
QBluetoothUuid(QBluetoothUuid::CharacteristicType::DeviceName)));
// initiate characteristic discovery
- for (QLowEnergyService *service : qAsConst(savedReferences)) {
+ for (QLowEnergyService *service : std::as_const(savedReferences)) {
qDebug() << "Discovering" << service->serviceUuid();
QSignalSpy stateSpy(service,
SIGNAL(stateChanged(QLowEnergyService::ServiceState)));
@@ -359,7 +359,7 @@ void tst_QLowEnergyController::tst_connect()
}
// ensure that related service objects share same state
- for (QLowEnergyService* originalService : qAsConst(savedReferences)) {
+ for (QLowEnergyService* originalService : std::as_const(savedReferences)) {
QLowEnergyService *newService = control->createServiceObject(
originalService->serviceUuid());
QVERIFY(newService);
@@ -379,7 +379,7 @@ void tst_QLowEnergyController::tst_connect()
} else {
QCOMPARE(disconnectedSpy.size(), 1);
// after disconnect all service references must be invalid
- for (const QLowEnergyService *entry : qAsConst(savedReferences)) {
+ for (const QLowEnergyService *entry : std::as_const(savedReferences)) {
const QBluetoothUuid &uuid = entry->serviceUuid();
QVERIFY2(entry->state() == QLowEnergyService::InvalidService,
uuid.toString().toLatin1());
diff --git a/tests/auto/qlowenergydescriptor/tst_qlowenergydescriptor.cpp b/tests/auto/qlowenergydescriptor/tst_qlowenergydescriptor.cpp
index 535bf89a..b3046a52 100644
--- a/tests/auto/qlowenergydescriptor/tst_qlowenergydescriptor.cpp
+++ b/tests/auto/qlowenergydescriptor/tst_qlowenergydescriptor.cpp
@@ -86,7 +86,7 @@ void tst_QLowEnergyDescriptor::initTestCase()
// find first service with descriptor
QLowEnergyController *controller = nullptr;
- for (const QBluetoothDeviceInfo& remoteDeviceInfo : qAsConst(remoteLeDeviceInfos)) {
+ for (const QBluetoothDeviceInfo& remoteDeviceInfo : std::as_const(remoteLeDeviceInfos)) {
controller = QLowEnergyController::createCentral(remoteDeviceInfo, this);
qDebug() << "Connecting to" << remoteDeviceInfo.address();
controller->connectToDevice();
diff --git a/tests/bttestui/btlocaldevice.cpp b/tests/bttestui/btlocaldevice.cpp
index 16f5bc98..1ca31176 100644
--- a/tests/bttestui/btlocaldevice.cpp
+++ b/tests/bttestui/btlocaldevice.cpp
@@ -300,7 +300,7 @@ void BtLocalDevice::serviceDiscovered(const QBluetoothServiceInfo &info)
{
//This is here to detect the test server for SPP testing later on
bool alreadyKnown = false;
- for (const QBluetoothServiceInfo& found : qAsConst(foundTestServers)) {
+ for (const QBluetoothServiceInfo& found : std::as_const(foundTestServers)) {
if (found.device().address() == info.device().address()) {
alreadyKnown = true;
break;
@@ -354,7 +354,7 @@ void BtLocalDevice::dumpServiceDiscovery()
}
qDebug() << "###### TestServer offered by:";
- for (const QBluetoothServiceInfo& found : qAsConst(foundTestServers)) {
+ for (const QBluetoothServiceInfo& found : std::as_const(foundTestServers)) {
qDebug() << found.device().name() << found.device().address().toString();
}
}
@@ -690,7 +690,7 @@ void BtLocalDevice::dumpServerInformation()
//server->setSecurityFlags(secFlag);
- for (const QBluetoothSocket *client : qAsConst(serverSockets)) {
+ for (const QBluetoothSocket *client : std::as_const(serverSockets)) {
qDebug() << "##" << client->localAddress().toString()
<< client->localName() << client->localPort();
qDebug() << "##" << client->peerAddress().toString()