mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-07-25 15:55:38 -04:00
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:
parent
a67a574b89
commit
da9afd3f6f
40 changed files with 90 additions and 90 deletions
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue