diff --git a/src/core/devicescanner.cpp b/src/core/devicescanner.cpp index 4bb8d49..04dd0d8 100644 --- a/src/core/devicescanner.cpp +++ b/src/core/devicescanner.cpp @@ -65,10 +65,10 @@ void DeviceScanner::scan() const QList deviceList = CoreBackendManager::self()->backend()->scanDevices(); const QList lvmList = LvmDevice::scanSystemLVM(); - for (Device * d : deviceList) + for (auto const &d : deviceList) operationStack().addDevice(d); - for (Device * d : lvmList) + for (auto const &d : lvmList) operationStack().addDevice(d); operationStack().sortDevices(); diff --git a/src/core/lvmdevice.cpp b/src/core/lvmdevice.cpp index b8b18ff..3647ae4 100644 --- a/src/core/lvmdevice.cpp +++ b/src/core/lvmdevice.cpp @@ -71,7 +71,7 @@ void LvmDevice::initPartitions() qint64 lastusable = totalPE() - 1; PartitionTable* pTable = new PartitionTable(PartitionTable::vmd, firstUsable, lastusable); - for (Partition* p : scanPartitions(pTable)) { + for (const auto &p : scanPartitions(pTable)) { LVSizeMap()->insert(p->partitionPath(), p->length()); pTable->append(p); } @@ -87,7 +87,7 @@ void LvmDevice::initPartitions() const QList LvmDevice::scanPartitions(PartitionTable* pTable) const { QList pList; - for (QString lvPath : lvPathList()) { + for (const auto &lvPath : lvPathList()) { pList.append(scanPartition(lvPath, pTable)); } return pList; @@ -184,7 +184,7 @@ Partition* LvmDevice::scanPartition(const QString& lvpath, PartitionTable* pTabl QList LvmDevice::scanSystemLVM() { QList lvmList; - for (QString vgname : getVGs()) { + for (const auto &vgname : getVGs()) { lvmList.append(new LvmDevice(vgname)); } return lvmList; @@ -221,7 +221,7 @@ const QStringList LvmDevice::getVGs() QString output = getField(QStringLiteral("vg_name")); if (!output.isEmpty()) { const QStringList vgnameList = output.split(QStringLiteral("\n"), QString::SkipEmptyParts); - for (QString vgname : vgnameList) { + for (const auto &vgname : vgnameList) { vgList.append(vgname.trimmed()); } } @@ -235,7 +235,7 @@ QStringList LvmDevice::getPVs(const QString& vgname) if (cmdOutput.size()) { const QStringList tempPathList = cmdOutput.split(QStringLiteral("\n"), QString::SkipEmptyParts); - for (QString devPath : tempPathList) { + for (const auto &devPath : tempPathList) { devPathList.append(devPath.trimmed()); } } @@ -249,7 +249,7 @@ QStringList LvmDevice::getLVs(const QString& vgname) if (cmdOutput.size()) { const QStringList tempPathList = cmdOutput.split(QStringLiteral("\n"), QString::SkipEmptyParts); - for (QString lvPath : tempPathList) { + for (const auto &lvPath : tempPathList) { lvPathList.append(lvPath.trimmed()); } } @@ -424,7 +424,7 @@ bool LvmDevice::movePV(Report& report, LvmDevice& dev, const QString& pvPath, co args << QStringLiteral("pvmove"); args << pvPath; if (!destinations.isEmpty()) { - for (QString destPath : destinations) { + for (const auto &destPath : destinations) { args << destPath.trimmed(); } } @@ -438,7 +438,7 @@ bool LvmDevice::createVG(Report& report, const QString vgname, const QStringList QStringList args = QStringList(); args << QStringLiteral("vgcreate") << QStringLiteral("--physicalextentsize") << QString::number(peSize); args << vgname; - for (QString pvnode : pvlist) { + for (const auto &pvnode : pvlist) { args << pvnode.trimmed(); } ExternalCommand cmd(report, QStringLiteral("lvm"), args); diff --git a/src/core/operationrunner.cpp b/src/core/operationrunner.cpp index 68d537a..1fb4edd 100644 --- a/src/core/operationrunner.cpp +++ b/src/core/operationrunner.cpp @@ -96,7 +96,7 @@ qint32 OperationRunner::numJobs() const { qint32 result = 0; - for (const Operation * op : operationStack().operations()) + for (auto const &op : operationStack().operations()) result += op->jobs().size(); return result; diff --git a/src/core/operationstack.cpp b/src/core/operationstack.cpp index d7c06bf..3c97e93 100644 --- a/src/core/operationstack.cpp +++ b/src/core/operationstack.cpp @@ -457,7 +457,7 @@ bool OperationStack::contains(const Partition* p) const { Q_ASSERT(p); - for (Operation * o : operations()) { + for (auto const &o : operations()) { if (o->targets(*p)) return true; @@ -499,19 +499,19 @@ void OperationStack::clearDevices() @param p pointer to the Partition to find a Device for @return the Device or nullptr if none could be found */ -Device* OperationStack::findDeviceForPartition(const Partition* p) +const Device* OperationStack::findDeviceForPartition(const Partition* p) { QReadLocker lockDevices(&lock()); - foreach(Device * d, previewDevices()) { + foreach(const Device *d, previewDevices()) { if (d->partitionTable() == nullptr) continue; - foreach(const Partition * part, d->partitionTable()->children()) { + for (auto const &part : d->partitionTable()->children()) { if (part == p) return d; - for (const Partition * child : part->children()) + for (auto const &child : part->children()) if (child == p) return d; } diff --git a/src/core/operationstack.h b/src/core/operationstack.h index b6fbfac..70bf94f 100644 --- a/src/core/operationstack.h +++ b/src/core/operationstack.h @@ -81,7 +81,7 @@ public: return m_Operations; /**< @return the list of operations */ } - Device* findDeviceForPartition(const Partition* p); + const Device* findDeviceForPartition(const Partition* p); QReadWriteLock& lock() { return m_Lock; diff --git a/src/core/partition.cpp b/src/core/partition.cpp index 78284fa..99bc35d 100644 --- a/src/core/partition.cpp +++ b/src/core/partition.cpp @@ -106,7 +106,7 @@ Partition::Partition(const Partition& other) : m_State(other.m_State) { setPartitionPath(other.m_PartitionPath); - for (const Partition * child : other.children()) { + for (auto const &child : other.children()) { Partition* p = new Partition(*child); p->setParent(this); m_Children.append(p); @@ -121,7 +121,7 @@ Partition& Partition::operator=(const Partition& other) clearChildren(); - for (const Partition * child : other.children()) { + for (auto const &child : other.children()) { Partition* p = new Partition(*child); p->setParent(this); m_Children.append(p); @@ -179,7 +179,7 @@ qint64 Partition::sectorsUsed() const return fileSystem().sectorsUsed(); qint64 result = 0; - for (const Partition * p : children()) + for (auto const &p : children()) if (!p->roles().has(PartitionRole::Unallocated)) result += p->length(); @@ -215,7 +215,7 @@ void Partition::adjustLogicalNumbers(qint32 deletedNumber, qint32 insertedNumber if (!roles().has(PartitionRole::Extended)) return; - foreach(Partition * p, children()) { + foreach(auto const &p, children()) { QString path = p->partitionPath(); path.remove(QRegularExpression(QStringLiteral("(\\d+$)"))); if (deletedNumber > 4 && p->number() > deletedNumber) @@ -230,7 +230,7 @@ qint64 Partition::maxFirstSector() const { qint64 rval = -1; - for (const Partition * child : children()) + for (auto const &child : children()) if (!child->roles().has(PartitionRole::Unallocated) && (child->firstSector() < rval || rval == -1)) rval = child->firstSector(); @@ -242,7 +242,7 @@ qint64 Partition::minLastSector() const { qint64 rval = -1; - for (const Partition * child : children()) + for (auto const &child : children()) if (!child->roles().has(PartitionRole::Unallocated) && child->lastSector() > rval) rval = child->lastSector(); @@ -252,7 +252,7 @@ qint64 Partition::minLastSector() const /** @return true if the Partition has children */ bool Partition::hasChildren() const { - for (const Partition * child : children()) + for (auto const &child : children()) if (!child->roles().has(PartitionRole::Unallocated)) return true; @@ -365,7 +365,7 @@ QTextStream& operator<<(QTextStream& stream, const Partition& p) { QStringList flagList; - for (const PartitionTable::Flag & f : PartitionTable::flagList()) { + for (auto const &f : PartitionTable::flagList()) { if (p.activeFlags() & f) flagList.append(PartitionTable::flagName(f)); } diff --git a/src/core/partitionnode.cpp b/src/core/partitionnode.cpp index b9245f6..611b161 100644 --- a/src/core/partitionnode.cpp +++ b/src/core/partitionnode.cpp @@ -139,9 +139,9 @@ void PartitionNode::clearChildren() */ Partition* PartitionNode::findPartitionBySector(qint64 s, const PartitionRole& role) { - foreach(Partition * p, children()) { + foreach(auto & p, children()) { // (women and) children first. ;-) - foreach(Partition * child, p->children()) + foreach(auto &child, p->children()) if ((child->roles().roles() & role.roles()) && s >= child->firstSector() && s <= child->lastSector()) return child; @@ -157,8 +157,8 @@ Partition* PartitionNode::findPartitionBySector(qint64 s, const PartitionRole& r */ const Partition* PartitionNode::findPartitionBySector(qint64 s, const PartitionRole& role) const { - for (const Partition * p : children()) { - for (const Partition * child : p->children()) + for (const auto *p : children()) { + for (auto const &child : p->children()) if ((child->roles().roles() & role.roles()) && s >= child->firstSector() && s <= child->lastSector()) return child; @@ -190,7 +190,7 @@ qint32 PartitionNode::highestMountedChild() const { qint32 result = -1; - for (const Partition * p : children()) + for (const auto * p : children()) if (p->number() > result && p->isMounted()) result = p->number(); @@ -200,7 +200,7 @@ qint32 PartitionNode::highestMountedChild() const /** @return true if any of the partition's children are mounted */ bool PartitionNode::isChildMounted() const { - for (const Partition * child : children()) + for (const auto * child : children()) if (child->isMounted() || (child->hasChildren() && child->isChildMounted())) return true; diff --git a/src/core/partitiontable.cpp b/src/core/partitiontable.cpp index 47c6a03..2ab1419 100644 --- a/src/core/partitiontable.cpp +++ b/src/core/partitiontable.cpp @@ -92,7 +92,7 @@ qint64 PartitionTable::freeSectorsAfter(const Partition& p) const qint64 PartitionTable::freeSectors() const { qint64 sectors = 0; - for (const Partition * p : children()) { + for (auto const &p : children()) { if (p->roles().has(PartitionRole::Unallocated)) { sectors += p->length(); } @@ -104,8 +104,8 @@ qint64 PartitionTable::freeSectors() const /** @return true if the PartitionTable has an extended Partition */ bool PartitionTable::hasExtended() const { - for (int i = 0; i < children().size(); i++) - if (children()[i]->roles().has(PartitionRole::Extended)) + for (auto const &p : children()) + if (p->roles().has(PartitionRole::Extended)) return true; return false; @@ -114,9 +114,9 @@ bool PartitionTable::hasExtended() const /** @return pointer to the PartitionTable's extended Partition or nullptr if none exists */ Partition* PartitionTable::extended() const { - for (int i = 0; i < children().size(); i++) - if (children()[i]->roles().has(PartitionRole::Extended)) - return children()[i]; + for (auto const &p : children()) + if (p->roles().has(PartitionRole::Extended)) + return p; return nullptr; } @@ -142,7 +142,7 @@ int PartitionTable::numPrimaries() const { int result = 0; - for (const Partition * p : children()) + for (auto const &p : children()) if (p->roles().has(PartitionRole::Primary) || p->roles().has(PartitionRole::Extended)) result++; @@ -360,7 +360,7 @@ void PartitionTable::insertUnallocated(const Device& d, PartitionNode* p, qint64 if (d.type() == Device::LVM_Device && !p->children().isEmpty()) { // rearranging all the partitions sector to keep all the unallocated space at the end lastEnd = 0; - for (Partition* child : children()) { + for (auto &child : children()) { qint64 totalSector = child->length(); child->setFirstSector(lastEnd); child->setLastSector(lastEnd + totalSector - 1); @@ -368,7 +368,7 @@ void PartitionTable::insertUnallocated(const Device& d, PartitionNode* p, qint64 lastEnd += totalSector; } } else { - foreach(Partition * child, p->children()) { + foreach(auto &child, p->children()) { p->insert(createUnallocated(d, *p, lastEnd, child->firstSector() - 1)); if (child->roles().has(PartitionRole::Extended)) @@ -444,45 +444,45 @@ static struct { PartitionTable::TableType PartitionTable::nameToTableType(const QString& n) { - for (size_t i = 0; i < sizeof(tableTypes) / sizeof(tableTypes[0]); i++) - if (n == tableTypes[i].name) - return tableTypes[i].type; + for (const auto &type : tableTypes) + if (n == type.name) + return type.type; return PartitionTable::unknownTableType; } QString PartitionTable::tableTypeToName(TableType l) { - for (size_t i = 0; i < sizeof(tableTypes) / sizeof(tableTypes[0]); i++) - if (l == tableTypes[i].type) - return tableTypes[i].name; + for (const auto &type : tableTypes) + if (l == type.type) + return type.name; return xi18nc("@item partition table name", "unknown"); } qint64 PartitionTable::maxPrimariesForTableType(TableType l) { - for (size_t i = 0; i < sizeof(tableTypes) / sizeof(tableTypes[0]); i++) - if (l == tableTypes[i].type) - return tableTypes[i].maxPrimaries; + for (const auto &type : tableTypes) + if (l == type.type) + return type.maxPrimaries; return 1; } bool PartitionTable::tableTypeSupportsExtended(TableType l) { - for (size_t i = 0; i < sizeof(tableTypes) / sizeof(tableTypes[0]); i++) - if (l == tableTypes[i].type) - return tableTypes[i].canHaveExtended; + for (const auto &type : tableTypes) + if (l == type.type) + return type.canHaveExtended; return false; } bool PartitionTable::tableTypeIsReadOnly(TableType l) { - for (size_t i = 0; i < sizeof(tableTypes) / sizeof(tableTypes[0]); i++) - if (l == tableTypes[i].type) - return tableTypes[i].isReadOnly; + for (const auto &type : tableTypes) + if (l == type.type) + return type.isReadOnly; return false; } @@ -506,7 +506,7 @@ bool PartitionTable::isSectorBased(const Device& d) const // see if we have more cylinder aligned partitions than sector // aligned ones. - for (const Partition * p : children()) { + for (const auto &p : children()) { if (p->firstSector() % PartitionAlignment::sectorAlignment(diskDevice) == 0) numSectorAligned++; else if (p->firstSector() % diskDevice.cylinderSize() == 0) @@ -544,12 +544,12 @@ QTextStream& operator<<(QTextStream& stream, const PartitionTable& ptable) QList partitions; - for (const Partition * p : ptable.children()) { + for (auto const &p : ptable.children()) { if (!p->roles().has(PartitionRole::Unallocated)) { partitions.append(p); if (p->roles().has(PartitionRole::Extended)) - for (const Partition * child : p->children()) { + for (auto const &child : p->children()) { if (!child->roles().has(PartitionRole::Unallocated)) partitions.append(child); } @@ -558,7 +558,7 @@ QTextStream& operator<<(QTextStream& stream, const PartitionTable& ptable) qSort(partitions.begin(), partitions.end(), isPartitionLessThan); - foreach(const Partition * p, partitions) + foreach(auto const &p, partitions) stream << *p; return stream; diff --git a/src/core/volumemanagerdevice.cpp b/src/core/volumemanagerdevice.cpp index 41678c4..ac392ea 100644 --- a/src/core/volumemanagerdevice.cpp +++ b/src/core/volumemanagerdevice.cpp @@ -37,7 +37,7 @@ VolumeManagerDevice::VolumeManagerDevice(const QString& name, QString VolumeManagerDevice::prettyDeviceNodeList() const { QString rval; - for (QString devNode : deviceNodeList()) { + for (const auto &devNode : deviceNodeList()) { rval += devNode + QStringLiteral(","); } diff --git a/src/fs/filesystemfactory.cpp b/src/fs/filesystemfactory.cpp index 312b07b..ebc70d2 100644 --- a/src/fs/filesystemfactory.cpp +++ b/src/fs/filesystemfactory.cpp @@ -84,9 +84,8 @@ void FileSystemFactory::init() m_FileSystems.insert(FileSystem::Xfs, new FS::xfs(-1, -1, -1, QString())); m_FileSystems.insert(FileSystem::Zfs, new FS::zfs(-1, -1, -1, QString())); - for (FileSystem * fs : FileSystemFactory::map()) { + for (const auto &fs : FileSystemFactory::map()) fs->init(); - } CoreBackendManager::self()->backend()->initFSSupport(); } diff --git a/src/fs/lvm2_pv.cpp b/src/fs/lvm2_pv.cpp index 0ebd9d0..34b3c5a 100644 --- a/src/fs/lvm2_pv.cpp +++ b/src/fs/lvm2_pv.cpp @@ -205,7 +205,7 @@ qint64 lvm2_pv::getTotalPE(const QString& deviceNode) qint64 lvm2_pv::getTotalPE(const QStringList& deviceNodeList) { qint64 sum = 0; - for (QString deviceNode : deviceNodeList) { + for (const auto &deviceNode : deviceNodeList) { qint64 totalPE = getTotalPE(deviceNode); if (totalPE < 0) { sum = -1; diff --git a/src/gui/partwidget.cpp b/src/gui/partwidget.cpp index f0a3667..a66023d 100644 --- a/src/gui/partwidget.cpp +++ b/src/gui/partwidget.cpp @@ -56,13 +56,13 @@ void PartWidget::init(const Partition* p) void PartWidget::updateChildren() { if (partition()) { - foreach(QWidget * w, childWidgets()) { + foreach(auto &w, childWidgets()) { w->setVisible(false); w->deleteLater(); w->setParent(nullptr); } - for (const Partition * child : partition()->children()) { + for (const auto &child : partition()->children()) { QWidget* w = new PartWidget(this, child); w->setVisible(true); } diff --git a/src/gui/partwidgetbase.cpp b/src/gui/partwidgetbase.cpp index 575325a..472ce1d 100644 --- a/src/gui/partwidgetbase.cpp +++ b/src/gui/partwidgetbase.cpp @@ -107,21 +107,21 @@ void PartWidgetBase::positionChildren(const QWidget* destWidget, const Partition return; qint64 totalLength = 0; - for (const Partition * p : partitions) + for (const auto &p : partitions) totalLength += p->length(); if (totalLength < 1) return; // calculate unleveled width for each child and store it - for (int i = 0; i < partitions.size(); i++) { - childrenWidth.append(partitions[i]->length() * destWidgetWidth / totalLength); + for (const auto &p : partitions) { + childrenWidth.append(p->length() * destWidgetWidth / totalLength); // Calculate the minimum width for the widget. This is easy for primary and logical partitions: they // just have a fixed min width (configured in m_MinWidth). But for extended partitions things // are not quite as simple. We need to calc the sum of the min widths for each child, taking // spacing and borders into account, and add our own min width. - qint32 min = (minWidth() + 2 * borderWidth() + spacing()) * partitions[i]->children().size() - spacing() + 2 * borderWidth(); + qint32 min = (minWidth() + 2 * borderWidth() + spacing()) * p->children().size() - spacing() + 2 * borderWidth(); // if it's too small, this partition is a primary or logical so just use the configured value if (min < minWidth()) @@ -146,7 +146,7 @@ QList PartWidgetBase::childWidgets() { QList rval; - for (QObject * o : children()) + for (auto &o : children()) if (PartWidget* w = qobject_cast(o)) rval.append(w); diff --git a/src/jobs/createvolumegroupjob.cpp b/src/jobs/createvolumegroupjob.cpp index 485034a..6bca909 100644 --- a/src/jobs/createvolumegroupjob.cpp +++ b/src/jobs/createvolumegroupjob.cpp @@ -24,8 +24,8 @@ #include /** Creates a new CreateVolumeGroupJob - @param vgname - @parem pvList + @param vgname LVM Volume Group name + @param pvlist List of LVM Physical Volumes */ CreateVolumeGroupJob::CreateVolumeGroupJob(const QString& vgname, const QStringList& pvlist, const qint32 pesize) : Job(), @@ -51,7 +51,7 @@ bool CreateVolumeGroupJob::run(Report& parent) QString CreateVolumeGroupJob::description() const { QString tmp = QString(); - for (const QString name : pvList()) { + for (const auto &name : pvList()) { tmp += QStringLiteral("\n") + name; } return xi18nc("@info/plain", "Create new Volume Group: %1 with PV: %2", vgName(), tmp); diff --git a/src/jobs/deactivatelogicalvolumejob.cpp b/src/jobs/deactivatelogicalvolumejob.cpp index 5b1f774..72f659c 100644 --- a/src/jobs/deactivatelogicalvolumejob.cpp +++ b/src/jobs/deactivatelogicalvolumejob.cpp @@ -41,9 +41,9 @@ bool DeactivateLogicalVolumeJob::run(Report& parent) Report* report = jobStarted(parent); if (device().type() == Device::LVM_Device) { - for (const Partition* part : device().partitionTable()->children()) { - if (!part->roles().has(PartitionRole::Unallocated)) { - if (!LvmDevice::deactivateLV(*report, dynamic_cast(device()), *part)) { + for (const auto &p : device().partitionTable()->children()) { + if (!p->roles().has(PartitionRole::Unallocated)) { + if (!LvmDevice::deactivateLV(*report, dynamic_cast(device()), *p)) { rval = false; } } diff --git a/src/jobs/movephysicalvolumejob.cpp b/src/jobs/movephysicalvolumejob.cpp index f2f37e7..65fe47b 100644 --- a/src/jobs/movephysicalvolumejob.cpp +++ b/src/jobs/movephysicalvolumejob.cpp @@ -39,13 +39,13 @@ bool MovePhysicalVolumeJob::run(Report& parent) Report* report = jobStarted(parent); QStringList destinations = LvmDevice::getPVs(device().name()); - for (const QString partPath : partList()) { + for (const auto &partPath : partList()) { if (destinations.contains(partPath)) { destinations.removeAll(partPath); } } - for (const QString partPath : partList()) { + for (const auto &partPath : partList()) { rval = LvmDevice::movePV(*report, device(), partPath, destinations); if (rval == false) { break; @@ -60,7 +60,7 @@ bool MovePhysicalVolumeJob::run(Report& parent) QString MovePhysicalVolumeJob::description() const { QString tmp = QString(); - for (const QString path : partList()) { + for (const auto &path : partList()) { tmp += path + QStringLiteral(","); } return xi18nc("@info/plain", "Move used PE in %1 on %2 to other available Physical Volumes", tmp, device().name()); diff --git a/src/jobs/resizevolumegroupjob.cpp b/src/jobs/resizevolumegroupjob.cpp index 7212c7c..f9c06ee 100644 --- a/src/jobs/resizevolumegroupjob.cpp +++ b/src/jobs/resizevolumegroupjob.cpp @@ -39,7 +39,7 @@ bool ResizeVolumeGroupJob::run(Report& parent) Report* report = jobStarted(parent); - for (const QString pvpath : partList()) { + for (const auto &pvpath : partList()) { if (type() == ResizeVolumeGroupJob::Grow) { rval = LvmDevice::insertPV(*report, device(), pvpath); } else if (type() == ResizeVolumeGroupJob::Shrink) { @@ -58,7 +58,7 @@ bool ResizeVolumeGroupJob::run(Report& parent) QString ResizeVolumeGroupJob::description() const { QString tmp = QString(); - for (const QString path : partList()) { + for (const auto &path : partList()) { tmp += path + QStringLiteral(","); } if (type() == ResizeVolumeGroupJob::Grow) { diff --git a/src/jobs/setpartflagsjob.cpp b/src/jobs/setpartflagsjob.cpp index 004581c..dfa1a9b 100644 --- a/src/jobs/setpartflagsjob.cpp +++ b/src/jobs/setpartflagsjob.cpp @@ -70,7 +70,7 @@ bool SetPartFlagsJob::run(Report& parent) if (backendPartition) { quint32 count = 0; - for (const PartitionTable::Flag & f : PartitionTable::flagList()) { + for (const auto &f : PartitionTable::flagList()) { emit progress(++count); const bool state = (flags() & f) ? true : false; diff --git a/src/ops/createvolumegroupoperation.cpp b/src/ops/createvolumegroupoperation.cpp index 9182ebd..3df7341 100644 --- a/src/ops/createvolumegroupoperation.cpp +++ b/src/ops/createvolumegroupoperation.cpp @@ -27,8 +27,6 @@ #include /** Creates a new CreateVolumeGroupOperation. - @param d the Device to create the new PartitionTable on - @param t the type for the new PartitionTable */ CreateVolumeGroupOperation::CreateVolumeGroupOperation(const QString& vgname, const QStringList& pvlist, const qint32 pesize) : Operation(), @@ -56,7 +54,7 @@ void CreateVolumeGroupOperation::preview() void CreateVolumeGroupOperation::undo() { - for(QString pvpath : PVList()) { + for(const auto &pvpath : PVList()) { if (LvmDevice::s_DirtyPVs.contains(pvpath)) { LvmDevice::s_DirtyPVs.removeAll(pvpath); } diff --git a/src/ops/deactivatevolumegroupoperation.cpp b/src/ops/deactivatevolumegroupoperation.cpp index 7dd5748..a72dc04 100644 --- a/src/ops/deactivatevolumegroupoperation.cpp +++ b/src/ops/deactivatevolumegroupoperation.cpp @@ -27,8 +27,6 @@ #include /** Creates a new RemoveVolumeGroupOperation. - @param d the Device to create the new PartitionTable on - @param t the type for the new PartitionTable */ DeactivateVolumeGroupOperation::DeactivateVolumeGroupOperation(VolumeManagerDevice& dev) : Operation(), diff --git a/src/ops/operation.cpp b/src/ops/operation.cpp index ab05b97..e8eff61 100644 --- a/src/ops/operation.cpp +++ b/src/ops/operation.cpp @@ -146,7 +146,7 @@ qint32 Operation::totalProgress() const { qint32 result = 0; - for (const Job * job : jobs()) + for (const auto &job : jobs()) result += job->numSteps(); return result; diff --git a/src/ops/removevolumegroupoperation.cpp b/src/ops/removevolumegroupoperation.cpp index af47500..73d13d2 100644 --- a/src/ops/removevolumegroupoperation.cpp +++ b/src/ops/removevolumegroupoperation.cpp @@ -25,8 +25,6 @@ #include /** Creates a new RemoveVolumeGroupOperation. - @param d the Device to create the new PartitionTable on - @param t the type for the new PartitionTable */ RemoveVolumeGroupOperation::RemoveVolumeGroupOperation(VolumeManagerDevice& dev) : Operation(), diff --git a/src/util/report.cpp b/src/util/report.cpp index 08adfc9..30b9cd4 100644 --- a/src/util/report.cpp +++ b/src/util/report.cpp @@ -80,7 +80,7 @@ QString Report::toHtml() const if (children().size() == 0) s += QStringLiteral("
\n"); else - for (Report * child : children()) + for (const auto &child : children()) s += child->toHtml(); if (!status().isEmpty()) @@ -109,7 +109,7 @@ QString Report::toText() const if (!output().isEmpty()) s += output() + QStringLiteral("\n"); - for (const Report * child : children()) + for (const auto &child : children()) s += child->toText(); return s;