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:
parent
6d59785024
commit
493732167d
2 changed files with 3 additions and 5 deletions
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue