Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions lib/libebook/helper_search_index.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#include "helper_search_index.h"


static const int DICT_VERSION = 5;
static const int DICT_VERSION = 6;

namespace QtAs
{
Expand Down Expand Up @@ -335,6 +335,9 @@ bool Index::parseDocumentToStringlist( EBook* chmFile, const QUrl& filename, QSt

void Index::writeDict( QDataStream& stream )
{
// Set a fixed stream version for compatibility
stream.setVersion( QDataStream::Qt_5_5 );

stream << DICT_VERSION;
stream << m_charssplit;
stream << m_charsword;
Expand All @@ -346,7 +349,6 @@ void Index::writeDict( QDataStream& stream )
for ( QHash<QString, Entry*>::ConstIterator it = dict.begin(); it != dict.end(); ++it )
{
stream << it.key();
stream << it.value()->documents.count();
stream << it.value()->documents;
}
}
Expand All @@ -357,7 +359,10 @@ bool Index::readDict( QDataStream& stream )
docList.clear();

QString key;
int version, numOfDocs;
int version;

// Set a fixed stream version for compatibility
stream.setVersion( QDataStream::Qt_5_5 );

stream >> version;

Expand All @@ -373,9 +378,8 @@ bool Index::readDict( QDataStream& stream )
while ( !stream.atEnd() )
{
stream >> key;
stream >> numOfDocs;

QVector<Document> docs( numOfDocs );
QVector<Document> docs;

stream >> docs;
dict.insert( key, new Entry( docs ) );
Expand Down