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