mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-12-25 23:39:45 -05:00
Reduce unnecessary copies using move semantics
This commit is contained in:
parent
896a66e6d8
commit
379c41d20c
@ -18,12 +18,13 @@
|
||||
#include "WildcardMatcher.h"
|
||||
|
||||
#include <QStringList>
|
||||
#include <utility>
|
||||
|
||||
const QChar WildcardMatcher::Wildcard = '*';
|
||||
const Qt::CaseSensitivity WildcardMatcher::Sensitivity = Qt::CaseInsensitive;
|
||||
|
||||
WildcardMatcher::WildcardMatcher(const QString& text)
|
||||
: m_text(text)
|
||||
WildcardMatcher::WildcardMatcher(QString text)
|
||||
: m_text(std::move(text))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
class WildcardMatcher
|
||||
{
|
||||
public:
|
||||
explicit WildcardMatcher(const QString& text);
|
||||
explicit WildcardMatcher(QString text);
|
||||
bool match(const QString& pattern);
|
||||
|
||||
static const QChar Wildcard;
|
||||
|
@ -18,6 +18,8 @@
|
||||
|
||||
#include "AutoTypeMatch.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
AutoTypeMatch::AutoTypeMatch()
|
||||
: entry(nullptr)
|
||||
, sequence()
|
||||
@ -26,7 +28,7 @@ AutoTypeMatch::AutoTypeMatch()
|
||||
|
||||
AutoTypeMatch::AutoTypeMatch(Entry* entry, QString sequence)
|
||||
: entry(entry)
|
||||
, sequence(sequence)
|
||||
, sequence(std::move(sequence))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include <QTextStream>
|
||||
#include <QTimer>
|
||||
#include <QXmlStreamReader>
|
||||
#include <utility>
|
||||
|
||||
#include "cli/Utils.h"
|
||||
#include "core/Clock.h"
|
||||
@ -492,7 +493,7 @@ Database* Database::openDatabaseFile(const QString& fileName, QSharedPointer<con
|
||||
}
|
||||
|
||||
KeePass2Reader reader;
|
||||
Database* db = reader.readDatabase(&dbFile, key);
|
||||
Database* db = reader.readDatabase(&dbFile, std::move(key));
|
||||
if (reader.hasError()) {
|
||||
qCritical("Error while parsing the database: %s", qPrintable(reader.errorString()));
|
||||
return nullptr;
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QRegularExpression>
|
||||
#include <utility>
|
||||
|
||||
const int Entry::DefaultIconNumber = 0;
|
||||
const int Entry::ResolveMaximumDepth = 10;
|
||||
@ -367,7 +368,7 @@ QString Entry::totp() const
|
||||
void Entry::setTotp(QSharedPointer<Totp::Settings> settings)
|
||||
{
|
||||
beginUpdate();
|
||||
m_data.totpSettings = settings;
|
||||
m_data.totpSettings = std::move(settings);
|
||||
|
||||
auto text = Totp::writeSettings(m_data.totpSettings, title(), username());
|
||||
if (m_attributes->hasKey(Totp::ATTRIBUTE_OTP)) {
|
||||
|
@ -28,6 +28,7 @@
|
||||
|
||||
#include <QBuffer>
|
||||
#include <QFile>
|
||||
#include <utility>
|
||||
|
||||
#define UUID_LENGTH 16
|
||||
|
||||
@ -43,9 +44,9 @@ KdbxXmlReader::KdbxXmlReader(quint32 version)
|
||||
* @param version KDBX version
|
||||
* @param binaryPool binary pool
|
||||
*/
|
||||
KdbxXmlReader::KdbxXmlReader(quint32 version, const QHash<QString, QByteArray>& binaryPool)
|
||||
KdbxXmlReader::KdbxXmlReader(quint32 version, QHash<QString, QByteArray> binaryPool)
|
||||
: m_kdbxVersion(version)
|
||||
, m_binaryPool(binaryPool)
|
||||
, m_binaryPool(std::move(binaryPool))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ class KdbxXmlReader
|
||||
|
||||
public:
|
||||
explicit KdbxXmlReader(quint32 version);
|
||||
explicit KdbxXmlReader(quint32 version, const QHash<QString, QByteArray>& binaryPool);
|
||||
explicit KdbxXmlReader(quint32 version, QHash<QString, QByteArray> binaryPool);
|
||||
virtual ~KdbxXmlReader() = default;
|
||||
|
||||
virtual Database* readDatabase(const QString& filename);
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "format/KeePass1.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <utility>
|
||||
|
||||
/**
|
||||
* Read database from file and detect correct file format.
|
||||
@ -37,7 +38,7 @@ Database* KeePass2Reader::readDatabase(const QString& filename, QSharedPointer<c
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
QScopedPointer<Database> db(readDatabase(&file, key));
|
||||
QScopedPointer<Database> db(readDatabase(&file, std::move(key)));
|
||||
|
||||
if (file.error() != QFile::NoError) {
|
||||
raiseError(file.errorString());
|
||||
|
@ -18,6 +18,8 @@
|
||||
|
||||
#include "CsvParserModel.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
CsvParserModel::CsvParserModel(QObject* parent)
|
||||
: QAbstractTableModel(parent)
|
||||
, m_skipped(0)
|
||||
@ -92,7 +94,7 @@ void CsvParserModel::setSkippedRows(int skipped)
|
||||
|
||||
void CsvParserModel::setHeaderLabels(QStringList l)
|
||||
{
|
||||
m_columnHeader = l;
|
||||
m_columnHeader = std::move(l);
|
||||
}
|
||||
|
||||
int CsvParserModel::rowCount(const QModelIndex& parent) const
|
||||
|
@ -17,6 +17,8 @@
|
||||
|
||||
#include "HmacBlockStream.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "core/Endian.h"
|
||||
#include "crypto/CryptoHash.h"
|
||||
|
||||
@ -25,7 +27,7 @@ const QSysInfo::Endian HmacBlockStream::ByteOrder = QSysInfo::LittleEndian;
|
||||
HmacBlockStream::HmacBlockStream(QIODevice* baseDevice, QByteArray key)
|
||||
: LayeredStream(baseDevice)
|
||||
, m_blockSize(1024 * 1024)
|
||||
, m_key(key)
|
||||
, m_key(std::move(key))
|
||||
{
|
||||
init();
|
||||
}
|
||||
@ -33,7 +35,7 @@ HmacBlockStream::HmacBlockStream(QIODevice* baseDevice, QByteArray key)
|
||||
HmacBlockStream::HmacBlockStream(QIODevice* baseDevice, QByteArray key, qint32 blockSize)
|
||||
: LayeredStream(baseDevice)
|
||||
, m_blockSize(blockSize)
|
||||
, m_key(key)
|
||||
, m_key(std::move(key))
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user