Small cleanups

Change-Id: I3e5862a405b4c63616c7ea947cd53c52b5035862
main
Ken Wakasa 2013-01-30 01:04:42 +09:00
parent 3079b71964
commit cffb3126ac
4 changed files with 6 additions and 6 deletions

View File

@ -87,7 +87,7 @@ static jlong latinime_BinaryDictionary_open(JNIEnv *env, jclass clazz, jstring s
AKLOGE("DICT: Can't allocate memory region for dictionary. errno=%d", errno);
return 0;
}
int ret = fseek(file, (long)dictOffset, SEEK_SET);
int ret = fseek(file, static_cast<long>(dictOffset), SEEK_SET);
if (ret != 0) {
AKLOGE("DICT: Failure in fseek. ret=%d errno=%d", ret, errno);
return 0;
@ -121,7 +121,7 @@ static jlong latinime_BinaryDictionary_open(JNIEnv *env, jclass clazz, jstring s
}
PROF_END(66);
PROF_CLOSE;
return (jlong)dictionary;
return reinterpret_cast<jlong>(dictionary);
}
static int latinime_BinaryDictionary_getSuggestions(JNIEnv *env, jclass clazz, jlong dict,
@ -216,7 +216,7 @@ static jint latinime_BinaryDictionary_getFrequency(JNIEnv *env, jclass clazz, jl
static jboolean latinime_BinaryDictionary_isValidBigram(JNIEnv *env, jclass clazz, jlong dict,
jintArray wordArray1, jintArray wordArray2) {
Dictionary *dictionary = reinterpret_cast<Dictionary *>(dict);
if (!dictionary) return (jboolean) false;
if (!dictionary) return JNI_FALSE;
const jsize codePointLength1 = env->GetArrayLength(wordArray1);
const jsize codePointLength2 = env->GetArrayLength(wordArray2);
int codePoints1[codePointLength1];

View File

@ -314,7 +314,7 @@ static inline int childrenAddressSize(const uint8_t flags) {
}
static AK_FORCE_INLINE int shortcutByteSize(const uint8_t *const dict, const int pos) {
return ((int)(dict[pos] << 8)) + (dict[pos + 1]);
return (static_cast<int>(dict[pos] << 8)) + (dict[pos + 1]);
}
inline int BinaryFormat::skipChildrenPosition(const uint8_t flags, const int pos) {

View File

@ -677,7 +677,7 @@ inline static bool isUpperCase(unsigned short c) {
const float factor =
SuggestUtils::getDistanceScalingFactor(static_cast<float>(squaredDistance));
if (factor > 0.0f) {
multiplyRate((int)(factor * 100.0f), &finalFreq);
multiplyRate(static_cast<int>(factor * 100.0f), &finalFreq);
} else if (squaredDistance == PROXIMITY_CHAR_WITHOUT_DISTANCE_INFO) {
multiplyRate(WORDS_WITH_PROXIMITY_CHARACTER_DEMOTION_RATE, &finalFreq);
}

View File

@ -211,7 +211,7 @@ namespace latinime {
ProximityInfoParams::NOT_A_DISTANCE_FLOAT;
if (squaredDistance >= 0.0f) {
normalizedSquaredDistances[i * MAX_PROXIMITY_CHARS_SIZE + j] =
(int) (squaredDistance
static_cast<int>(squaredDistance
* ProximityInfoParams::NORMALIZED_SQUARED_DISTANCE_SCALING_FACTOR);
} else {
normalizedSquaredDistances[i * MAX_PROXIMITY_CHARS_SIZE + j] =