Constantify nonce and some cleanup
Reviewers: stikonas, #kde_partition_manager, cjlcarvalho Reviewed By: stikonas, #kde_partition_manager, cjlcarvalho Subscribers: varunp, tctara, teo, abhijeet2096, caiovosilva, cjlcarvalho, #kde_partition_manager Tags: #kde_partition_manager Differential Revision: https://phabricator.kde.org/D20108
This commit is contained in:
parent
4986b514b5
commit
281289dfbb
|
@ -90,7 +90,7 @@ ActionReply ExternalCommandHelper::init(const QVariantMap& args)
|
||||||
*/
|
*/
|
||||||
quint64 ExternalCommandHelper::getNonce()
|
quint64 ExternalCommandHelper::getNonce()
|
||||||
{
|
{
|
||||||
quint64 nonce = m_Generator.generate();
|
const quint64 nonce = m_Generator.generate();
|
||||||
m_Nonces.insert(nonce);
|
m_Nonces.insert(nonce);
|
||||||
return nonce;
|
return nonce;
|
||||||
}
|
}
|
||||||
|
@ -135,6 +135,7 @@ bool ExternalCommandHelper::readData(const QString& sourceDevice, QByteArray& bu
|
||||||
bool ExternalCommandHelper::writeData(const QString &targetDevice, const QByteArray& buffer, const qint64 offset)
|
bool ExternalCommandHelper::writeData(const QString &targetDevice, const QByteArray& buffer, const qint64 offset)
|
||||||
{
|
{
|
||||||
QFile device(targetDevice);
|
QFile device(targetDevice);
|
||||||
|
|
||||||
if (!device.open(QIODevice::WriteOnly | QIODevice::Append | QIODevice::Unbuffered)) {
|
if (!device.open(QIODevice::WriteOnly | QIODevice::Append | QIODevice::Unbuffered)) {
|
||||||
qCritical() << xi18n("Could not open device <filename>%1</filename> for writing.", targetDevice);
|
qCritical() << xi18n("Could not open device <filename>%1</filename> for writing.", targetDevice);
|
||||||
return false;
|
return false;
|
||||||
|
@ -149,6 +150,7 @@ bool ExternalCommandHelper::writeData(const QString &targetDevice, const QByteAr
|
||||||
qCritical() << xi18n("Could not write to device <filename>%1</filename>.", targetDevice);
|
qCritical() << xi18n("Could not write to device <filename>%1</filename>.", targetDevice);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue