diff --git a/src/fs/fat16.cpp b/src/fs/fat16.cpp index 0c432f3..212fc5d 100644 --- a/src/fs/fat16.cpp +++ b/src/fs/fat16.cpp @@ -155,8 +155,10 @@ bool fat16::updateUUID(Report& report, const QString& deviceNode) const qint32 t = time(nullptr); char uuid[4]; - for (quint32 i = 0; i < sizeof(uuid); i++, t >>= 8) - uuid[i] = t & 0xff; + for (auto &u : uuid) { + u = t & 0xff; + t >>= 8; + } ExternalCommand cmd(report, QStringLiteral("dd"), { QStringLiteral("of=") + deviceNode , QStringLiteral("bs=1"), QStringLiteral("count=4"), QStringLiteral("seek=39") }); diff --git a/src/fs/fat32.cpp b/src/fs/fat32.cpp index 075b516..457872e 100644 --- a/src/fs/fat32.cpp +++ b/src/fs/fat32.cpp @@ -51,8 +51,10 @@ bool fat32::updateUUID(Report& report, const QString& deviceNode) const qint32 t = time(nullptr); char uuid[4]; - for (quint32 i = 0; i < sizeof(uuid); i++, t >>= 8) - uuid[i] = t & 0xff; + for (auto &u : uuid) { + u = t & 0xff; + t >>= 8; + } ExternalCommand cmd(report, QStringLiteral("dd"), { QStringLiteral("of=") + deviceNode, QStringLiteral("bs=1"), QStringLiteral("count=4"), QStringLiteral("seek=67") }); diff --git a/src/ops/createvolumegroupoperation.cpp b/src/ops/createvolumegroupoperation.cpp index 3df7341..2651bbe 100644 --- a/src/ops/createvolumegroupoperation.cpp +++ b/src/ops/createvolumegroupoperation.cpp @@ -54,7 +54,7 @@ void CreateVolumeGroupOperation::preview() void CreateVolumeGroupOperation::undo() { - for(const auto &pvpath : PVList()) { + for (const auto &pvpath : PVList()) { if (LvmDevice::s_DirtyPVs.contains(pvpath)) { LvmDevice::s_DirtyPVs.removeAll(pvpath); } diff --git a/src/plugins/libparted/helpers/scan.cpp b/src/plugins/libparted/helpers/scan.cpp index 13e08fa..f778bb8 100644 --- a/src/plugins/libparted/helpers/scan.cpp +++ b/src/plugins/libparted/helpers/scan.cpp @@ -107,12 +107,12 @@ ActionReply Scan::scandevice(const QVariantMap& args) // unallocated. Libparted doesn't like it if we ask for flags for unallocated // space. if (pedPartition->num > 0) - for (quint32 i = 0; i < sizeof(flagmap) / sizeof(flagmap[0]); i++) - if (ped_partition_is_flag_available(pedPartition, flagmap[i].pedFlag)) + for (const auto &flag : flagmap) + if (ped_partition_is_flag_available(pedPartition, flag.pedFlag)) // Workaround: libparted claims the hidden flag is available for extended partitions, but // throws an error when we try to set or clear it. So skip this combination. Also see setFlag. - if (pedPartition->type != PED_PARTITION_EXTENDED || flagmap[i].flag != PartitionTable::FlagHidden) - flags |= flagmap[i].flag; + if (pedPartition->type != PED_PARTITION_EXTENDED || flag.flag != PartitionTable::FlagHidden) + flags |= flag.flag; availableFlags.append(static_cast(flags)); // -------------------------------------------------------------------------- @@ -120,9 +120,9 @@ ActionReply Scan::scandevice(const QVariantMap& args) flags = PartitionTable::FlagNone; if (pedPartition->num > 0) - for (quint32 i = 0; i < sizeof(flagmap) / sizeof(flagmap[0]); i++) - if (ped_partition_is_flag_available(pedPartition, flagmap[i].pedFlag) && ped_partition_get_flag(pedPartition, flagmap[i].pedFlag)) - flags |= flagmap[i].flag; + for (const auto &flag : flagmap) + if (ped_partition_is_flag_available(pedPartition, flag.pedFlag) && ped_partition_get_flag(pedPartition, flag.pedFlag)) + flags |= flag.flag; activeFlags.append(static_cast(flags)); // -------------------------------------------------------------------------- diff --git a/src/plugins/libparted/libpartedbackend.cpp b/src/plugins/libparted/libpartedbackend.cpp index 9744e92..406ef05 100644 --- a/src/plugins/libparted/libpartedbackend.cpp +++ b/src/plugins/libparted/libpartedbackend.cpp @@ -320,7 +320,6 @@ Device* LibPartedBackend::scanDevice(const QString& deviceNode) QList LibPartedBackend::scanDevices(bool excludeReadOnly) { QList result; - // FIXME: cat /sys/block/loop0/ro // linux.git/tree/Documentation/devices.txt QString blockDeviceMajorNumbers = QStringLiteral( "3,22,33,34,56,57,88,89,90,91,128,129,130,131,132,133,134,135," // MFM, RLL and IDE hard disk/CD-ROM interface