diff options
| author | Maurus Cuelenaere <mcuelenaere@gmail.com> | 2010-11-05 18:17:23 +0000 |
|---|---|---|
| committer | Maurus Cuelenaere <mcuelenaere@gmail.com> | 2010-11-05 18:17:23 +0000 |
| commit | 493732167da19798f570416ee3e17e6419040cf9 (patch) | |
| tree | 3052f4b7204efedc76ccde6afd624cb7dee1fc10 /apps | |
| parent | 6d59785024e321f8e868f1f9f34b3d8d8961e065 (diff) | |
| download | rockbox-493732167da19798f570416ee3e17e6419040cf9.zip rockbox-493732167da19798f570416ee3e17e6419040cf9.tar.gz rockbox-493732167da19798f570416ee3e17e6419040cf9.tar.bz2 rockbox-493732167da19798f570416ee3e17e6419040cf9.tar.xz | |
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
Diffstat (limited to 'apps')
| -rw-r--r-- | apps/hosted/keyboard.c | 6 | ||||
| -rw-r--r-- | apps/hosted/yesno.c | 2 |
2 files changed, 3 insertions, 5 deletions
diff --git a/apps/hosted/keyboard.c b/apps/hosted/keyboard.c index 1993164..2b77825 100644 --- a/apps/hosted/keyboard.c +++ b/apps/hosted/keyboard.c @@ -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) diff --git a/apps/hosted/yesno.c b/apps/hosted/yesno.c index 1e05e19..9858e66 100644 --- a/apps/hosted/yesno.c +++ b/apps/hosted/yesno.c @@ -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); |