Loading native/jni/com_android_inputmethod_latin_BinaryDictionary.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -230,8 +230,8 @@ static jfloat latinime_BinaryDictionary_calcNormalizedScore(JNIEnv *env, jobject env->GetCharArrayRegion(before, 0, beforeLength, beforeChars); env->GetCharArrayRegion(after, 0, afterLength, afterChars); return Correction::RankingAlgorithm::calcNormalizedScore( reinterpret_cast<unsigned short *>(beforeChars), beforeLength, reinterpret_cast<unsigned short *>(afterChars), afterLength, score); static_cast<unsigned short *>(beforeChars), beforeLength, static_cast<unsigned short *>(afterChars), afterLength, score); } static jint latinime_BinaryDictionary_editDistance(JNIEnv *env, jobject object, Loading @@ -243,8 +243,8 @@ static jint latinime_BinaryDictionary_editDistance(JNIEnv *env, jobject object, env->GetCharArrayRegion(before, 0, beforeLength, beforeChars); env->GetCharArrayRegion(after, 0, afterLength, afterChars); return Correction::RankingAlgorithm::editDistance( reinterpret_cast<unsigned short *>(beforeChars), beforeLength, reinterpret_cast<unsigned short *>(afterChars), afterLength); static_cast<unsigned short *>(beforeChars), beforeLength, static_cast<unsigned short *>(afterChars), afterLength); } static void latinime_BinaryDictionary_close(JNIEnv *env, jobject object, jlong dict) { Loading native/jni/src/bigram_dictionary.cpp +6 −7 Original line number Diff line number Diff line Loading @@ -60,16 +60,15 @@ bool BigramDictionary::addWordBigram(unsigned short *word, int length, int frequ AKLOGI("Bigram: InsertAt -> %d MAX_PREDICTIONS: %d", insertAt, MAX_PREDICTIONS); } if (insertAt < MAX_PREDICTIONS) { memmove(reinterpret_cast<char *>(bigramFreq) + (insertAt + 1) * sizeof(bigramFreq[0]), reinterpret_cast<char *>(bigramFreq) + insertAt * sizeof(bigramFreq[0]), memmove(bigramFreq + (insertAt + 1), bigramFreq + insertAt, (MAX_PREDICTIONS - insertAt - 1) * sizeof(bigramFreq[0])); bigramFreq[insertAt] = frequency; outputTypes[insertAt] = Dictionary::KIND_PREDICTION; memmove(reinterpret_cast<char *>(bigramChars) + (insertAt + 1) * MAX_WORD_LENGTH * sizeof(short), reinterpret_cast<char *>(bigramChars) + insertAt * MAX_WORD_LENGTH * sizeof(short), (MAX_PREDICTIONS - insertAt - 1) * sizeof(short) * MAX_WORD_LENGTH); unsigned short *dest = bigramChars + (insertAt ) * MAX_WORD_LENGTH; memmove(bigramChars + (insertAt + 1) * MAX_WORD_LENGTH, bigramChars + insertAt * MAX_WORD_LENGTH, (MAX_PREDICTIONS - insertAt - 1) * sizeof(bigramChars[0]) * MAX_WORD_LENGTH); unsigned short *dest = bigramChars + insertAt * MAX_WORD_LENGTH; while (length--) { *dest++ = *word++; } Loading native/jni/src/char_utils.cpp +3 −4 Original line number Diff line number Diff line Loading @@ -885,14 +885,13 @@ static const struct LatinCapitalSmallPair SORTED_CHAR_MAP[] = { }; static int compare_pair_capital(const void *a, const void *b) { return static_cast<int>(*reinterpret_cast<const unsigned short *>(a)) - static_cast<int>( (reinterpret_cast<const struct LatinCapitalSmallPair *>(b))->capital); return static_cast<int>(*static_cast<const unsigned short *>(a)) - static_cast<int>((static_cast<const struct LatinCapitalSmallPair *>(b))->capital); } unsigned short latin_tolower(unsigned short c) { struct LatinCapitalSmallPair *p = reinterpret_cast<struct LatinCapitalSmallPair *>(bsearch(&c, SORTED_CHAR_MAP, static_cast<struct LatinCapitalSmallPair *>(bsearch(&c, SORTED_CHAR_MAP, sizeof(SORTED_CHAR_MAP) / sizeof(SORTED_CHAR_MAP[0]), sizeof(SORTED_CHAR_MAP[0]), compare_pair_capital)); Loading native/jni/src/debug.h +1 −1 Original line number Diff line number Diff line Loading @@ -58,7 +58,7 @@ static inline void LOGI_S16_PLUS(unsigned short *string, const unsigned int leng } static inline void printDebug(const char *tag, int *codes, int codesSize, int MAX_PROXIMITY_CHARS) { unsigned char *buf = reinterpret_cast<unsigned char *>(malloc((1 + codesSize) * sizeof(*buf))); unsigned char *buf = static_cast<unsigned char *>(malloc((1 + codesSize) * sizeof(*buf))); buf[codesSize] = 0; while (--codesSize >= 0) { Loading native/jni/src/dictionary.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -32,8 +32,8 @@ namespace latinime { Dictionary::Dictionary(void *dict, int dictSize, int mmapFd, int dictBufAdjust, int typedLetterMultiplier, int fullWordMultiplier, int maxWordLength, int maxWords, int maxPredictions) : mDict(reinterpret_cast<unsigned char *>(dict)), mOffsetDict((reinterpret_cast<unsigned char *>(dict)) + BinaryFormat::getHeaderSize(mDict)), : mDict(static_cast<unsigned char *>(dict)), mOffsetDict((static_cast<unsigned char *>(dict)) + BinaryFormat::getHeaderSize(mDict)), mDictSize(dictSize), mMmapFd(mmapFd), mDictBufAdjust(dictBufAdjust) { if (DEBUG_DICT) { if (MAX_WORD_LENGTH_INTERNAL < maxWordLength) { Loading Loading
native/jni/com_android_inputmethod_latin_BinaryDictionary.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -230,8 +230,8 @@ static jfloat latinime_BinaryDictionary_calcNormalizedScore(JNIEnv *env, jobject env->GetCharArrayRegion(before, 0, beforeLength, beforeChars); env->GetCharArrayRegion(after, 0, afterLength, afterChars); return Correction::RankingAlgorithm::calcNormalizedScore( reinterpret_cast<unsigned short *>(beforeChars), beforeLength, reinterpret_cast<unsigned short *>(afterChars), afterLength, score); static_cast<unsigned short *>(beforeChars), beforeLength, static_cast<unsigned short *>(afterChars), afterLength, score); } static jint latinime_BinaryDictionary_editDistance(JNIEnv *env, jobject object, Loading @@ -243,8 +243,8 @@ static jint latinime_BinaryDictionary_editDistance(JNIEnv *env, jobject object, env->GetCharArrayRegion(before, 0, beforeLength, beforeChars); env->GetCharArrayRegion(after, 0, afterLength, afterChars); return Correction::RankingAlgorithm::editDistance( reinterpret_cast<unsigned short *>(beforeChars), beforeLength, reinterpret_cast<unsigned short *>(afterChars), afterLength); static_cast<unsigned short *>(beforeChars), beforeLength, static_cast<unsigned short *>(afterChars), afterLength); } static void latinime_BinaryDictionary_close(JNIEnv *env, jobject object, jlong dict) { Loading
native/jni/src/bigram_dictionary.cpp +6 −7 Original line number Diff line number Diff line Loading @@ -60,16 +60,15 @@ bool BigramDictionary::addWordBigram(unsigned short *word, int length, int frequ AKLOGI("Bigram: InsertAt -> %d MAX_PREDICTIONS: %d", insertAt, MAX_PREDICTIONS); } if (insertAt < MAX_PREDICTIONS) { memmove(reinterpret_cast<char *>(bigramFreq) + (insertAt + 1) * sizeof(bigramFreq[0]), reinterpret_cast<char *>(bigramFreq) + insertAt * sizeof(bigramFreq[0]), memmove(bigramFreq + (insertAt + 1), bigramFreq + insertAt, (MAX_PREDICTIONS - insertAt - 1) * sizeof(bigramFreq[0])); bigramFreq[insertAt] = frequency; outputTypes[insertAt] = Dictionary::KIND_PREDICTION; memmove(reinterpret_cast<char *>(bigramChars) + (insertAt + 1) * MAX_WORD_LENGTH * sizeof(short), reinterpret_cast<char *>(bigramChars) + insertAt * MAX_WORD_LENGTH * sizeof(short), (MAX_PREDICTIONS - insertAt - 1) * sizeof(short) * MAX_WORD_LENGTH); unsigned short *dest = bigramChars + (insertAt ) * MAX_WORD_LENGTH; memmove(bigramChars + (insertAt + 1) * MAX_WORD_LENGTH, bigramChars + insertAt * MAX_WORD_LENGTH, (MAX_PREDICTIONS - insertAt - 1) * sizeof(bigramChars[0]) * MAX_WORD_LENGTH); unsigned short *dest = bigramChars + insertAt * MAX_WORD_LENGTH; while (length--) { *dest++ = *word++; } Loading
native/jni/src/char_utils.cpp +3 −4 Original line number Diff line number Diff line Loading @@ -885,14 +885,13 @@ static const struct LatinCapitalSmallPair SORTED_CHAR_MAP[] = { }; static int compare_pair_capital(const void *a, const void *b) { return static_cast<int>(*reinterpret_cast<const unsigned short *>(a)) - static_cast<int>( (reinterpret_cast<const struct LatinCapitalSmallPair *>(b))->capital); return static_cast<int>(*static_cast<const unsigned short *>(a)) - static_cast<int>((static_cast<const struct LatinCapitalSmallPair *>(b))->capital); } unsigned short latin_tolower(unsigned short c) { struct LatinCapitalSmallPair *p = reinterpret_cast<struct LatinCapitalSmallPair *>(bsearch(&c, SORTED_CHAR_MAP, static_cast<struct LatinCapitalSmallPair *>(bsearch(&c, SORTED_CHAR_MAP, sizeof(SORTED_CHAR_MAP) / sizeof(SORTED_CHAR_MAP[0]), sizeof(SORTED_CHAR_MAP[0]), compare_pair_capital)); Loading
native/jni/src/debug.h +1 −1 Original line number Diff line number Diff line Loading @@ -58,7 +58,7 @@ static inline void LOGI_S16_PLUS(unsigned short *string, const unsigned int leng } static inline void printDebug(const char *tag, int *codes, int codesSize, int MAX_PROXIMITY_CHARS) { unsigned char *buf = reinterpret_cast<unsigned char *>(malloc((1 + codesSize) * sizeof(*buf))); unsigned char *buf = static_cast<unsigned char *>(malloc((1 + codesSize) * sizeof(*buf))); buf[codesSize] = 0; while (--codesSize >= 0) { Loading
native/jni/src/dictionary.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -32,8 +32,8 @@ namespace latinime { Dictionary::Dictionary(void *dict, int dictSize, int mmapFd, int dictBufAdjust, int typedLetterMultiplier, int fullWordMultiplier, int maxWordLength, int maxWords, int maxPredictions) : mDict(reinterpret_cast<unsigned char *>(dict)), mOffsetDict((reinterpret_cast<unsigned char *>(dict)) + BinaryFormat::getHeaderSize(mDict)), : mDict(static_cast<unsigned char *>(dict)), mOffsetDict((static_cast<unsigned char *>(dict)) + BinaryFormat::getHeaderSize(mDict)), mDictSize(dictSize), mMmapFd(mmapFd), mDictBufAdjust(dictBufAdjust) { if (DEBUG_DICT) { if (MAX_WORD_LENGTH_INTERNAL < maxWordLength) { Loading