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