[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [mula] plugins/stardict: Eliminate the file size usage from the index file interface
From: Laszlo Papp <lpapp () kde ! org>
Date: 2012-10-24 23:01:11
Message-ID: 20121024230111.F2CD1A60D1 () git ! kde ! org
[Download RAW message or body]
Git commit e2ae28bbeffc14deb103d45d3d1a0e98b0ee4e75 by Laszlo Papp.
Committed on 25/10/2012 at 01:01.
Pushed by lpapp into branch 'master'.
Eliminate the file size usage from the index file interface
M +1 -3 plugins/stardict/abstractindexfile.h
M +1 -1 plugins/stardict/dictionary.cpp
M +1 -1 plugins/stardict/indexfile.cpp
M +1 -1 plugins/stardict/indexfile.h
M +3 -3 plugins/stardict/offsetcachefile.cpp
M +1 -1 plugins/stardict/offsetcachefile.h
http://commits.kde.org/mula/e2ae28bbeffc14deb103d45d3d1a0e98b0ee4e75
diff --git a/plugins/stardict/abstractindexfile.h \
b/plugins/stardict/abstractindexfile.h index 84bbfb8..34d6261 100644
--- a/plugins/stardict/abstractindexfile.h
+++ b/plugins/stardict/abstractindexfile.h
@@ -45,12 +45,10 @@ namespace MulaPluginStarDict
* what method to use to actually interpret the loading.
*
* @param filePath The complete file path of the index file
- * @param filesize The file size of the index file coming from
- * the ".ifo" file
*
* @return Whether or not the loading was successful
*/
- virtual bool load(const QString& filePath, qulonglong fileSize) = 0;
+ virtual bool load(const QString& filePath) = 0;
/**
* Returns the word data according to the relevant index
diff --git a/plugins/stardict/dictionary.cpp b/plugins/stardict/dictionary.cpp
index 8c8418b..672598c 100644
--- a/plugins/stardict/dictionary.cpp
+++ b/plugins/stardict/dictionary.cpp
@@ -171,7 +171,7 @@ Dictionary::load(const QString& ifoFilePath)
d->indexFile.reset(new OffsetCacheFile);
}
- if (!d->indexFile->load(completeFilePath, d->dictionaryInfo.indexFileSize()))
+ if (!d->indexFile->load(completeFilePath))
return false;
return true;
diff --git a/plugins/stardict/indexfile.cpp b/plugins/stardict/indexfile.cpp
index 9be14c3..636cf61 100644
--- a/plugins/stardict/indexfile.cpp
+++ b/plugins/stardict/indexfile.cpp
@@ -53,7 +53,7 @@ IndexFile::~IndexFile()
}
bool
-IndexFile::load(const QString& filePath, qulonglong fileSize)
+IndexFile::load(const QString& filePath)
{
QFile file(filePath);
if (!file.open(QIODevice::ReadOnly))
diff --git a/plugins/stardict/indexfile.h b/plugins/stardict/indexfile.h
index 83eea57..1bad037 100644
--- a/plugins/stardict/indexfile.h
+++ b/plugins/stardict/indexfile.h
@@ -38,7 +38,7 @@ namespace MulaPluginStarDict
virtual ~IndexFile();
/** Reimplemented from AbstractIndexFile::load() */
- bool load(const QString& filePath, qulonglong fileSize);
+ bool load(const QString& filePath);
/** Reimplemented from AbstractIndexFile::key() */
QByteArray key(long index);
diff --git a/plugins/stardict/offsetcachefile.cpp \
b/plugins/stardict/offsetcachefile.cpp index 1053c66..c76e764 100644
--- a/plugins/stardict/offsetcachefile.cpp
+++ b/plugins/stardict/offsetcachefile.cpp
@@ -262,7 +262,7 @@ OffsetCacheFile::key(long index)
}
bool
-OffsetCacheFile::load(const QString& completeFilePath, qulonglong fileSize)
+OffsetCacheFile::load(const QString& completeFilePath)
{
if (!loadCache(completeFilePath))
{ //map file will close after finish of block
@@ -281,14 +281,14 @@ OffsetCacheFile::load(const QString& completeFilePath, \
qulonglong fileSize) return false;
}
- QByteArray byteArray = QByteArray::fromRawData(reinterpret_cast<const \
char*>(d->mappedData), fileSize); + QByteArray byteArray = \
QByteArray::fromRawData(reinterpret_cast<const char*>(d->mappedData), \
d->mapFile.size());
int position = 0;
d->pageOffsetList.clear();
int wordTerminatorOffsetSizeLength = 1 + 2 * sizeof(quint32);
d->wordCount = 0;
- while (fileSize < position)
+ while (d->mapFile.size() < position)
{
if (d->wordCount % d->pageEntryNumber == 0)
d->pageOffsetList.append(position);
diff --git a/plugins/stardict/offsetcachefile.h b/plugins/stardict/offsetcachefile.h
index bd8a611..66b35fe 100644
--- a/plugins/stardict/offsetcachefile.h
+++ b/plugins/stardict/offsetcachefile.h
@@ -76,7 +76,7 @@ namespace MulaPluginStarDict
// Loads the cache or creates if it does not exist
/** Reimplemented from AbstractIndexFile::load() */
- bool load(const QString& completeFilePath, qulonglong filesize);
+ bool load(const QString& completeFilePath);
/** Reimplemented from AbstractIndexFile::key() */
QByteArray key(long index);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic