diff --git a/src/format/Kdbx4Reader.cpp b/src/format/Kdbx4Reader.cpp index 4bb0202b10..d0914a04ed 100644 --- a/src/format/Kdbx4Reader.cpp +++ b/src/format/Kdbx4Reader.cpp @@ -35,7 +35,7 @@ bool Kdbx4Reader::readDatabaseImpl(QIODevice* device, { Q_ASSERT(m_kdbxVersion == KeePass2::FILE_VERSION_4); - m_binaryPoolInverse.clear(); + m_binaryPool.clear(); if (hasError()) { return false; @@ -273,11 +273,7 @@ bool Kdbx4Reader::readInnerHeaderField(QIODevice* device) return false; } auto data = fieldData.mid(1); - if (m_binaryPoolInverse.contains(data)) { - qWarning("Skipping duplicate binary record"); - break; - } - m_binaryPoolInverse.insert(data, QString::number(m_binaryPoolInverse.size())); + m_binaryPool.insert(QString::number(m_binaryPool.size()), data); break; } } @@ -422,17 +418,5 @@ QVariantMap Kdbx4Reader::readVariantMap(QIODevice* device) */ QHash Kdbx4Reader::binaryPool() const { - QHash binaryPool; - for (auto it = m_binaryPoolInverse.cbegin(); it != m_binaryPoolInverse.cend(); ++it) { - binaryPool.insert(it.value(), it.key()); - } - return binaryPool; -} - -/** - * @return mapping from binary data to attachment keys - */ -QHash Kdbx4Reader::binaryPoolInverse() const -{ - return m_binaryPoolInverse; + return m_binaryPool; } diff --git a/src/format/Kdbx4Reader.h b/src/format/Kdbx4Reader.h index 3afb5bf69a..fc73a1fbd6 100644 --- a/src/format/Kdbx4Reader.h +++ b/src/format/Kdbx4Reader.h @@ -34,7 +34,6 @@ class Kdbx4Reader : public KdbxReader const QByteArray& headerData, QSharedPointer key, Database* db) override; - QHash binaryPoolInverse() const; QHash binaryPool() const; protected: @@ -44,7 +43,7 @@ class Kdbx4Reader : public KdbxReader bool readInnerHeaderField(QIODevice* device); QVariantMap readVariantMap(QIODevice* device); - QHash m_binaryPoolInverse; + QHash m_binaryPool; }; #endif // KEEPASSX_KDBX4READER_H