Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cc470c78 authored by Jean Chalard's avatar Jean Chalard
Browse files

Move an implementation detail to native code (A107)

Java code does not have to know about this implementation detail:
the generic method should do the dispatching, instead of having
the caller call either method.

Change-Id: Ic13727f0cb18f4ced2c356cce2f8d710588c0421
parent 6a5d17cd
Loading
Loading
Loading
Loading
+11 −4
Original line number Diff line number Diff line
@@ -147,10 +147,17 @@ static int latinime_BinaryDictionary_getSuggestions(JNIEnv *env, jobject object,
    jint *prevWordChars = prevWordForBigrams
            ? env->GetIntArrayElements(prevWordForBigrams, 0) : 0;
    jsize prevWordLength = prevWordChars ? env->GetArrayLength(prevWordForBigrams) : 0;
    int count = dictionary->getSuggestions(pInfo, xCoordinates, yCoordinates, times, pointerIds,

    int count;
    if (isGesture || arraySize > 1) {
        count = dictionary->getSuggestions(pInfo, xCoordinates, yCoordinates, times, pointerIds,
                inputCodes, arraySize, prevWordChars, prevWordLength, commitPoint, isGesture,
            useFullEditDistance, (unsigned short*) outputChars,
            frequencies, spaceIndices);
                useFullEditDistance, (unsigned short*) outputChars, frequencies, spaceIndices);
    } else {
        count = dictionary->getBigrams(prevWordChars, prevWordLength, inputCodes,
                arraySize, (unsigned short*) outputChars, frequencies);
    }

    if (prevWordChars) {
        env->ReleaseIntArrayElements(prevWordForBigrams, prevWordChars, JNI_ABORT);
    }