summaryrefslogtreecommitdiff
path: root/platform/android
diff options
context:
space:
mode:
authorvolzhs <volzhs@gmail.com>2016-06-30 01:23:55 +0900
committervolzhs <volzhs@gmail.com>2016-06-30 01:23:55 +0900
commitaac0af043cb3c7624d32ec39f91e4f24bdb5dcf5 (patch)
treefa83683c7487d4608241764dbf4f8dcb1e0f23f7 /platform/android
parentf56a0435f2008cf88609124a74fcaa71ad8fb2c1 (diff)
Fix wrong return bool, string, string array data through jni
Diffstat (limited to 'platform/android')
-rw-r--r--platform/android/java_glue.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/platform/android/java_glue.cpp b/platform/android/java_glue.cpp
index 5fd2ab8910..3ea2ab1641 100644
--- a/platform/android/java_glue.cpp
+++ b/platform/android/java_glue.cpp
@@ -259,8 +259,7 @@ Variant _jobject_to_variant(JNIEnv * env, jobject obj) {
for (int i=0; i<stringCount; i++) {
jstring string = (jstring) env->GetObjectArrayElement(arr, i);
- const char *rawString = env->GetStringUTFChars(string, 0);
- sarr.push_back(String(rawString));
+ sarr.push_back(String::utf8(env->GetStringUTFChars(string, NULL)));
env->DeleteLocalRef(string);
}
@@ -506,7 +505,7 @@ public:
} break;
case Variant::BOOL: {
- ret = env->CallBooleanMethodA(instance,E->get().method,v);
+ ret = env->CallBooleanMethodA(instance,E->get().method,v)==JNI_TRUE;
//print_line("call bool");
} break;
case Variant::INT: {
@@ -521,8 +520,7 @@ public:
case Variant::STRING: {
jobject o = env->CallObjectMethodA(instance,E->get().method,v);
- String str = env->GetStringUTFChars((jstring)o, NULL );
- ret=str;
+ ret = String::utf8(env->GetStringUTFChars((jstring)o, NULL));
env->DeleteLocalRef(o);
} break;
case Variant::STRING_ARRAY: {