mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-05-20 23:40:46 -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
|
@ -315,7 +315,7 @@ void Database::setCompressionAlgo(Database::CompressionAlgorithm algo)
|
|||
* @param updateTransformSalt true to update the transform salt
|
||||
* @return true on success
|
||||
*/
|
||||
bool Database::setKey(QSharedPointer<const CompositeKey> key, bool updateChangedTime, bool updateTransformSalt)
|
||||
bool Database::setKey(const QSharedPointer<const CompositeKey>& key, bool updateChangedTime, bool updateTransformSalt)
|
||||
{
|
||||
if (!key) {
|
||||
m_data.key.reset();
|
||||
|
@ -354,7 +354,7 @@ bool Database::hasKey() const
|
|||
return m_data.hasKey;
|
||||
}
|
||||
|
||||
bool Database::verifyKey(QSharedPointer<CompositeKey> key) const
|
||||
bool Database::verifyKey(const QSharedPointer<CompositeKey>& key) const
|
||||
{
|
||||
Q_ASSERT(hasKey());
|
||||
|
||||
|
@ -501,7 +501,7 @@ Database* Database::openDatabaseFile(const QString& fileName, QSharedPointer<con
|
|||
return db;
|
||||
}
|
||||
|
||||
Database* Database::unlockFromStdin(QString databaseFilename, QString keyFilename, FILE* outputDescriptor, FILE* errorDescriptor)
|
||||
Database* Database::unlockFromStdin(const QString& databaseFilename, const QString& keyFilename, FILE* outputDescriptor, FILE* errorDescriptor)
|
||||
{
|
||||
auto compositeKey = QSharedPointer<CompositeKey>::create();
|
||||
QTextStream out(outputDescriptor);
|
||||
|
@ -553,7 +553,7 @@ Database* Database::unlockFromStdin(QString databaseFilename, QString keyFilenam
|
|||
* @param backup Backup the existing database file, if exists
|
||||
* @return error string, if any
|
||||
*/
|
||||
QString Database::saveToFile(QString filePath, bool atomic, bool backup)
|
||||
QString Database::saveToFile(const QString& filePath, bool atomic, bool backup)
|
||||
{
|
||||
QString error;
|
||||
if (atomic) {
|
||||
|
@ -633,7 +633,7 @@ QString Database::writeDatabase(QIODevice* device)
|
|||
* @param filePath Path to the file to backup
|
||||
* @return
|
||||
*/
|
||||
bool Database::backupDatabase(QString filePath)
|
||||
bool Database::backupDatabase(const QString& filePath)
|
||||
{
|
||||
QString backupFilePath = filePath;
|
||||
auto re = QRegularExpression("\\.kdbx$|(?<!\\.kdbx)$", QRegularExpression::CaseInsensitiveOption);
|
||||
|
@ -652,7 +652,7 @@ void Database::setKdf(QSharedPointer<Kdf> kdf)
|
|||
m_data.kdf = std::move(kdf);
|
||||
}
|
||||
|
||||
bool Database::changeKdf(QSharedPointer<Kdf> kdf)
|
||||
bool Database::changeKdf(const QSharedPointer<Kdf>& kdf)
|
||||
{
|
||||
kdf->randomizeSeed();
|
||||
QByteArray transformedMasterKey;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue