summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorMaurus Cuelenaere <mcuelenaere@gmail.com>2010-11-05 18:17:23 +0000
committerMaurus Cuelenaere <mcuelenaere@gmail.com>2010-11-05 18:17:23 +0000
commit493732167da19798f570416ee3e17e6419040cf9 (patch)
tree3052f4b7204efedc76ccde6afd624cb7dee1fc10 /apps
parent6d59785024e321f8e868f1f9f34b3d8d8961e065 (diff)
downloadrockbox-493732167da19798f570416ee3e17e6419040cf9.tar.gz
rockbox-493732167da19798f570416ee3e17e6419040cf9.tar.bz2
rockbox-493732167da19798f570416ee3e17e6419040cf9.zip
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.c6
-rw-r--r--apps/hosted/yesno.c2
2 files changed, 3 insertions, 5 deletions
diff --git a/apps/hosted/keyboard.c b/apps/hosted/keyboard.c
index 1993164ade..2b77825af0 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 1e05e193f7..9858e66438 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);