summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2016-07-03 19:11:04 +0200
committerGitHub <noreply@github.com>2016-07-03 19:11:04 +0200
commit9693f37fccffb415fc162d4e7eb397b85e6debbe (patch)
treec45329b9add15768d474c2eb54deaa615ac3a0e7
parent6442dfb73bf17d69768b5ff42d2fd269a6aa2f51 (diff)
parentaac0af043cb3c7624d32ec39f91e4f24bdb5dcf5 (diff)
Merge pull request #5491 from volzhs/fix-jni-bool-string
Fix wrong return bool, string, string array data through jni
-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: {