diff options
| author | Po Lu | 2023-09-24 18:19:38 +0800 |
|---|---|---|
| committer | Po Lu | 2023-09-24 18:19:54 +0800 |
| commit | 38cd3cb4330f2c18d01fa6aa7eb54623cecab522 (patch) | |
| tree | 57a123355350ca3213f9198512a2d4072021ea98 | |
| parent | 81c6569e654966c63f208013a4faf7ddb2a5d933 (diff) | |
| download | emacs-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.
| -rw-r--r-- | java/org/gnu/emacs/EmacsSdk11Clipboard.java | 2 | ||||
| -rw-r--r-- | src/androidvfs.c | 51 |
2 files changed, 28 insertions, 25 deletions
diff --git a/java/org/gnu/emacs/EmacsSdk11Clipboard.java b/java/org/gnu/emacs/EmacsSdk11Clipboard.java index b34753922b8..b8a43496b6d 100644 --- a/java/org/gnu/emacs/EmacsSdk11Clipboard.java +++ b/java/org/gnu/emacs/EmacsSdk11Clipboard.java | |||
| @@ -209,7 +209,7 @@ public final class EmacsSdk11Clipboard extends EmacsClipboard | |||
| 209 | 209 | ||
| 210 | Value is normally an array of three longs: the file descriptor, | 210 | Value is normally an array of three longs: the file descriptor, |
| 211 | the start offset of the data, and its length; length may be | 211 | the start offset of the data, and its length; length may be |
| 212 | AssetFileDescriptor.UNKOWN_LENGTH, meaning that the data extends | 212 | AssetFileDescriptor.UNKNOWN_LENGTH, meaning that the data extends |
| 213 | from that offset to the end of the file. | 213 | from that offset to the end of the file. |
| 214 | 214 | ||
| 215 | Do not use this function to open text targets; use `getClipboard' | 215 | Do not use this function to open text targets; use `getClipboard' |
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; |