aboutsummaryrefslogtreecommitdiffstats
path: root/native/jni/src/binary_format.h
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2012-09-06 20:37:55 +0900
committerJean Chalard <jchalard@google.com>2012-09-06 20:37:55 +0900
commit18ebba3a665906e17c77f532723a2ebf5f3d2f38 (patch)
treef49a68f6e65f6cf370f9428d7399ddc3bb312113 /native/jni/src/binary_format.h
parent15496ec4d7ea2b780fbc66f2debda0b8dcc3d3c8 (diff)
downloadlatinime-18ebba3a665906e17c77f532723a2ebf5f3d2f38.tar.gz
latinime-18ebba3a665906e17c77f532723a2ebf5f3d2f38.tar.xz
latinime-18ebba3a665906e17c77f532723a2ebf5f3d2f38.zip
Fix one-off bugs reported by Valgrind
Bug: 7108990 Change-Id: I40ba30f50a26b65bcac905fc005ad6bb9cb034cc
Diffstat (limited to 'native/jni/src/binary_format.h')
-rw-r--r--native/jni/src/binary_format.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/native/jni/src/binary_format.h b/native/jni/src/binary_format.h
index 5d8b2a0f2..eec52e323 100644
--- a/native/jni/src/binary_format.h
+++ b/native/jni/src/binary_format.h
@@ -360,7 +360,7 @@ inline int BinaryFormat::getTerminalPosition(const uint8_t *const root,
while (true) {
// If we already traversed the tree further than the word is long, there means
// there was no match (or we would have found it).
- if (wordPos > length) return NOT_VALID_WORD;
+ if (wordPos >= length) return NOT_VALID_WORD;
int charGroupCount = BinaryFormat::getGroupCountAndForwardPointer(root, &pos);
const int32_t wChar = forceLowerCaseSearch ? toLowerCase(inWord[wordPos]) : inWord[wordPos];
while (true) {
@@ -383,7 +383,7 @@ inline int BinaryFormat::getTerminalPosition(const uint8_t *const root,
// character that does not match, as explained above, it means the word is
// not in the dictionary (by virtue of this chargroup being the only one to
// match the word on the first character, but not matching the whole word).
- if (wordPos > length) return NOT_VALID_WORD;
+ if (wordPos >= length) return NOT_VALID_WORD;
if (inWord[wordPos] != character) return NOT_VALID_WORD;
character = BinaryFormat::getCodePointAndForwardPointer(root, &pos);
}