aboutsummaryrefslogtreecommitdiffstats
path: root/src/android.c
diff options
context:
space:
mode:
authorPo Lu2024-07-07 10:19:31 +0800
committerPo Lu2024-07-07 10:21:47 +0800
commit99e510977b22ca60e48b2af70a3c2cdbd90b2b01 (patch)
tree272cbf70afee36d54807768fcac0df40ede58a43 /src/android.c
parentbbe95a8ceabfa1f4ad2064e1607fe64cf56434fd (diff)
downloademacs-99e510977b22ca60e48b2af70a3c2cdbd90b2b01.tar.gz
emacs-99e510977b22ca60e48b2af70a3c2cdbd90b2b01.zip
Correct JNI string error checking and miscellaneous corrections
* src/android-emacs.c (main): Do not attempt to load the bootstrap class path, which is redundant on all Android releases. * src/android.c (initEmacs, android_browse_url): Do not assume exceptions will be raised if GetStringUTFChars fails. Decode Android JNI strings as Qandroid_jni. * src/androidvfs.c (android_saf_check_nonnull): New function. (android_saf_new_mkdir): Likewise.
Diffstat (limited to 'src/android.c')
-rw-r--r--src/android.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/android.c b/src/android.c
index 3c0e3ee1558..f90ebc04925 100644
--- a/src/android.c
+++ b/src/android.c
@@ -2019,6 +2019,8 @@ NATIVE_NAME (initEmacs) (JNIEnv *env, jobject object, jarray argv,
2019 c_argument 2019 c_argument
2020 = (*env)->GetStringUTFChars (env, (jstring) dump_file_object, 2020 = (*env)->GetStringUTFChars (env, (jstring) dump_file_object,
2021 NULL); 2021 NULL);
2022 if (!c_argument)
2023 emacs_abort ();
2022 2024
2023 /* Copy the Java string data once. */ 2025 /* Copy the Java string data once. */
2024 dump_file = strdup (c_argument); 2026 dump_file = strdup (c_argument);
@@ -6497,18 +6499,18 @@ android_browse_url (Lisp_Object url, Lisp_Object send)
6497 buffer = (*android_java_env)->GetStringUTFChars (android_java_env, 6499 buffer = (*android_java_env)->GetStringUTFChars (android_java_env,
6498 (jstring) value, 6500 (jstring) value,
6499 NULL); 6501 NULL);
6500 android_exception_check_1 (value); 6502 android_exception_check_nonnull ((void *) buffer, value);
6501 6503
6502 /* Otherwise, build the string describing the error. */ 6504 /* Otherwise, build the string describing the error. */
6503 tem = build_string_from_utf8 (buffer); 6505 tem = build_unibyte_string (buffer);
6504 6506
6505 (*android_java_env)->ReleaseStringUTFChars (android_java_env, 6507 (*android_java_env)->ReleaseStringUTFChars (android_java_env,
6506 (jstring) value, 6508 (jstring) value,
6507 buffer); 6509 buffer);
6508 6510
6509 /* And return it. */ 6511 /* And decode and return the same. */
6510 ANDROID_DELETE_LOCAL_REF (value); 6512 ANDROID_DELETE_LOCAL_REF (value);
6511 return tem; 6513 return code_convert_string_norecord (tem, Qandroid_jni, false);
6512} 6514}
6513 6515
6514/* Tell the system to restart Emacs in a short amount of time, and 6516/* Tell the system to restart Emacs in a short amount of time, and