Reduce number of unneeded copies
This patch aims at reducing the number of copies for obejcts that could be referenced rather than copied, because they're not modified during the computation.
This commit is contained in:
@@ -64,7 +64,7 @@ bool CsvExporter::writeGroup(QIODevice* device, const Group* group, QString grou
|
||||
}
|
||||
groupPath.append(group->name());
|
||||
|
||||
const QList<Entry*> entryList = group->entries();
|
||||
const QList<Entry*>& entryList = group->entries();
|
||||
for (const Entry* entry : entryList) {
|
||||
QString line;
|
||||
|
||||
@@ -83,7 +83,7 @@ bool CsvExporter::writeGroup(QIODevice* device, const Group* group, QString grou
|
||||
}
|
||||
}
|
||||
|
||||
const QList<Group*> children = group->children();
|
||||
const QList<Group*>& children = group->children();
|
||||
for (const Group* child : children) {
|
||||
if (!writeGroup(device, child, groupPath)) {
|
||||
return false;
|
||||
|
||||
@@ -59,7 +59,7 @@ const QList<QPair<QUuid, QString>> KeePass2::KDFS{
|
||||
qMakePair(KeePass2::KDF_AES_KDBX3, QObject::tr("AES-KDF (KDBX 3.1)"))
|
||||
};
|
||||
|
||||
QByteArray KeePass2::hmacKey(QByteArray masterSeed, QByteArray transformedMasterKey)
|
||||
QByteArray KeePass2::hmacKey(const QByteArray& masterSeed, const QByteArray& transformedMasterKey)
|
||||
{
|
||||
CryptoHash hmacKeyHash(CryptoHash::Sha512);
|
||||
hmacKeyHash.addData(masterSeed);
|
||||
@@ -98,7 +98,7 @@ QSharedPointer<Kdf> KeePass2::kdfFromParameters(const QVariantMap& p)
|
||||
return kdf;
|
||||
}
|
||||
|
||||
QVariantMap KeePass2::kdfToParameters(QSharedPointer<Kdf> kdf)
|
||||
QVariantMap KeePass2::kdfToParameters(const QSharedPointer<Kdf>& kdf)
|
||||
{
|
||||
return kdf->writeParameters();
|
||||
}
|
||||
|
||||
@@ -126,9 +126,9 @@ extern const QList<QPair<QUuid, QString>> KDFS;
|
||||
ByteArray = 0x42
|
||||
};
|
||||
|
||||
QByteArray hmacKey(QByteArray masterSeed, QByteArray transformedMasterKey);
|
||||
QByteArray hmacKey(const QByteArray& masterSeed, const QByteArray& transformedMasterKey);
|
||||
QSharedPointer<Kdf> kdfFromParameters(const QVariantMap& p);
|
||||
QVariantMap kdfToParameters(QSharedPointer<Kdf> kdf);
|
||||
QVariantMap kdfToParameters(const QSharedPointer<Kdf>& kdf);
|
||||
QSharedPointer<Kdf> uuidToKdf(const QUuid& uuid);
|
||||
ProtectedStreamAlgo idToProtectedStreamAlgo(quint32 id);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user