Fix: wrong bigram entry pos can be used during GC.

Bug: 14425059
Change-Id: I4e7c977c5ef184953682175b118de5473cdb64a6
Keisuke Kuroyanagi 2014-07-09 11:18:35 +09:00
parent cc8f4491e3
commit 198be3a6c5
2 changed files with 2 additions and 2 deletions

View File

@ -175,9 +175,9 @@ bool Ver4BigramListPolicy::updateAllBigramEntriesAndDeleteUselessEntries(const i
bool hasNext = true;
int readingPos = bigramListPos;
while (hasNext) {
const int entryPos = readingPos;
const BigramEntry bigramEntry =
mBigramDictContent->getBigramEntryAndAdvancePosition(&readingPos);
const int entryPos = readingPos - mBigramDictContent->getBigramEntrySize();
hasNext = bigramEntry.hasNext();
if (!bigramEntry.isValid()) {
continue;

View File

@ -242,9 +242,9 @@ bool Ver4PatriciaTrieWritingHelper::truncateBigrams(const int maxBigramCount) {
bool hasNext = true;
int readingPos = bigramListPos;
while (hasNext) {
const int entryPos = readingPos;
const BigramEntry bigramEntry =
bigramDictContent->getBigramEntryAndAdvancePosition(&readingPos);
const int entryPos = readingPos - bigramDictContent->getBigramEntrySize();
hasNext = bigramEntry.hasNext();
if (!bigramEntry.isValid()) {
continue;