Port away from qAsConst.
This commit is contained in:
parent
7e8ae5b140
commit
19f78ef76a
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
SPDX-FileCopyrightText: 2016 Chantara Tith <tith.chantara@gmail.com>
|
||||
SPDX-FileCopyrightText: 2016-2019 Andrius Štikonas <andrius@stikonas.eu>
|
||||
SPDX-FileCopyrightText: 2016-2020 Andrius Štikonas <andrius@stikonas.eu>
|
||||
SPDX-FileCopyrightText: 2018 Caio Jordão Carvalho <caiojcarvalho@gmail.com>
|
||||
SPDX-FileCopyrightText: 2019 Yuri Chornoivan <yurchor@ukr.net>
|
||||
|
||||
|
@ -21,6 +21,8 @@
|
|||
#include "util/globallog.h"
|
||||
#include "util/report.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include <QRegularExpression>
|
||||
#include <QStorageInfo>
|
||||
#include <QtMath>
|
||||
|
@ -215,7 +217,7 @@ void LvmDevice::scanSystemLVM(QList<Device*>& devices)
|
|||
|
||||
// Inform LvmDevice about which physical volumes form that particular LvmDevice
|
||||
for (const auto &d : lvmList)
|
||||
for (const auto &p : qAsConst(LVM::pvList::list()))
|
||||
for (const auto &p : std::as_const(LVM::pvList::list()))
|
||||
if (p.vgName() == d->name())
|
||||
d->physicalVolumes().append(p.partition());
|
||||
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
|
||||
#include "util/globallog.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include <KLocalizedString>
|
||||
|
||||
#include <QDebug>
|
||||
|
@ -592,7 +594,7 @@ QTextStream& operator<<(QTextStream& stream, const PartitionTable& ptable)
|
|||
|
||||
std::sort(partitions.begin(), partitions.end(), [](const Partition* p1, const Partition* p2) { return p1->number() < p2->number(); });
|
||||
|
||||
for (const auto &p : qAsConst(partitions))
|
||||
for (const auto &p : std::as_const(partitions))
|
||||
stream << *p;
|
||||
|
||||
return stream;
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
#include "fs/filesystemfactory.h"
|
||||
#include "util/externalcommand.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include <KLocalizedString>
|
||||
#include <QFile>
|
||||
#include <QRegularExpression>
|
||||
|
@ -221,7 +223,7 @@ void SoftwareRAID::scanSoftwareRAID(QList<Device*>& devices)
|
|||
}
|
||||
}
|
||||
|
||||
for (const QString& name : qAsConst(availableInConf)) {
|
||||
for (const QString& name : std::as_const(availableInConf)) {
|
||||
SoftwareRAID *raidDevice = new SoftwareRAID(name, SoftwareRAID::Status::Inactive);
|
||||
devices << raidDevice;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
SPDX-FileCopyrightText: 2008 Lennart Poettering
|
||||
SPDX-FileCopyrightText: 2018 Caio Jordão Carvalho <caiojcarvalho@gmail.com>
|
||||
SPDX-FileCopyrightText: 2018-2019 Andrius Štikonas <andrius@stikonas.eu>
|
||||
SPDX-FileCopyrightText: 2018-2020 Andrius Štikonas <andrius@stikonas.eu>
|
||||
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
@ -9,6 +9,8 @@
|
|||
#include "smartattributeparseddata.h"
|
||||
#include "core/smartdiskinformation.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include <QJsonObject>
|
||||
#include <QMap>
|
||||
#include <QRegularExpression>
|
||||
|
@ -615,7 +617,7 @@ static SmartQuirk getQuirk(QString model, QString firmware)
|
|||
QRegularExpression modelRegex;
|
||||
QRegularExpression firmwareRegex;
|
||||
|
||||
for (const SmartAttributeParsedData::SmartQuirkDataBase &item : qAsConst(db)) {
|
||||
for (const SmartAttributeParsedData::SmartQuirkDataBase &item : std::as_const(db)) {
|
||||
if (!item.model.isEmpty()) {
|
||||
modelRegex.setPattern(item.model);
|
||||
QRegularExpressionMatch match = modelRegex.match(model);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
SPDX-FileCopyrightText: 2018 Caio Jordão Carvalho <caiojcarvalho@gmail.com>
|
||||
SPDX-FileCopyrightText: 2018-2019 Andrius Štikonas <andrius@stikonas.eu>
|
||||
SPDX-FileCopyrightText: 2018-2020 Andrius Štikonas <andrius@stikonas.eu>
|
||||
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
@ -9,6 +9,7 @@
|
|||
#include "core/smartattributeparseddata.h"
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
static quint64 u64log2(quint64 n);
|
||||
|
||||
|
@ -145,7 +146,7 @@ bool SmartDiskInformation::updatePowerCycle()
|
|||
/** Validate disk attributes status */
|
||||
void SmartDiskInformation::validateBadAttributes()
|
||||
{
|
||||
for (const SmartAttributeParsedData &attribute : qAsConst(m_Attributes)) {
|
||||
for (const SmartAttributeParsedData &attribute : std::as_const(m_Attributes)) {
|
||||
if (attribute.prefailure()) {
|
||||
if (attribute.goodNowValid() && !attribute.goodNow())
|
||||
m_BadAttributeNow = true;
|
||||
|
@ -161,7 +162,7 @@ void SmartDiskInformation::validateBadAttributes()
|
|||
SmartAttributeParsedData *SmartDiskInformation::findAttribute(quint32 id)
|
||||
{
|
||||
SmartAttributeParsedData *attr = nullptr;
|
||||
for (const SmartAttributeParsedData &attribute : qAsConst(m_Attributes)) {
|
||||
for (const SmartAttributeParsedData &attribute : std::as_const(m_Attributes)) {
|
||||
if (id == attribute.id()) {
|
||||
attr = new SmartAttributeParsedData(attribute);
|
||||
break;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
SPDX-FileCopyrightText: 2018 Caio Jordão Carvalho <caiojcarvalho@gmail.com>
|
||||
SPDX-FileCopyrightText: 2020 Andrius Štikonas <andrius@stikonas.eu>
|
||||
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
@ -12,6 +13,7 @@
|
|||
#include "util/externalcommand.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <utility>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QJsonArray>
|
||||
|
@ -147,7 +149,7 @@ void SmartParser::loadAttributes()
|
|||
return;
|
||||
}
|
||||
|
||||
for (const QJsonValue &value : qAsConst(attributeArray)) {
|
||||
for (const QJsonValue &value : std::as_const(attributeArray)) {
|
||||
SmartAttributeParsedData parsedObject(m_DiskInformation, value.toObject());
|
||||
m_DiskInformation->addAttribute(parsedObject);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
SPDX-FileCopyrightText: 2010 Volker Lanz <vl@fidra.de>
|
||||
SPDX-FileCopyrightText: 2010 Yuri Chornoivan <yurchor@ukr.net>
|
||||
SPDX-FileCopyrightText: 2014-2019 Andrius Štikonas <andrius@stikonas.eu>
|
||||
SPDX-FileCopyrightText: 2014-2020 Andrius Štikonas <andrius@stikonas.eu>
|
||||
SPDX-FileCopyrightText: 2015-2016 Teo Mrnjavac <teo@kde.org>
|
||||
SPDX-FileCopyrightText: 2018 Caio Jordão Carvalho <caiojcarvalho@gmail.com>
|
||||
SPDX-FileCopyrightText: 2019 Shubham Jangra <aryan100jangid@gmail.com>
|
||||
|
@ -22,6 +22,7 @@
|
|||
#include <QStringList>
|
||||
|
||||
#include <errno.h>
|
||||
#include <utility>
|
||||
|
||||
SmartStatus::SmartStatus(const QString &device_path) :
|
||||
m_DevicePath(device_path),
|
||||
|
@ -144,7 +145,7 @@ void SmartStatus::addAttributes(QList<SmartAttributeParsedData> attr)
|
|||
{
|
||||
m_Attributes.clear();
|
||||
|
||||
for (const SmartAttributeParsedData &at : qAsConst(attr)) {
|
||||
for (const SmartAttributeParsedData &at : std::as_const(attr)) {
|
||||
SmartAttribute sm(at);
|
||||
m_Attributes.append(sm);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
SPDX-FileCopyrightText: 2008-2010 Volker Lanz <vl@fidra.de>
|
||||
SPDX-FileCopyrightText: 2012-2019 Andrius Štikonas <andrius@stikonas.eu>
|
||||
SPDX-FileCopyrightText: 2012-2020 Andrius Štikonas <andrius@stikonas.eu>
|
||||
SPDX-FileCopyrightText: 2015-2016 Teo Mrnjavac <teo@kde.org>
|
||||
SPDX-FileCopyrightText: 2017 Pali Rohár <pali.rohar@gmail.com>
|
||||
SPDX-FileCopyrightText: 2019 Shubham Jangra <aryan100jangid@gmail.com>
|
||||
|
@ -10,6 +10,8 @@
|
|||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "fs/filesystemfactory.h"
|
||||
#include "fs/filesystem.h"
|
||||
|
||||
|
@ -92,7 +94,7 @@ void FileSystemFactory::init()
|
|||
fileSystems.insert(FileSystem::Type::Xfs, new FS::xfs(-1, -1, -1, QString()));
|
||||
fileSystems.insert(FileSystem::Type::Zfs, new FS::zfs(-1, -1, -1, QString()));
|
||||
|
||||
for (const auto &fs : qAsConst(fileSystems))
|
||||
for (const auto &fs : std::as_const(fileSystems))
|
||||
fs->init();
|
||||
|
||||
qDeleteAll(m_FileSystems);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
SPDX-FileCopyrightText: 2016 Chantara Tith <tith.chantara@gmail.com>
|
||||
SPDX-FileCopyrightText: 2016-2018 Andrius Štikonas <andrius@stikonas.eu>
|
||||
SPDX-FileCopyrightText: 2016-2020 Andrius Štikonas <andrius@stikonas.eu>
|
||||
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
@ -14,6 +14,8 @@
|
|||
#include "jobs/movephysicalvolumejob.h"
|
||||
#include "util/helpers.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include <QString>
|
||||
|
||||
#include <KLocalizedString>
|
||||
|
@ -55,20 +57,20 @@ ResizeVolumeGroupOperation::ResizeVolumeGroupOperation(LvmDevice& d, const QVect
|
|||
currentFreePE += lvm2PVFs->freePE();
|
||||
}
|
||||
qint64 removedFreePE = 0;
|
||||
for (const auto &p : qAsConst(toRemoveList)) {
|
||||
for (const auto &p : std::as_const(toRemoveList)) {
|
||||
FS::lvm2_pv *lvm2PVFs;
|
||||
innerFS(p, lvm2PVFs);
|
||||
removedFreePE += lvm2PVFs->freePE();
|
||||
}
|
||||
qint64 freePE = currentFreePE - removedFreePE;
|
||||
qint64 movePE = 0;
|
||||
for (const auto &p : qAsConst(toRemoveList)) {
|
||||
for (const auto &p : std::as_const(toRemoveList)) {
|
||||
FS::lvm2_pv *lvm2PVFs;
|
||||
innerFS(p, lvm2PVFs);
|
||||
movePE += lvm2PVFs->allocatedPE();
|
||||
}
|
||||
qint64 growPE = 0;
|
||||
for (const auto &p : qAsConst(toInsertList)) {
|
||||
for (const auto &p : std::as_const(toInsertList)) {
|
||||
growPE += p->capacity() / device().peSize();
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,8 @@
|
|||
#include "util/externalcommand.h"
|
||||
#include "util/helpers.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include <QDataStream>
|
||||
#include <QDebug>
|
||||
#include <QFile>
|
||||
|
@ -278,7 +280,7 @@ Device* SfdiskBackend::scanDevice(const QString& deviceNode)
|
|||
{
|
||||
QList<Device *> availableDevices = scanDevices();
|
||||
|
||||
for (Device *device : qAsConst(availableDevices))
|
||||
for (Device *device : std::as_const(availableDevices))
|
||||
if (device->deviceNode() == deviceNode)
|
||||
return device;
|
||||
}
|
||||
|
@ -340,7 +342,7 @@ void SfdiskBackend::scanDevicePartitions(Device& d, const QJsonArray& jsonPartit
|
|||
if (d.partitionTable()->isSectorBased(d))
|
||||
d.partitionTable()->setType(d, PartitionTable::msdos_sectorbased);
|
||||
|
||||
for (const Partition *part : qAsConst(partitions))
|
||||
for (const Partition *part : std::as_const(partitions))
|
||||
PartitionAlignment::isAligned(d, *part);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue