From 0bd44b94dc1ac764add98a81f479f633212a33d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrius=20=C5=A0tikonas?= Date: Thu, 5 May 2016 12:46:27 +0100 Subject: [PATCH] Use trimmed() instead of simplified(). --- src/core/device.cpp | 2 +- src/fs/luks.cpp | 2 +- src/fs/ntfs.cpp | 10 ++-------- src/util/helpers.cpp | 2 +- 4 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/core/device.cpp b/src/core/device.cpp index fd99e12..46bdc86 100644 --- a/src/core/device.cpp +++ b/src/core/device.cpp @@ -66,7 +66,7 @@ static qint32 getPhysicalSectorSize(const QString& device_node) if (f.open(QIODevice::ReadOnly)) { QByteArray a = f.readLine(); - return a.simplified().toInt(); + return a.trimmed().toInt(); } return -1; diff --git a/src/fs/luks.cpp b/src/fs/luks.cpp index 0034a07..3d51077 100644 --- a/src/fs/luks.cpp +++ b/src/fs/luks.cpp @@ -510,7 +510,7 @@ QString luks::readUUID(const QString& deviceNode) const ExternalCommand cmd(QStringLiteral("cryptsetup"), { QStringLiteral("luksUUID"), deviceNode }); if (cmd.run()) { - return cmd.output().simplified(); + return cmd.output().trimmed(); } return QStringLiteral("---"); } diff --git a/src/fs/ntfs.cpp b/src/fs/ntfs.cpp index 9ee775d..fd21c30 100644 --- a/src/fs/ntfs.cpp +++ b/src/fs/ntfs.cpp @@ -123,19 +123,13 @@ qint64 ntfs::readUsedCapacity(const QString& deviceNode) const bool ntfs::writeLabel(Report& report, const QString& deviceNode, const QString& newLabel) { - ExternalCommand writeCmd(report, QStringLiteral("ntfslabel"), { QStringLiteral("--force"), deviceNode, newLabel.simplified() }); + ExternalCommand writeCmd(report, QStringLiteral("ntfslabel"), { QStringLiteral("--force"), deviceNode, newLabel }); writeCmd.setProcessChannelMode(QProcess::SeparateChannels); if (!writeCmd.run(-1)) return false; - ExternalCommand testCmd(QStringLiteral("ntfslabel"), { QStringLiteral("--force"), deviceNode }); - testCmd.setProcessChannelMode(QProcess::SeparateChannels); - - if (!testCmd.run(-1)) - return false; - - return testCmd.output().simplified() == newLabel.simplified(); + return true; } bool ntfs::check(Report& report, const QString& deviceNode) const diff --git a/src/util/helpers.cpp b/src/util/helpers.cpp index 336c8f3..192fdcf 100644 --- a/src/util/helpers.cpp +++ b/src/util/helpers.cpp @@ -79,7 +79,7 @@ bool isMounted(const QString& deviceNode) deviceNode }); if (cmd.run(-1) && cmd.exitCode() == 0) { - return !cmd.output().simplified().isEmpty(); + return !cmd.output().trimmed().isEmpty(); } return false; }