aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderUtils.java
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2014-10-21 15:06:54 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-10-21 15:06:55 +0000
commit46a007261fcbfbe887e22ecdf16307f95b1e4024 (patch)
treed47b90911c51c7ff6eabb6466f47a84d4574cbba /tests/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderUtils.java
parent0b8bb0c21bda18e77a52d980891d56430e113a6f (diff)
parent5f00fe09e9a611b647592188316e5999465df4d3 (diff)
downloadlatinime-46a007261fcbfbe887e22ecdf16307f95b1e4024.tar.gz
latinime-46a007261fcbfbe887e22ecdf16307f95b1e4024.tar.xz
latinime-46a007261fcbfbe887e22ecdf16307f95b1e4024.zip
Merge "Fix some compiler warnings"
Diffstat (limited to 'tests/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderUtils.java')
-rw-r--r--tests/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderUtils.java17
1 files changed, 9 insertions, 8 deletions
diff --git a/tests/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderUtils.java b/tests/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderUtils.java
index 1f3ee19af..21411f24c 100644
--- a/tests/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderUtils.java
+++ b/tests/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderUtils.java
@@ -113,15 +113,16 @@ public final class BinaryDictDecoderUtils {
/**
* Helper method to find out whether this code fits on one byte
*/
- private static boolean fitsOnOneByte(int character,
+ private static boolean fitsOnOneByte(final int character,
final HashMap<Integer, Integer> codePointToOneByteCodeMap) {
+ int codePoint = character;
if (codePointToOneByteCodeMap != null) {
if (codePointToOneByteCodeMap.containsKey(character)) {
- character = codePointToOneByteCodeMap.get(character);
+ codePoint = codePointToOneByteCodeMap.get(character);
}
}
- return character >= FormatSpec.MINIMAL_ONE_BYTE_CHARACTER_VALUE
- && character <= FormatSpec.MAXIMAL_ONE_BYTE_CHARACTER_VALUE;
+ return codePoint >= FormatSpec.MINIMAL_ONE_BYTE_CHARACTER_VALUE
+ && codePoint <= FormatSpec.MAXIMAL_ONE_BYTE_CHARACTER_VALUE;
}
/**
@@ -168,8 +169,9 @@ public final class BinaryDictDecoderUtils {
* @param codePointToOneByteCodeMap the map to convert the code point.
* @return the index after the last character.
*/
- static int writeCharArray(final int[] codePoints, final byte[] buffer, int index,
+ static int writeCharArray(final int[] codePoints, final byte[] buffer, final int fromIndex,
final HashMap<Integer, Integer> codePointToOneByteCodeMap) {
+ int index = fromIndex;
for (int codePoint : codePoints) {
if (codePointToOneByteCodeMap != null) {
if (codePointToOneByteCodeMap.containsKey(codePoint)) {
@@ -293,10 +295,9 @@ public final class BinaryDictDecoderUtils {
final int msb = dictBuffer.readUnsignedByte();
if (FormatSpec.MAX_PTNODES_FOR_ONE_BYTE_PTNODE_COUNT >= msb) {
return msb;
- } else {
- return ((FormatSpec.MAX_PTNODES_FOR_ONE_BYTE_PTNODE_COUNT & msb) << 8)
- + dictBuffer.readUnsignedByte();
}
+ return ((FormatSpec.MAX_PTNODES_FOR_ONE_BYTE_PTNODE_COUNT & msb) << 8)
+ + dictBuffer.readUnsignedByte();
}
/**