Use qAsConst in ranged based for loops.

This commit is contained in:
Andrius Štikonas 2017-06-04 22:19:55 +01:00
parent dc4ea192b3
commit 3228fa081a
3 changed files with 6 additions and 6 deletions

View File

@ -80,7 +80,7 @@ void DeviceScanner::scan()
// Store list of physical volumes in LvmDevice // Store list of physical volumes in LvmDevice
for (const auto &d : lvmList) for (const auto &d : lvmList)
for (const auto &p : LVM::pvList) // FIXME: qAsConst for (const auto &p : qAsConst(LVM::pvList))
if (p.vgName() == d->name()) if (p.vgName() == d->name())
d->physicalVolumes().append(p.partition()); d->physicalVolumes().append(p.partition());
} }

View File

@ -279,7 +279,7 @@ bool luks::cryptOpen(QWidget* parent, const QString& deviceNode)
if (!m_isCryptOpen) if (!m_isCryptOpen)
return false; return false;
for (auto &p : LVM::pvList) // FIXME: qAsConst for (auto &p : LVM::pvList)
if (p.isLuks() && p.partition()->deviceNode() == deviceNode && p.partition()->fileSystem().type() == FileSystem::Lvm2_PV) if (p.isLuks() && p.partition()->deviceNode() == deviceNode && p.partition()->fileSystem().type() == FileSystem::Lvm2_PV)
p.setLuks(false); p.setLuks(false);
@ -318,7 +318,7 @@ bool luks::cryptClose(const QString& deviceNode)
m_isCryptOpen = (m_innerFs != nullptr); m_isCryptOpen = (m_innerFs != nullptr);
for (auto &p : LVM::pvList) // FIXME: qAsConst for (auto &p : LVM::pvList)
if (!p.isLuks() && p.partition()->deviceNode() == deviceNode) if (!p.isLuks() && p.partition()->deviceNode() == deviceNode)
p.setLuks(true); p.setLuks(true);

View File

@ -66,20 +66,20 @@ ResizeVolumeGroupOperation::ResizeVolumeGroupOperation(LvmDevice& d, const QList
currentFreePE += lvm2PVFs->freePE(); currentFreePE += lvm2PVFs->freePE();
} }
qint64 removedFreePE = 0; qint64 removedFreePE = 0;
for (const auto &p : toRemoveList) { // FIXME: qAsConst for (const auto &p : qAsConst(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 : toRemoveList) { // FIXME: qAsConst for (const auto &p : qAsConst(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 : toInsertList) { // FIXME: qAsConst for (const auto &p : qAsConst(toInsertList)) {
growPE += p->capacity() / device().peSize(); growPE += p->capacity() / device().peSize();
} }