diff options
author | 2009-10-06 15:38:24 -0700 | |
---|---|---|
committer | 2009-10-06 15:46:24 -0700 | |
commit | 379bcf8064ba44f94f84b7980b288167e677f137 (patch) | |
tree | fb8f8825acc7c4db66428929ef48f4aee120b17c | |
parent | 142dc94031549f449f8c13f502616f506cc5f2a7 (diff) | |
download | latinime-379bcf8064ba44f94f84b7980b288167e677f137.tar.gz latinime-379bcf8064ba44f94f84b7980b288167e677f137.tar.xz latinime-379bcf8064ba44f94f84b7980b288167e677f137.zip |
Fix a bug in suggestion algorithm not returning all matches. Fixes 2170908.
Native code was not returning the correct count for found matches. Fixed the
incorrect assumption that words usually get inserted in descending order of
frequency.
-rw-r--r-- | dictionary/src/dictionary.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/dictionary/src/dictionary.cpp b/dictionary/src/dictionary.cpp index cc711f419..fe5b4dc53 100644 --- a/dictionary/src/dictionary.cpp +++ b/dictionary/src/dictionary.cpp @@ -139,7 +139,8 @@ Dictionary::addWord(unsigned short *word, int length, int frequency) } *dest = 0; // NULL terminate // Update the word count - if (insertAt + 1 > mWords) mWords = insertAt + 1; + mWords = 0; + while (mFrequencies[mWords] > 0) mWords++; if (DEBUG_DICT) LOGI("Added word at %d\n", insertAt); return true; } |