diff --git a/src/core/CsvParser.cpp b/src/core/CsvParser.cpp index e545d1db4..7e4929481 100644 --- a/src/core/CsvParser.cpp +++ b/src/core/CsvParser.cpp @@ -403,10 +403,11 @@ QString CsvParser::getStatus() const int CsvParser::getCsvCols() const { - if ((m_table.size() > 0) && (m_table.at(0).size() > 0)) + if (!m_table.isEmpty() && !m_table.at(0).isEmpty()) { return m_table.at(0).size(); - else + } else { return 0; + } } int CsvParser::getCsvRows() const diff --git a/src/format/KdbxXmlReader.cpp b/src/format/KdbxXmlReader.cpp index 163a9fa9d..efef724d9 100644 --- a/src/format/KdbxXmlReader.cpp +++ b/src/format/KdbxXmlReader.cpp @@ -731,7 +731,7 @@ Entry* KdbxXmlReader::parseEntry(bool history) } if (m_xml.name() == "Binary") { QPair ref = parseEntryBinary(entry); - if (!ref.first.isNull() && !ref.second.isNull()) { + if (!ref.first.isEmpty() && !ref.second.isEmpty()) { binaryRefs.append(ref); } continue; diff --git a/src/gui/DatabaseOpenWidget.cpp b/src/gui/DatabaseOpenWidget.cpp index 9c496aa31..0983ad855 100644 --- a/src/gui/DatabaseOpenWidget.cpp +++ b/src/gui/DatabaseOpenWidget.cpp @@ -174,7 +174,7 @@ QSharedPointer DatabaseOpenWidget::database() void DatabaseOpenWidget::enterKey(const QString& pw, const QString& keyFile) { - if (!pw.isNull()) { + if (!pw.isEmpty()) { m_ui->editPassword->setText(pw); } if (!keyFile.isEmpty()) { diff --git a/src/gui/EntryPreviewWidget.cpp b/src/gui/EntryPreviewWidget.cpp index 7c88d1fa5..359360879 100644 --- a/src/gui/EntryPreviewWidget.cpp +++ b/src/gui/EntryPreviewWidget.cpp @@ -220,7 +220,7 @@ void EntryPreviewWidget::updateEntryAttributesTab() m_ui->entryAttributesEdit->clear(); const EntryAttributes* attributes = m_currentEntry->attributes(); const QStringList customAttributes = attributes->customKeys(); - const bool haveAttributes = customAttributes.size() > 0; + const bool haveAttributes = !customAttributes.isEmpty(); setTabEnabled(m_ui->entryTabWidget, m_ui->entryAttributesTab, haveAttributes); if (haveAttributes) { QString attributesText; diff --git a/tests/TestKeePass1Reader.cpp b/tests/TestKeePass1Reader.cpp index bb9e07a42..078447acb 100644 --- a/tests/TestKeePass1Reader.cpp +++ b/tests/TestKeePass1Reader.cpp @@ -267,7 +267,7 @@ void TestKeePass1Reader::reopenDatabase(QSharedPointer db, QVERIFY(buffer.seek(0)); auto key = QSharedPointer::create(); - if (!password.isNull()) { + if (!password.isEmpty()) { key->addKey(QSharedPointer::create(password)); } if (!keyfileName.isEmpty()) { diff --git a/tests/TestKeys.cpp b/tests/TestKeys.cpp index c2e9aa196..d25a2bca8 100644 --- a/tests/TestKeys.cpp +++ b/tests/TestKeys.cpp @@ -227,7 +227,7 @@ void TestKeys::testCompositeKeyComponents() auto fileKeyEnc = QSharedPointer::create(); QString error; fileKeyEnc->load(QString("%1/%2").arg(QString(KEEPASSX_TEST_DATA_DIR), "FileKeyHashed.key"), &error); - if (!error.isNull()) { + if (!error.isEmpty()) { QFAIL(qPrintable(error)); } auto challengeResponseKeyEnc = QSharedPointer::create(QByteArray(16, 0x10)); @@ -285,7 +285,7 @@ void TestKeys::testCompositeKeyComponents() compositeKeyDec3->addKey(passwordKeyEnc); auto fileKeyWrong = QSharedPointer::create(); fileKeyWrong->load(QString("%1/%2").arg(QString(KEEPASSX_TEST_DATA_DIR), "FileKeyHashed2.key"), &error); - if (!error.isNull()) { + if (!error.isEmpty()) { QFAIL(qPrintable(error)); } compositeKeyDec3->addKey(fileKeyWrong);