diff options
-rw-r--r-- | java/src/com/android/inputmethod/latin/makedict/BinaryDictInputOutput.java | 2 | ||||
-rw-r--r-- | java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java | 2 | ||||
-rw-r--r-- | native/jni/src/correction.cpp | 9 | ||||
-rw-r--r-- | native/jni/src/correction.h | 5 | ||||
-rw-r--r-- | native/jni/src/defines.h | 3 | ||||
-rw-r--r-- | native/jni/src/proximity_info.cpp | 1 | ||||
-rw-r--r-- | native/jni/src/terminal_attributes.h | 1 |
7 files changed, 7 insertions, 16 deletions
diff --git a/java/src/com/android/inputmethod/latin/makedict/BinaryDictInputOutput.java b/java/src/com/android/inputmethod/latin/makedict/BinaryDictInputOutput.java index fb1eb2701..f1a7e97e8 100644 --- a/java/src/com/android/inputmethod/latin/makedict/BinaryDictInputOutput.java +++ b/java/src/com/android/inputmethod/latin/makedict/BinaryDictInputOutput.java @@ -1412,8 +1412,6 @@ public final class BinaryDictInputOutput { private static WeightedString getWordAtAddressWithParentAddress( final FusionDictionaryBufferInterface buffer, final int headerSize, final int address, final FormatOptions options) { - final StringBuilder builder = new StringBuilder(); - int currentAddress = address; int index = FormatSpec.MAX_WORD_LENGTH - 1; int frequency = Integer.MIN_VALUE; diff --git a/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java b/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java index 2f146f86c..89d6c9010 100644 --- a/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java +++ b/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java @@ -294,6 +294,8 @@ public final class AndroidSpellCheckerService extends SpellCheckerService final String[] gatheredSuggestions; final boolean hasRecommendedSuggestions; if (0 == mLength) { + // TODO: the comment below describes what is intended, but in the practice + // mBestSuggestion is only ever set to null so it doesn't work. Fix this. // Either we found no suggestions, or we found some BUT the max length was 0. // If we found some mBestSuggestion will not be null. If it is null, then // we found none, regardless of the max length. diff --git a/native/jni/src/correction.cpp b/native/jni/src/correction.cpp index 50f33fe23..46ca91105 100644 --- a/native/jni/src/correction.cpp +++ b/native/jni/src/correction.cpp @@ -14,11 +14,6 @@ * limitations under the License. */ -#include <cassert> -#include <cctype> -#include <cmath> -#include <cstring> - #define LOG_TAG "LatinIME: correction.cpp" #include "char_utils.h" @@ -1002,7 +997,7 @@ int Correction::RankingAlgorithm::editDistance(const int *before, const int befo float Correction::RankingAlgorithm::calcNormalizedScore(const int *before, const int beforeLength, const int *after, const int afterLength, const int score) { if (0 == beforeLength || 0 == afterLength) { - return 0; + return 0.0f; } const int distance = editDistance(before, beforeLength, after, afterLength); int spaceCount = 0; @@ -1013,7 +1008,7 @@ float Correction::RankingAlgorithm::calcNormalizedScore(const int *before, const } if (spaceCount == afterLength) { - return 0; + return 0.0f; } const float maxScore = score >= S_INT_MAX ? static_cast<float>(S_INT_MAX) diff --git a/native/jni/src/correction.h b/native/jni/src/correction.h index 912cd838e..4184c6429 100644 --- a/native/jni/src/correction.h +++ b/native/jni/src/correction.h @@ -19,7 +19,6 @@ #include <cassert> #include <cstring> // for memset() -#include <stdint.h> #include "correction_state.h" #include "defines.h" @@ -237,7 +236,7 @@ class Correction { int mTerminalOutputIndex; int mMaxErrors; - uint8_t mTotalTraverseCount; + int mTotalTraverseCount; // The following arrays are state buffer. int mWord[MAX_WORD_LENGTH_INTERNAL]; @@ -352,7 +351,7 @@ AK_FORCE_INLINE static void calcEditDistanceOneStep(int *editDistanceTable, cons const int prevCO = outputLength >= 2 ? toBaseLowerCase(output[outputLength - 2]) : 0; for (int i = 1; i <= inputSize; ++i) { const int ci = toBaseLowerCase(input[i - 1]); - const uint16_t cost = (ci == co) ? 0 : 1; + const int cost = (ci == co) ? 0 : 1; current[i] = min(current[i - 1] + 1, min(prev[i] + 1, prev[i - 1] + cost)); if (i >= 2 && prevprev && ci == prevCO && co == toBaseLowerCase(input[i - 2])) { current[i] = min(current[i], prevprev[i - 2] + 1); diff --git a/native/jni/src/defines.h b/native/jni/src/defines.h index 3d7ba4f36..90f714bec 100644 --- a/native/jni/src/defines.h +++ b/native/jni/src/defines.h @@ -237,9 +237,6 @@ static inline void prof_out(void) { #endif // FLAG_DBG -#ifndef U_SHORT_MAX -#define U_SHORT_MAX 65535 // ((1 << 16) - 1) -#endif #ifndef S_INT_MAX #define S_INT_MAX 2147483647 // ((1 << 31) - 1) #endif diff --git a/native/jni/src/proximity_info.cpp b/native/jni/src/proximity_info.cpp index d38ea670c..ffe12ce49 100644 --- a/native/jni/src/proximity_info.cpp +++ b/native/jni/src/proximity_info.cpp @@ -15,7 +15,6 @@ */ #include <cassert> -#include <cmath> #include <cstring> #define LOG_TAG "LatinIME: proximity_info.cpp" diff --git a/native/jni/src/terminal_attributes.h b/native/jni/src/terminal_attributes.h index fed3c7251..6c2e0dce1 100644 --- a/native/jni/src/terminal_attributes.h +++ b/native/jni/src/terminal_attributes.h @@ -17,6 +17,7 @@ #ifndef LATINIME_TERMINAL_ATTRIBUTES_H #define LATINIME_TERMINAL_ATTRIBUTES_H +#include <stdint.h> #include "binary_format.h" namespace latinime { |