am 7f14894f: Merge "Fix: wrong bigram entry pos can be used during GC."
* commit '7f14894f2f38f8dade230c53dd5a1410c40f7e0d': Fix: wrong bigram entry pos can be used during GC.main
commit
fd0a722758
|
@ -175,9 +175,9 @@ bool Ver4BigramListPolicy::updateAllBigramEntriesAndDeleteUselessEntries(const i
|
||||||
bool hasNext = true;
|
bool hasNext = true;
|
||||||
int readingPos = bigramListPos;
|
int readingPos = bigramListPos;
|
||||||
while (hasNext) {
|
while (hasNext) {
|
||||||
const int entryPos = readingPos;
|
|
||||||
const BigramEntry bigramEntry =
|
const BigramEntry bigramEntry =
|
||||||
mBigramDictContent->getBigramEntryAndAdvancePosition(&readingPos);
|
mBigramDictContent->getBigramEntryAndAdvancePosition(&readingPos);
|
||||||
|
const int entryPos = readingPos - mBigramDictContent->getBigramEntrySize();
|
||||||
hasNext = bigramEntry.hasNext();
|
hasNext = bigramEntry.hasNext();
|
||||||
if (!bigramEntry.isValid()) {
|
if (!bigramEntry.isValid()) {
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -242,9 +242,9 @@ bool Ver4PatriciaTrieWritingHelper::truncateBigrams(const int maxBigramCount) {
|
||||||
bool hasNext = true;
|
bool hasNext = true;
|
||||||
int readingPos = bigramListPos;
|
int readingPos = bigramListPos;
|
||||||
while (hasNext) {
|
while (hasNext) {
|
||||||
const int entryPos = readingPos;
|
|
||||||
const BigramEntry bigramEntry =
|
const BigramEntry bigramEntry =
|
||||||
bigramDictContent->getBigramEntryAndAdvancePosition(&readingPos);
|
bigramDictContent->getBigramEntryAndAdvancePosition(&readingPos);
|
||||||
|
const int entryPos = readingPos - bigramDictContent->getBigramEntrySize();
|
||||||
hasNext = bigramEntry.hasNext();
|
hasNext = bigramEntry.hasNext();
|
||||||
if (!bigramEntry.isValid()) {
|
if (!bigramEntry.isValid()) {
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in New Issue