Merge "Allow reading a binary dictionary even without proximity info."

main
Jean Chalard 2011-06-01 23:56:34 -07:00 committed by Android (Google) Code Review
commit 42bbcd69c0
4 changed files with 4 additions and 4 deletions

View File

@ -196,8 +196,9 @@ public class BinaryDictionary extends Dictionary {
Arrays.fill(outputChars, (char) 0); Arrays.fill(outputChars, (char) 0);
Arrays.fill(scores, 0); Arrays.fill(scores, 0);
final int proximityInfo = keyboard == null ? 0 : keyboard.getProximityInfo();
return getSuggestionsNative( return getSuggestionsNative(
mNativeDict, keyboard.getProximityInfo(), mNativeDict, proximityInfo,
codes.getXCoordinates(), codes.getYCoordinates(), mInputCodes, codesSize, codes.getXCoordinates(), codes.getYCoordinates(), mInputCodes, codesSize,
mFlags, outputChars, scores); mFlags, outputChars, scores);
} }

View File

@ -131,7 +131,6 @@ static int latinime_BinaryDictionary_getSuggestions(JNIEnv *env, jobject object,
Dictionary *dictionary = (Dictionary*)dict; Dictionary *dictionary = (Dictionary*)dict;
if (!dictionary) return 0; if (!dictionary) return 0;
ProximityInfo *pInfo = (ProximityInfo*)proximityInfo; ProximityInfo *pInfo = (ProximityInfo*)proximityInfo;
if (!pInfo) return 0;
int *xCoordinates = env->GetIntArrayElements(xCoordinatesArray, NULL); int *xCoordinates = env->GetIntArrayElements(xCoordinatesArray, NULL);
int *yCoordinates = env->GetIntArrayElements(yCoordinatesArray, NULL); int *yCoordinates = env->GetIntArrayElements(yCoordinatesArray, NULL);

View File

@ -53,7 +53,7 @@ bool Dictionary::hasBigram() {
return ((mDict[1] & 0xFF) == 1); return ((mDict[1] & 0xFF) == 1);
} }
// TODO: use uint16_t instead of unsigned short // TODO: use uint32_t instead of unsigned short
bool Dictionary::isValidWord(unsigned short *word, int length) { bool Dictionary::isValidWord(unsigned short *word, int length) {
if (IS_LATEST_DICT_VERSION) { if (IS_LATEST_DICT_VERSION) {
return (isValidWordRec(DICTIONARY_HEADER_SIZE, word, 0, length) != NOT_VALID_WORD); return (isValidWordRec(DICTIONARY_HEADER_SIZE, word, 0, length) != NOT_VALID_WORD);

View File

@ -233,7 +233,7 @@ void UnigramDictionary::getWordSuggestions(const ProximityInfo *proximityInfo,
PROF_END(5); PROF_END(5);
PROF_START(6); PROF_START(6);
if (SUGGEST_WORDS_WITH_SPACE_PROXIMITY) { if (SUGGEST_WORDS_WITH_SPACE_PROXIMITY && proximityInfo) {
// The first and last "mistyped spaces" are taken care of by excessive character handling // The first and last "mistyped spaces" are taken care of by excessive character handling
for (int i = 1; i < codesSize - 1; ++i) { for (int i = 1; i < codesSize - 1; ++i) {
if (DEBUG_DICT) { if (DEBUG_DICT) {