diff options
4 files changed, 6 insertions, 5 deletions
diff --git a/java/res/values/strings.xml b/java/res/values/strings.xml index 1eff2f9c3..aae5b0b70 100644 --- a/java/res/values/strings.xml +++ b/java/res/values/strings.xml @@ -388,7 +388,7 @@ Cyrillic, Arabic, Hebrew or other scripts. This keyboard offers no suggestions, be a QWERTY, or AZERTY, or any other disposition that only offers Latin characters, so you wouldn't be able to type, say, Arabic on it. Please translate it in a way that "alphabet" would be understood to mean specifically the Latin alphabet, rather than any other -alphabet. [CHAR LIMIT=25] --> +alphabet. [CHAR LIMIT=29] --> <string name="subtype_no_language">No language (Alphabet)</string> <!-- This string is displayed in the description for a keyboard type. It refers specifically to the Latin alphabet, as opposed to Cyrillic, Arabic, Hebrew or other scripts. diff --git a/native/jni/src/suggest/policyimpl/dictionary/dynamic_patricia_trie_node_reader.cpp b/native/jni/src/suggest/policyimpl/dictionary/dynamic_patricia_trie_node_reader.cpp index 20cda91a3..7ac635a00 100644 --- a/native/jni/src/suggest/policyimpl/dictionary/dynamic_patricia_trie_node_reader.cpp +++ b/native/jni/src/suggest/policyimpl/dictionary/dynamic_patricia_trie_node_reader.cpp @@ -27,7 +27,9 @@ void DynamicPatriciaTrieNodeReader::fetchNodeInfoFromBufferAndProcessMovedNode(c const uint8_t *const dictRoot = mBinaryDictionaryInfo->getDictRoot(); int pos = nodePos; mFlags = PatriciaTrieReadingUtils::getFlagsAndAdvancePosition(dictRoot, &pos); - mParentPos = DynamicPatriciaTrieReadingUtils::getParentPosAndAdvancePosition(dictRoot, &pos); + const int parentPos = + DynamicPatriciaTrieReadingUtils::getParentPosAndAdvancePosition(dictRoot, &pos); + mParentPos = (parentPos != 0) ? mNodePos + parentPos : NOT_A_DICT_POS; if (outCodePoints != 0) { mCodePointCount = PatriciaTrieReadingUtils::getCharsAndAdvancePosition( dictRoot, mFlags, maxCodePointCount, outCodePoints, &pos); diff --git a/native/jni/src/suggest/policyimpl/dictionary/dynamic_patricia_trie_policy.cpp b/native/jni/src/suggest/policyimpl/dictionary/dynamic_patricia_trie_policy.cpp index 0b73efae3..3df505688 100644 --- a/native/jni/src/suggest/policyimpl/dictionary/dynamic_patricia_trie_policy.cpp +++ b/native/jni/src/suggest/policyimpl/dictionary/dynamic_patricia_trie_policy.cpp @@ -94,7 +94,7 @@ int DynamicPatriciaTriePolicy::getCodePointsAndProbabilityAndReturnCodePointCoun reverseCodePoints[codePointCount++] = mergedNodeCodePoints[i]; } // Then, follow parent pos toward the root node. - while (nodeReader.getParentPos() != getRootPosition()) { + while (nodeReader.getParentPos() != NOT_A_DICT_POS) { // codePointCount must be incremented at least once in each iteration to ensure preventing // infinite loop. if (nodeReader.isDeleted() || codePointCount > maxCodePointCount diff --git a/native/jni/src/suggest/policyimpl/dictionary/dynamic_patricia_trie_reading_utils.h b/native/jni/src/suggest/policyimpl/dictionary/dynamic_patricia_trie_reading_utils.h index f44c2651a..5398d7e37 100644 --- a/native/jni/src/suggest/policyimpl/dictionary/dynamic_patricia_trie_reading_utils.h +++ b/native/jni/src/suggest/policyimpl/dictionary/dynamic_patricia_trie_reading_utils.h @@ -39,8 +39,7 @@ class DynamicPatriciaTrieReadingUtils { static AK_FORCE_INLINE int getParentPosAndAdvancePosition(const uint8_t *const buffer, int *const pos) { - const int base = *pos; - return base + ByteArrayUtils::readSint24AndAdvancePosition(buffer, pos); + return ByteArrayUtils::readSint24AndAdvancePosition(buffer, pos); } static int readChildrenPositionAndAdvancePosition(const uint8_t *const buffer, |