mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
some cppcheck and clang-tidy fixies
This commit is contained in:
parent
ac7face247
commit
98badfb4a2
@ -46,7 +46,7 @@ Clip::Clip()
|
||||
int Clip::executeWithDatabase(QSharedPointer<Database> database, QSharedPointer<QCommandLineParser> parser)
|
||||
{
|
||||
const QStringList args = parser->positionalArguments();
|
||||
QString entryPath = args.at(1);
|
||||
const QString& entryPath = args.at(1);
|
||||
QString timeout;
|
||||
if (args.size() == 3) {
|
||||
timeout = args.at(2);
|
||||
|
@ -60,8 +60,8 @@ int Import::execute(const QStringList& arguments)
|
||||
TextStream errorTextStream(Utils::STDERR, QIODevice::WriteOnly);
|
||||
|
||||
const QStringList args = parser->positionalArguments();
|
||||
const QString xmlExportPath = args.at(0);
|
||||
const QString dbPath = args.at(1);
|
||||
const QString& xmlExportPath = args.at(0);
|
||||
const QString& dbPath = args.at(1);
|
||||
|
||||
if (QFileInfo::exists(dbPath)) {
|
||||
errorTextStream << QObject::tr("File %1 already exists.").arg(dbPath) << endl;
|
||||
|
@ -60,7 +60,7 @@ int List::executeWithDatabase(QSharedPointer<Database> database, QSharedPointer<
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
QString groupPath = args.at(1);
|
||||
const QString& groupPath = args.at(1);
|
||||
Group* group = database->rootGroup()->findGroupByPath(groupPath);
|
||||
if (!group) {
|
||||
errorTextStream << QObject::tr("Cannot find group %1.").arg(groupPath) << endl;
|
||||
|
@ -40,7 +40,7 @@ int Locate::executeWithDatabase(QSharedPointer<Database> database, QSharedPointe
|
||||
{
|
||||
|
||||
const QStringList args = parser->positionalArguments();
|
||||
QString searchTerm = args.at(1);
|
||||
const QString& searchTerm = args.at(1);
|
||||
TextStream outputTextStream(Utils::STDOUT, QIODevice::WriteOnly);
|
||||
TextStream errorTextStream(Utils::STDERR, QIODevice::WriteOnly);
|
||||
|
||||
|
@ -90,7 +90,7 @@ void IconDownloader::setUrl(const QString& entryUrl)
|
||||
// searching for a match with the returned address(es).
|
||||
bool hostIsIp = false;
|
||||
QList<QHostAddress> hostAddressess = QHostInfo::fromName(fullyQualifiedDomain).addresses();
|
||||
for (auto addr : hostAddressess) {
|
||||
for (const auto& addr : hostAddressess) {
|
||||
if (addr.toString() == fullyQualifiedDomain) {
|
||||
hostIsIp = true;
|
||||
}
|
||||
|
@ -341,6 +341,8 @@ OpVaultReader::decodeB64CompositeKeys(const QString& b64, const QByteArray& encK
|
||||
result->errorStr = tr("Unable to decode masterKey: %1").arg(keyKey01.errorString());
|
||||
return result;
|
||||
}
|
||||
delete result;
|
||||
|
||||
const QByteArray keyKey = keyKey01.getClearText();
|
||||
|
||||
return decodeCompositeKeys(keyKey);
|
||||
|
@ -111,7 +111,7 @@ void TestCsvParser::testEmptySimple()
|
||||
out << "";
|
||||
QVERIFY(parser->parse(file.data()));
|
||||
t = parser->getCsvTable();
|
||||
QVERIFY(t.size() == 0);
|
||||
QVERIFY(t.isEmpty());
|
||||
}
|
||||
|
||||
void TestCsvParser::testEmptyQuoted()
|
||||
@ -120,7 +120,7 @@ void TestCsvParser::testEmptyQuoted()
|
||||
out << "\"\"";
|
||||
QVERIFY(parser->parse(file.data()));
|
||||
t = parser->getCsvTable();
|
||||
QVERIFY(t.size() == 0);
|
||||
QVERIFY(t.isEmpty());
|
||||
}
|
||||
|
||||
void TestCsvParser::testEmptyNewline()
|
||||
@ -129,14 +129,14 @@ void TestCsvParser::testEmptyNewline()
|
||||
out << "\"\n\"";
|
||||
QVERIFY(parser->parse(file.data()));
|
||||
t = parser->getCsvTable();
|
||||
QVERIFY(t.size() == 0);
|
||||
QVERIFY(t.isEmpty());
|
||||
}
|
||||
|
||||
void TestCsvParser::testEmptyFile()
|
||||
{
|
||||
QVERIFY(parser->parse(file.data()));
|
||||
t = parser->getCsvTable();
|
||||
QVERIFY(t.size() == 0);
|
||||
QVERIFY(t.isEmpty());
|
||||
}
|
||||
|
||||
void TestCsvParser::testNewline()
|
||||
@ -281,7 +281,7 @@ void TestCsvParser::testEmptyReparsing()
|
||||
parser->parse(nullptr);
|
||||
QVERIFY(parser->reparse());
|
||||
t = parser->getCsvTable();
|
||||
QVERIFY(t.size() == 0);
|
||||
QVERIFY(t.isEmpty());
|
||||
}
|
||||
|
||||
void TestCsvParser::testReparsing()
|
||||
|
@ -296,7 +296,7 @@ void TestEntryModel::testProxyModel()
|
||||
QSignalSpy spyColumnRemove(modelProxy, SIGNAL(columnsAboutToBeRemoved(QModelIndex, int, int)));
|
||||
modelProxy->hideColumn(0, true);
|
||||
QCOMPARE(modelProxy->columnCount(), 12);
|
||||
QVERIFY(spyColumnRemove.size() >= 1);
|
||||
QVERIFY(!spyColumnRemove.isEmpty());
|
||||
|
||||
int oldSpyColumnRemoveSize = spyColumnRemove.size();
|
||||
modelProxy->hideColumn(0, true);
|
||||
@ -318,7 +318,7 @@ void TestEntryModel::testProxyModel()
|
||||
QSignalSpy spyColumnInsert(modelProxy, SIGNAL(columnsAboutToBeInserted(QModelIndex, int, int)));
|
||||
modelProxy->hideColumn(0, false);
|
||||
QCOMPARE(modelProxy->columnCount(), 13);
|
||||
QVERIFY(spyColumnInsert.size() >= 1);
|
||||
QVERIFY(!spyColumnInsert.isEmpty());
|
||||
|
||||
int oldSpyColumnInsertSize = spyColumnInsert.size();
|
||||
modelProxy->hideColumn(0, false);
|
||||
|
@ -1070,7 +1070,7 @@ void TestGroup::testHierarchy()
|
||||
QVERIFY(hierarchy.contains("group3"));
|
||||
|
||||
hierarchy = group3->hierarchy(0);
|
||||
QVERIFY(hierarchy.size() == 0);
|
||||
QVERIFY(hierarchy.isEmpty());
|
||||
|
||||
hierarchy = group3->hierarchy(1);
|
||||
QVERIFY(hierarchy.size() == 1);
|
||||
|
Loading…
Reference in New Issue
Block a user