aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPo Lu2023-09-24 18:19:38 +0800
committerPo Lu2023-09-24 18:19:54 +0800
commit38cd3cb4330f2c18d01fa6aa7eb54623cecab522 (patch)
tree57a123355350ca3213f9198512a2d4072021ea98 /src
parent81c6569e654966c63f208013a4faf7ddb2a5d933 (diff)
downloademacs-38cd3cb4330f2c18d01fa6aa7eb54623cecab522.tar.gz
emacs-38cd3cb4330f2c18d01fa6aa7eb54623cecab522.zip
Update Android port
* java/org/gnu/emacs/EmacsSdk11Clipboard.java (getClipboardData): Correct typo in comment. * src/androidvfs.c (android_authority_open) (android_saf_delete_document): Circumvent JNI dynamic method dispatch.
Diffstat (limited to 'src')
-rw-r--r--src/androidvfs.c51
1 files changed, 27 insertions, 24 deletions
diff --git a/src/androidvfs.c b/src/androidvfs.c
index 858816908f8..d099e4d636c 100644
--- a/src/androidvfs.c
+++ b/src/androidvfs.c
@@ -3033,6 +3033,7 @@ android_authority_open (struct android_vnode *vnode, int flags,
3033 size_t length; 3033 size_t length;
3034 jobject string; 3034 jobject string;
3035 int fd; 3035 int fd;
3036 JNIEnv *env;
3036 3037
3037 vp = (struct android_authority_vnode *) vnode; 3038 vp = (struct android_authority_vnode *) vnode;
3038 3039
@@ -3044,39 +3045,40 @@ android_authority_open (struct android_vnode *vnode, int flags,
3044 return -1; 3045 return -1;
3045 } 3046 }
3046 3047
3048 /* Save the JNI environment within `env', to make wrapping
3049 subsequent lines referencing CallNonvirtualIntMethod
3050 feasible. */
3051 env = android_java_env;
3052
3047 /* Allocate a buffer to hold the file name. */ 3053 /* Allocate a buffer to hold the file name. */
3048 length = strlen (vp->uri); 3054 length = strlen (vp->uri);
3049 string = (*android_java_env)->NewByteArray (android_java_env, 3055 string = (*env)->NewByteArray (env, length);
3050 length);
3051 if (!string) 3056 if (!string)
3052 { 3057 {
3053 (*android_java_env)->ExceptionClear (android_java_env); 3058 (*env)->ExceptionClear (env);
3054 errno = ENOMEM; 3059 errno = ENOMEM;
3055 return -1; 3060 return -1;
3056 } 3061 }
3057 3062
3058 /* Copy the URI into this byte array. */ 3063 /* Copy the URI into this byte array. */
3059 (*android_java_env)->SetByteArrayRegion (android_java_env, 3064 (*env)->SetByteArrayRegion (env, string, 0, length,
3060 string, 0, length, 3065 (jbyte *) vp->uri);
3061 (jbyte *) vp->uri);
3062 3066
3063 /* Try to open the file descriptor. */ 3067 /* Try to open the file descriptor. */
3064 3068
3065 fd 3069 fd = (*env)->CallNonvirtualIntMethod (env, emacs_service,
3066 = (*android_java_env)->CallIntMethod (android_java_env, 3070 service_class.class,
3067 emacs_service, 3071 service_class.open_content_uri,
3068 service_class.open_content_uri, 3072 string,
3069 string, 3073 (jboolean) ((mode & O_WRONLY
3070 (jboolean) ((mode & O_WRONLY 3074 || mode & O_RDWR)
3071 || mode & O_RDWR) 3075 != 0),
3072 != 0), 3076 (jboolean) !(mode & O_WRONLY),
3073 (jboolean) !(mode & O_WRONLY), 3077 (jboolean) ((mode & O_TRUNC)
3074 (jboolean) ((mode & O_TRUNC) 3078 != 0));
3075 != 0)); 3079 if ((*env)->ExceptionCheck (env))
3076
3077 if ((*android_java_env)->ExceptionCheck (android_java_env))
3078 { 3080 {
3079 (*android_java_env)->ExceptionClear (android_java_env); 3081 (*env)->ExceptionClear (env);
3080 errno = ENOMEM; 3082 errno = ENOMEM;
3081 ANDROID_DELETE_LOCAL_REF (string); 3083 ANDROID_DELETE_LOCAL_REF (string);
3082 return -1; 3084 return -1;
@@ -4252,10 +4254,11 @@ android_saf_delete_document (const char *tree, const char *doc_id,
4252 4254
4253 /* Now, try to delete the document. */ 4255 /* Now, try to delete the document. */
4254 method = service_class.delete_document; 4256 method = service_class.delete_document;
4255 rc = (*android_java_env)->CallIntMethod (android_java_env, 4257 rc = (*android_java_env)->CallNonvirtualIntMethod (android_java_env,
4256 emacs_service, 4258 emacs_service,
4257 method, uri, id, 4259 service_class.class,
4258 name); 4260 method, uri, id,
4261 name);
4259 4262
4260 if (android_saf_exception_check (3, id, uri, name)) 4263 if (android_saf_exception_check (3, id, uri, name))
4261 return -1; 4264 return -1;