Loading native/jni/src/suggest/policyimpl/dictionary/bigram/dynamic_bigram_list_policy.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -325,7 +325,7 @@ int DynamicBigramListPolicy::followBigramLinkAndGetCurrentBigramPtNodePos( nodeReader.fetchNodeInfoInBufferFromPtNodePos(currentPos); bigramLinkCount++; if (bigramLinkCount > CONTINUING_BIGRAM_LINK_COUNT_LIMIT) { AKLOGE("Bigram link is invalid. start position: %d", bigramPos); AKLOGE("Bigram link is invalid. start position: %d", originalBigramPos); ASSERT(false); return NOT_A_DICT_POS; } Loading native/jni/src/suggest/policyimpl/dictionary/dynamic_patricia_trie_reading_helper.h +1 −1 Original line number Diff line number Diff line Loading @@ -263,7 +263,7 @@ class DynamicPatriciaTrieReadingHelper { AK_FORCE_INLINE void pushReadingStateToStack() { if (mReadingStateStack.size() > MAX_READING_STATE_STACK_SIZE) { AKLOGI("Reading state stack overflow. Max size: %d", MAX_READING_STATE_STACK_SIZE); AKLOGI("Reading state stack overflow. Max size: %zd", MAX_READING_STATE_STACK_SIZE); ASSERT(false); mIsError = true; mReadingState.mPos = NOT_A_DICT_POS; Loading native/jni/src/suggest/policyimpl/dictionary/patricia_trie_policy.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -416,6 +416,11 @@ int PatriciaTriePolicy::createAndGetLeavingChildNode(const DicNode *const dicNod if (PatriciaTrieReadingUtils::hasBigrams(flags)) { getBigramsStructurePolicy()->skipAllBigrams(&pos); } if (mergedNodeCodePointCount <= 0) { AKLOGE("Empty PtNode is not allowed. Code point count: %d", mergedNodeCodePointCount); ASSERT(false); return pos; } childDicNodes->pushLeavingChild(dicNode, ptNodePos, childrenPos, probability, PatriciaTrieReadingUtils::isTerminal(flags), PatriciaTrieReadingUtils::hasChildrenInFlags(flags), Loading native/jni/src/suggest/policyimpl/dictionary/patricia_trie_reading_utils.cpp +11 −2 Original line number Diff line number Diff line Loading @@ -71,8 +71,17 @@ const PtReadingUtils::NodeFlags PtReadingUtils::FLAG_IS_BLACKLISTED = 0x01; length = ByteArrayUtils::readStringAndAdvancePosition(buffer, maxLength, outBuffer, pos); } else { if (maxLength > 0) { outBuffer[0] = getCodePointAndAdvancePosition(buffer, pos); const int codePoint = getCodePointAndAdvancePosition(buffer, pos); if (codePoint == NOT_A_CODE_POINT) { // CAVEAT: codePoint == NOT_A_CODE_POINT means the code point is // CHARACTER_ARRAY_TERMINATOR. The code point must not be CHARACTER_ARRAY_TERMINATOR // when the PtNode has a single code point. length = 0; AKLOGE("codePoint is NOT_A_CODE_POINT. pos: %d, codePoint: 0x%x, buffer[pos - 1]: 0x%x", *pos - 1, codePoint, buffer[*pos - 1]); ASSERT(false); } else if (maxLength > 0) { outBuffer[0] = codePoint; length = 1; } } Loading Loading
native/jni/src/suggest/policyimpl/dictionary/bigram/dynamic_bigram_list_policy.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -325,7 +325,7 @@ int DynamicBigramListPolicy::followBigramLinkAndGetCurrentBigramPtNodePos( nodeReader.fetchNodeInfoInBufferFromPtNodePos(currentPos); bigramLinkCount++; if (bigramLinkCount > CONTINUING_BIGRAM_LINK_COUNT_LIMIT) { AKLOGE("Bigram link is invalid. start position: %d", bigramPos); AKLOGE("Bigram link is invalid. start position: %d", originalBigramPos); ASSERT(false); return NOT_A_DICT_POS; } Loading
native/jni/src/suggest/policyimpl/dictionary/dynamic_patricia_trie_reading_helper.h +1 −1 Original line number Diff line number Diff line Loading @@ -263,7 +263,7 @@ class DynamicPatriciaTrieReadingHelper { AK_FORCE_INLINE void pushReadingStateToStack() { if (mReadingStateStack.size() > MAX_READING_STATE_STACK_SIZE) { AKLOGI("Reading state stack overflow. Max size: %d", MAX_READING_STATE_STACK_SIZE); AKLOGI("Reading state stack overflow. Max size: %zd", MAX_READING_STATE_STACK_SIZE); ASSERT(false); mIsError = true; mReadingState.mPos = NOT_A_DICT_POS; Loading
native/jni/src/suggest/policyimpl/dictionary/patricia_trie_policy.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -416,6 +416,11 @@ int PatriciaTriePolicy::createAndGetLeavingChildNode(const DicNode *const dicNod if (PatriciaTrieReadingUtils::hasBigrams(flags)) { getBigramsStructurePolicy()->skipAllBigrams(&pos); } if (mergedNodeCodePointCount <= 0) { AKLOGE("Empty PtNode is not allowed. Code point count: %d", mergedNodeCodePointCount); ASSERT(false); return pos; } childDicNodes->pushLeavingChild(dicNode, ptNodePos, childrenPos, probability, PatriciaTrieReadingUtils::isTerminal(flags), PatriciaTrieReadingUtils::hasChildrenInFlags(flags), Loading
native/jni/src/suggest/policyimpl/dictionary/patricia_trie_reading_utils.cpp +11 −2 Original line number Diff line number Diff line Loading @@ -71,8 +71,17 @@ const PtReadingUtils::NodeFlags PtReadingUtils::FLAG_IS_BLACKLISTED = 0x01; length = ByteArrayUtils::readStringAndAdvancePosition(buffer, maxLength, outBuffer, pos); } else { if (maxLength > 0) { outBuffer[0] = getCodePointAndAdvancePosition(buffer, pos); const int codePoint = getCodePointAndAdvancePosition(buffer, pos); if (codePoint == NOT_A_CODE_POINT) { // CAVEAT: codePoint == NOT_A_CODE_POINT means the code point is // CHARACTER_ARRAY_TERMINATOR. The code point must not be CHARACTER_ARRAY_TERMINATOR // when the PtNode has a single code point. length = 0; AKLOGE("codePoint is NOT_A_CODE_POINT. pos: %d, codePoint: 0x%x, buffer[pos - 1]: 0x%x", *pos - 1, codePoint, buffer[*pos - 1]); ASSERT(false); } else if (maxLength > 0) { outBuffer[0] = codePoint; length = 1; } } Loading