提交 61d076e5 编写于 作者: A art

6741364: Some input method problems after the fix for 6585765

Summary: the fix for 6585765 is corrected
Reviewed-by: uta
上级 331aa437
...@@ -131,7 +131,7 @@ AwtInputTextInfor::GetContextData(HIMC hIMC, const LPARAM flags) { ...@@ -131,7 +131,7 @@ AwtInputTextInfor::GetContextData(HIMC hIMC, const LPARAM flags) {
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
if (m_cStrW > 0) { if (m_cStrW > 0) {
m_jtext = MakeJavaString(env, m_lpStrW); m_jtext = MakeJavaString(env, m_lpStrW, m_cStrW);
} }
// Merge the string if necessary // Merge the string if necessary
...@@ -182,12 +182,12 @@ AwtInputTextInfor::~AwtInputTextInfor() { ...@@ -182,12 +182,12 @@ AwtInputTextInfor::~AwtInputTextInfor() {
} }
jstring AwtInputTextInfor::MakeJavaString(JNIEnv* env, LPWSTR lpStrW) { jstring AwtInputTextInfor::MakeJavaString(JNIEnv* env, LPWSTR lpStrW, int cStrW) {
if (env == NULL || lpStrW == NULL) { if (env == NULL || lpStrW == NULL || cStrW == 0) {
return NULL; return NULL;
} else { } else {
return JNU_NewStringPlatform(env, lpStrW); return env->NewString(reinterpret_cast<jchar*>(lpStrW), cStrW);
} }
} }
...@@ -246,14 +246,14 @@ int AwtInputTextInfor::GetClauseInfor(int*& lpBndClauseW, jstring*& lpReadingCla ...@@ -246,14 +246,14 @@ int AwtInputTextInfor::GetClauseInfor(int*& lpBndClauseW, jstring*& lpReadingCla
} }
::LCMapString(lcJPN, LCMAP_FULLWIDTH, lpHWStrW, cHWStrW, lpFWStrW, cFWStrW); ::LCMapString(lcJPN, LCMAP_FULLWIDTH, lpHWStrW, cHWStrW, lpFWStrW, cFWStrW);
readingClauseW[cls] = MakeJavaString(env, lpFWStrW); readingClauseW[cls] = MakeJavaString(env, lpFWStrW, cFWStrW);
delete [] lpFWStrW; delete [] lpFWStrW;
} else { } else {
readingClauseW[cls] = MakeJavaString(env, lpHWStrW); readingClauseW[cls] = MakeJavaString(env, lpHWStrW, cHWStrW);
} }
} }
else { else {
readingClauseW[cls] = MakeJavaString(env, (LPWSTR)NULL); readingClauseW[cls] = NULL;
} }
} }
......
...@@ -58,7 +58,7 @@ class AwtInputTextInfor { ...@@ -58,7 +58,7 @@ class AwtInputTextInfor {
~AwtInputTextInfor(); ~AwtInputTextInfor();
private: private:
/* helper function to return a java string.*/ /* helper function to return a java string.*/
static jstring MakeJavaString(JNIEnv* env, LPWSTR lpStrW); static jstring MakeJavaString(JNIEnv* env, LPWSTR lpStrW, int cStrW);
LPARAM m_flags; /* The message LPARAM. */ LPARAM m_flags; /* The message LPARAM. */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册