Cleanup headers.

Change-Id: Ied1bedb8ba5fae590987ea23bed32f4db1a60d77
This commit is contained in:
Ken Wakasa 2012-08-08 16:46:16 +09:00
parent 732f27984e
commit 9b392364b7
4 changed files with 9 additions and 12 deletions

View file

@ -16,8 +16,6 @@
#define LOG_TAG "LatinIME: jni: ProximityInfo" #define LOG_TAG "LatinIME: jni: ProximityInfo"
#include <string>
#include "com_android_inputmethod_keyboard_ProximityInfo.h" #include "com_android_inputmethod_keyboard_ProximityInfo.h"
#include "jni.h" #include "jni.h"
#include "jni_common.h" #include "jni_common.h"
@ -26,14 +24,13 @@
namespace latinime { namespace latinime {
static jlong latinime_Keyboard_setProximityInfo(JNIEnv *env, jobject object, static jlong latinime_Keyboard_setProximityInfo(JNIEnv *env, jobject object,
jstring localejStr, jint maxProximityCharsSize, jint displayWidth, jint displayHeight, jstring localeJStr, jint maxProximityCharsSize, jint displayWidth, jint displayHeight,
jint gridWidth, jint gridHeight, jint mostCommonkeyWidth, jintArray proximityCharsArray, jint gridWidth, jint gridHeight, jint mostCommonkeyWidth, jintArray proximityCharsArray,
jint keyCount, jintArray keyXCoordinateArray, jintArray keyYCoordinateArray, jint keyCount, jintArray keyXCoordinateArray, jintArray keyYCoordinateArray,
jintArray keyWidthArray, jintArray keyHeightArray, jintArray keyCharCodeArray, jintArray keyWidthArray, jintArray keyHeightArray, jintArray keyCharCodeArray,
jfloatArray sweetSpotCenterXArray, jfloatArray sweetSpotCenterYArray, jfloatArray sweetSpotCenterXArray, jfloatArray sweetSpotCenterYArray,
jfloatArray sweetSpotRadiusArray) { jfloatArray sweetSpotRadiusArray) {
const char *localeStrPtr = env->GetStringUTFChars(localejStr, 0); const char *localeCStr = env->GetStringUTFChars(localeJStr, 0);
const std::string localeStr(localeStrPtr);
jint *proximityChars = env->GetIntArrayElements(proximityCharsArray, 0); jint *proximityChars = env->GetIntArrayElements(proximityCharsArray, 0);
jint *keyXCoordinates = safeGetIntArrayElements(env, keyXCoordinateArray); jint *keyXCoordinates = safeGetIntArrayElements(env, keyXCoordinateArray);
jint *keyYCoordinates = safeGetIntArrayElements(env, keyYCoordinateArray); jint *keyYCoordinates = safeGetIntArrayElements(env, keyYCoordinateArray);
@ -44,7 +41,7 @@ static jlong latinime_Keyboard_setProximityInfo(JNIEnv *env, jobject object,
jfloat *sweetSpotCenterYs = safeGetFloatArrayElements(env, sweetSpotCenterYArray); jfloat *sweetSpotCenterYs = safeGetFloatArrayElements(env, sweetSpotCenterYArray);
jfloat *sweetSpotRadii = safeGetFloatArrayElements(env, sweetSpotRadiusArray); jfloat *sweetSpotRadii = safeGetFloatArrayElements(env, sweetSpotRadiusArray);
ProximityInfo *proximityInfo = new ProximityInfo( ProximityInfo *proximityInfo = new ProximityInfo(
localeStr, maxProximityCharsSize, displayWidth, displayHeight, gridWidth, gridHeight, localeCStr, maxProximityCharsSize, displayWidth, displayHeight, gridWidth, gridHeight,
mostCommonkeyWidth, (const int32_t*)proximityChars, keyCount, mostCommonkeyWidth, (const int32_t*)proximityChars, keyCount,
(const int32_t*)keyXCoordinates, (const int32_t*)keyYCoordinates, (const int32_t*)keyXCoordinates, (const int32_t*)keyYCoordinates,
(const int32_t*)keyWidths, (const int32_t*)keyHeights, (const int32_t*)keyCharCodes, (const int32_t*)keyWidths, (const int32_t*)keyHeights, (const int32_t*)keyCharCodes,
@ -59,7 +56,7 @@ static jlong latinime_Keyboard_setProximityInfo(JNIEnv *env, jobject object,
safeReleaseIntArrayElements(env, keyYCoordinateArray, keyYCoordinates); safeReleaseIntArrayElements(env, keyYCoordinateArray, keyYCoordinates);
safeReleaseIntArrayElements(env, keyXCoordinateArray, keyXCoordinates); safeReleaseIntArrayElements(env, keyXCoordinateArray, keyXCoordinates);
env->ReleaseIntArrayElements(proximityCharsArray, proximityChars, 0); env->ReleaseIntArrayElements(proximityCharsArray, proximityChars, 0);
env->ReleaseStringUTFChars(localejStr, localeStrPtr); env->ReleaseStringUTFChars(localeJStr, localeCStr);
return (jlong)proximityInfo; return (jlong)proximityInfo;
} }

View file

@ -16,6 +16,8 @@
#define LOG_TAG "LatinIME: jni" #define LOG_TAG "LatinIME: jni"
#include <cassert>
#include "com_android_inputmethod_keyboard_ProximityInfo.h" #include "com_android_inputmethod_keyboard_ProximityInfo.h"
#include "com_android_inputmethod_latin_BinaryDictionary.h" #include "com_android_inputmethod_latin_BinaryDictionary.h"
#include "com_android_inputmethod_latin_NativeUtils.h" #include "com_android_inputmethod_latin_NativeUtils.h"
@ -23,8 +25,6 @@
#include "jni.h" #include "jni.h"
#include "jni_common.h" #include "jni_common.h"
#include <cassert>
using namespace latinime; using namespace latinime;
/* /*

View file

@ -36,7 +36,7 @@ inline void copyOrFillZero(void *to, const void *from, size_t size) {
} }
} }
ProximityInfo::ProximityInfo(const std::string localeStr, const int maxProximityCharsSize, ProximityInfo::ProximityInfo(const char *localeCStr, const int maxProximityCharsSize,
const int keyboardWidth, const int keyboardHeight, const int gridWidth, const int keyboardWidth, const int keyboardHeight, const int gridWidth,
const int gridHeight, const int mostCommonKeyWidth, const int gridHeight, const int mostCommonKeyWidth,
const int32_t *proximityCharsArray, const int keyCount, const int32_t *keyXCoordinates, const int32_t *proximityCharsArray, const int keyCount, const int32_t *keyXCoordinates,
@ -52,7 +52,7 @@ ProximityInfo::ProximityInfo(const std::string localeStr, const int maxProximity
HAS_TOUCH_POSITION_CORRECTION_DATA(keyCount > 0 && keyXCoordinates && keyYCoordinates HAS_TOUCH_POSITION_CORRECTION_DATA(keyCount > 0 && keyXCoordinates && keyYCoordinates
&& keyWidths && keyHeights && keyCharCodes && sweetSpotCenterXs && keyWidths && keyHeights && keyCharCodes && sweetSpotCenterXs
&& sweetSpotCenterYs && sweetSpotRadii), && sweetSpotCenterYs && sweetSpotRadii),
mLocaleStr(localeStr) { mLocaleStr(localeCStr) {
const int proximityGridLength = GRID_WIDTH * GRID_HEIGHT * MAX_PROXIMITY_CHARS_SIZE; const int proximityGridLength = GRID_WIDTH * GRID_HEIGHT * MAX_PROXIMITY_CHARS_SIZE;
if (DEBUG_PROXIMITY_INFO) { if (DEBUG_PROXIMITY_INFO) {
AKLOGI("Create proximity info array %d", proximityGridLength); AKLOGI("Create proximity info array %d", proximityGridLength);

View file

@ -28,7 +28,7 @@ class Correction;
class ProximityInfo { class ProximityInfo {
public: public:
ProximityInfo(const std::string localeStr, const int maxProximityCharsSize, ProximityInfo(const char *localeCStr, const int maxProximityCharsSize,
const int keyboardWidth, const int keyboardHeight, const int gridWidth, const int keyboardWidth, const int keyboardHeight, const int gridWidth,
const int gridHeight, const int mostCommonkeyWidth, const int gridHeight, const int mostCommonkeyWidth,
const int32_t *proximityCharsArray, const int keyCount, const int32_t *keyXCoordinates, const int32_t *proximityCharsArray, const int keyCount, const int32_t *keyXCoordinates,