1
0
Fork 0
forked from len0rd/rockbox

Android port: NewStringUTF() JNI call doesn't need freeing, these will get garbage collected.

Also use strncpy instead of snprintf.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28495 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Maurus Cuelenaere 2010-11-05 18:17:23 +00:00
parent 6d59785024
commit 493732167d
2 changed files with 3 additions and 5 deletions

View file

@ -24,6 +24,7 @@
#include <jni.h>
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <system.h>
extern JNIEnv *env_ptr;
@ -75,13 +76,12 @@ int kbd_input(char* text, int buflen)
kbd_result);
} while (!ret);
e->ReleaseStringUTFChars(env_ptr, str, NULL);
retchars = e->GetStringUTFChars(env_ptr, ret, 0);
if (retchars[0])
snprintf(text, buflen, retchars);
strncpy(text, retchars, buflen);
e->ReleaseStringUTFChars(env_ptr, ret, retchars);
return retchars[0]?0:1; /* return 0 on success */
return text[0] ? 0 : 1; /* return 0 on success */
}
int load_kbd(unsigned char* filename)

View file

@ -95,8 +95,6 @@ enum yesno_res gui_syncyesno_run(const struct text_message * main_message,
jboolean ret;
e->CallVoidMethod(env_ptr, RockboxYesno_instance, yesno_func, message);
e->ReleaseStringUTFChars(env_ptr, message, NULL);
do {
sleep(HZ/10);