diff --git a/src/backend/corebackenddevice.h b/src/backend/corebackenddevice.h index 0629f33..79c0f85 100644 --- a/src/backend/corebackenddevice.h +++ b/src/backend/corebackenddevice.h @@ -39,7 +39,7 @@ class Report; class CoreBackendDevice { public: - CoreBackendDevice(const QString& deviceNode); + explicit CoreBackendDevice(const QString& deviceNode); virtual ~CoreBackendDevice() {} public: diff --git a/src/core/copysourcefile.h b/src/core/copysourcefile.h index 3a5cebd..458b161 100644 --- a/src/core/copysourcefile.h +++ b/src/core/copysourcefile.h @@ -36,7 +36,7 @@ class CopyTarget; class CopySourceFile : public CopySource { public: - CopySourceFile(const QString& filename); + explicit CopySourceFile(const QString& filename); public: bool open() override; diff --git a/src/core/copytargetbytearray.h b/src/core/copytargetbytearray.h index 709fa9a..4c4a38a 100644 --- a/src/core/copytargetbytearray.h +++ b/src/core/copytargetbytearray.h @@ -34,7 +34,7 @@ class CopyTargetByteArray : public CopyTarget { public: - CopyTargetByteArray(QByteArray& array); + explicit CopyTargetByteArray(QByteArray& array); public: bool open() override { diff --git a/src/core/copytargetfile.h b/src/core/copytargetfile.h index 258a403..53c32d7 100644 --- a/src/core/copytargetfile.h +++ b/src/core/copytargetfile.h @@ -36,7 +36,7 @@ class QString; class CopyTargetFile : public CopyTarget { public: - CopyTargetFile(const QString& filename); + explicit CopyTargetFile(const QString& filename); public: bool open() override; diff --git a/src/core/lvmdevice.cpp b/src/core/lvmdevice.cpp index 3ee126c..1df14e5 100644 --- a/src/core/lvmdevice.cpp +++ b/src/core/lvmdevice.cpp @@ -171,7 +171,7 @@ Partition* LvmDevice::scanPartition(const QString& lvPath, PartitionTable* pTabl mountPoint = FileSystem::detectMountPoint(fs, lvPath); mounted = FileSystem::detectMountStatus(fs, lvPath); - if (mountPoint != QString() && fs->type() != FileSystem::Type::LinuxSwap) { + if (!mountPoint.isEmpty() && fs->type() != FileSystem::Type::LinuxSwap) { const QStorageInfo storage = QStorageInfo(mountPoint); if (logicalSize() > 0 && fs->type() != FileSystem::Type::Luks && mounted && storage.isValid()) fs->setSectorsUsed( (storage.bytesTotal() - storage.bytesFree()) / logicalSize() ); diff --git a/src/core/lvmdevice.h b/src/core/lvmdevice.h index 922ed01..16d1cc0 100644 --- a/src/core/lvmdevice.h +++ b/src/core/lvmdevice.h @@ -48,7 +48,7 @@ class LIBKPMCORE_EXPORT LvmDevice : public VolumeManagerDevice friend class VolumeManagerDevice; public: - LvmDevice(const QString& name, const QString& iconName = QString()); + explicit LvmDevice(const QString& name, const QString& iconName = QString()); ~LvmDevice(); public: diff --git a/src/core/operationstack.h b/src/core/operationstack.h index ccf2897..7276dd4 100644 --- a/src/core/operationstack.h +++ b/src/core/operationstack.h @@ -51,7 +51,7 @@ public: typedef QList Operations; public: - OperationStack(QObject* parent = nullptr); + explicit OperationStack(QObject* parent = nullptr); ~OperationStack(); Q_SIGNALS: diff --git a/src/core/raid/softwareraid.h b/src/core/raid/softwareraid.h index 447856b..0789ec2 100644 --- a/src/core/raid/softwareraid.h +++ b/src/core/raid/softwareraid.h @@ -36,7 +36,7 @@ public: Recovery, }; - SoftwareRAID(const QString& name, + explicit SoftwareRAID(const QString& name, SoftwareRAID::Status status = SoftwareRAID::Status::Active, const QString& iconName = QString()); diff --git a/src/core/smartattribute.h b/src/core/smartattribute.h index 2df9ae9..7df36a4 100644 --- a/src/core/smartattribute.h +++ b/src/core/smartattribute.h @@ -46,7 +46,7 @@ public: }; public: - SmartAttribute(const SmartAttributeParsedData& a); + explicit SmartAttribute(const SmartAttributeParsedData& a); public: qint32 id() const { diff --git a/src/core/smartparser.h b/src/core/smartparser.h index 6869c01..115fbd5 100644 --- a/src/core/smartparser.h +++ b/src/core/smartparser.h @@ -32,7 +32,7 @@ class SmartDiskInformation; class SmartParser { public: - SmartParser(const QString &device_path); + explicit SmartParser(const QString &device_path); ~SmartParser(); public: diff --git a/src/core/smartstatus.h b/src/core/smartstatus.h index 06defe8..d480cd2 100644 --- a/src/core/smartstatus.h +++ b/src/core/smartstatus.h @@ -57,7 +57,7 @@ public: typedef QList Attributes; public: - SmartStatus(const QString &device_path); + explicit SmartStatus(const QString &device_path); public: void update(); diff --git a/src/core/volumemanagerdevice.cpp b/src/core/volumemanagerdevice.cpp index 68036d1..3e87dc3 100644 --- a/src/core/volumemanagerdevice.cpp +++ b/src/core/volumemanagerdevice.cpp @@ -16,9 +16,9 @@ * along with this program. If not, see .* *************************************************************************/ -#include "core/device_p.h" #include "core/volumemanagerdevice.h" #include "core/volumemanagerdevice_p.h" +#include "core/device_p.h" #include "core/lvmdevice.h" #include "core/raid/softwareraid.h" diff --git a/src/fs/filesystem.cpp b/src/fs/filesystem.cpp index 8b795f0..141c13d 100644 --- a/src/fs/filesystem.cpp +++ b/src/fs/filesystem.cpp @@ -17,9 +17,9 @@ * along with this program. If not, see .* *************************************************************************/ +#include "fs/filesystem.h" #include "core/fstab.h" -#include "fs/filesystem.h" #include "fs/lvm2_pv.h" #include "backend/corebackend.h" @@ -174,7 +174,7 @@ bool FileSystem::detectMountStatus(FileSystem* fs, const QString& partitionPath) bool mounted = false; if (fs->type() == FileSystem::Type::Lvm2_PV) { - mounted = FS::lvm2_pv::getVGName(partitionPath) != QString(); + mounted = !FS::lvm2_pv::getVGName(partitionPath).isEmpty(); } else { mounted = isMounted(partitionPath); } diff --git a/src/gui/partresizerwidget.h b/src/gui/partresizerwidget.h index dbbd57d..41d8e4a 100644 --- a/src/gui/partresizerwidget.h +++ b/src/gui/partresizerwidget.h @@ -45,7 +45,7 @@ class LIBKPMCORE_EXPORT PartResizerWidget : public QWidget Q_DISABLE_COPY(PartResizerWidget) public: - PartResizerWidget(QWidget* parent); + explicit PartResizerWidget(QWidget* parent); public: void init(Device& d, Partition& p, qint64 minFirst, qint64 maxLast, bool read_only = false, bool move_allowed = true); diff --git a/src/jobs/checkfilesystemjob.h b/src/jobs/checkfilesystemjob.h index 815d88d..e79e7f7 100644 --- a/src/jobs/checkfilesystemjob.h +++ b/src/jobs/checkfilesystemjob.h @@ -32,7 +32,7 @@ class QString; class CheckFileSystemJob : public Job { public: - CheckFileSystemJob(Partition& p); + explicit CheckFileSystemJob(Partition& p); public: bool run(Report& parent) override; diff --git a/src/jobs/createpartitionjob.cpp b/src/jobs/createpartitionjob.cpp index e6fb374..6f20ecd 100644 --- a/src/jobs/createpartitionjob.cpp +++ b/src/jobs/createpartitionjob.cpp @@ -59,7 +59,7 @@ bool CreatePartitionJob::run(Report& parent) if (backendPartitionTable) { QString partitionPath = backendPartitionTable->createPartition(*report, partition()); - if (partitionPath != QString()) { + if (!partitionPath.isEmpty()) { rval = true; partition().setPartitionPath(partitionPath); partition().setState(Partition::State::None); diff --git a/src/jobs/createpartitiontablejob.h b/src/jobs/createpartitiontablejob.h index 0888b1a..de34ee5 100644 --- a/src/jobs/createpartitiontablejob.h +++ b/src/jobs/createpartitiontablejob.h @@ -32,7 +32,7 @@ class QString; class CreatePartitionTableJob : public Job { public: - CreatePartitionTableJob(Device& d); + explicit CreatePartitionTableJob(Device& d); public: bool run(Report& parent) override; diff --git a/src/jobs/deactivatelogicalvolumejob.h b/src/jobs/deactivatelogicalvolumejob.h index 8437977..e5d8da6 100644 --- a/src/jobs/deactivatelogicalvolumejob.h +++ b/src/jobs/deactivatelogicalvolumejob.h @@ -30,7 +30,7 @@ class QString; class DeactivateLogicalVolumeJob : public Job { public: - DeactivateLogicalVolumeJob(const VolumeManagerDevice& dev, const QStringList lvPaths = {}); + explicit DeactivateLogicalVolumeJob(const VolumeManagerDevice& dev, const QStringList lvPaths = {}); public: bool run(Report& parent) override; diff --git a/src/jobs/deactivatevolumegroupjob.h b/src/jobs/deactivatevolumegroupjob.h index a7886b9..308df1b 100644 --- a/src/jobs/deactivatevolumegroupjob.h +++ b/src/jobs/deactivatevolumegroupjob.h @@ -30,7 +30,7 @@ class QString; class DeactivateVolumeGroupJob : public Job { public: - DeactivateVolumeGroupJob(VolumeManagerDevice& dev); + explicit DeactivateVolumeGroupJob(VolumeManagerDevice& dev); public: bool run(Report& parent) override; diff --git a/src/ops/deactivatevolumegroupoperation.h b/src/ops/deactivatevolumegroupoperation.h index e0b2b00..bb4d722 100644 --- a/src/ops/deactivatevolumegroupoperation.h +++ b/src/ops/deactivatevolumegroupoperation.h @@ -39,7 +39,7 @@ class LIBKPMCORE_EXPORT DeactivateVolumeGroupOperation : public Operation friend class OperationStack; public: - DeactivateVolumeGroupOperation(VolumeManagerDevice& d); + explicit DeactivateVolumeGroupOperation(VolumeManagerDevice& d); public: QString iconName() const override { diff --git a/src/ops/removevolumegroupoperation.h b/src/ops/removevolumegroupoperation.h index 12e78a1..5bc8901 100644 --- a/src/ops/removevolumegroupoperation.h +++ b/src/ops/removevolumegroupoperation.h @@ -37,7 +37,7 @@ class LIBKPMCORE_EXPORT RemoveVolumeGroupOperation : public Operation friend class OperationStack; public: - RemoveVolumeGroupOperation(VolumeManagerDevice& d); + explicit RemoveVolumeGroupOperation(VolumeManagerDevice& d); public: QString iconName() const override { diff --git a/src/plugins/dummy/dummydevice.h b/src/plugins/dummy/dummydevice.h index 746c346..322a227 100644 --- a/src/plugins/dummy/dummydevice.h +++ b/src/plugins/dummy/dummydevice.h @@ -33,7 +33,7 @@ class DummyDevice : public CoreBackendDevice Q_DISABLE_COPY(DummyDevice) public: - DummyDevice(const QString& deviceNode); + explicit DummyDevice(const QString& deviceNode); ~DummyDevice(); public: diff --git a/src/plugins/sfdisk/sfdiskdevice.h b/src/plugins/sfdisk/sfdiskdevice.h index eab4a12..ad83625 100644 --- a/src/plugins/sfdisk/sfdiskdevice.h +++ b/src/plugins/sfdisk/sfdiskdevice.h @@ -34,7 +34,7 @@ class SfdiskDevice : public CoreBackendDevice Q_DISABLE_COPY(SfdiskDevice); public: - SfdiskDevice(const Device& d); + explicit SfdiskDevice(const Device& d); ~SfdiskDevice(); public: diff --git a/src/plugins/sfdisk/sfdiskpartitiontable.h b/src/plugins/sfdisk/sfdiskpartitiontable.h index 9d0de1e..577ab34 100644 --- a/src/plugins/sfdisk/sfdiskpartitiontable.h +++ b/src/plugins/sfdisk/sfdiskpartitiontable.h @@ -32,7 +32,7 @@ class Partition; class SfdiskPartitionTable : public CoreBackendPartitionTable { public: - SfdiskPartitionTable(const Device *d); + explicit SfdiskPartitionTable(const Device *d); ~SfdiskPartitionTable(); public: diff --git a/src/util/externalcommand.cpp b/src/util/externalcommand.cpp index 0568bb6..9ba2fac 100644 --- a/src/util/externalcommand.cpp +++ b/src/util/externalcommand.cpp @@ -16,6 +16,7 @@ * along with this program. If not, see .* *************************************************************************/ +#include "util/externalcommand.h" #include "backend/corebackendmanager.h" #include "core/device.h" #include "core/copysource.h" @@ -24,7 +25,6 @@ #include "core/copysourcedevice.h" #include "core/copytargetdevice.h" #include "util/globallog.h" -#include "util/externalcommand.h" #include "util/report.h" #include "externalcommandhelper_interface.h" diff --git a/test/testdevice.cpp b/test/testdevice.cpp index 43a424b..d74e1c3 100644 --- a/test/testdevice.cpp +++ b/test/testdevice.cpp @@ -17,8 +17,8 @@ // SPDX-License-Identifier: GPL-3.0+ -#include "helpers.h" #include "testdevice.h" +#include "helpers.h" #include "backend/corebackend.h" #include "backend/corebackendmanager.h" @@ -81,7 +81,7 @@ void TestDevice::testDeviceName() exit(EXIT_FAILURE); } else { for (const auto &device : devices) { - if (device->name() == QString()) + if (device->name().isEmpty()) exit(EXIT_FAILURE); } }