[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 38cd3cb4330: Update Android port
From: |
Po Lu |
Subject: |
master 38cd3cb4330: Update Android port |
Date: |
Sun, 24 Sep 2023 06:20:05 -0400 (EDT) |
branch: master
commit 38cd3cb4330f2c18d01fa6aa7eb54623cecab522
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
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.
---
java/org/gnu/emacs/EmacsSdk11Clipboard.java | 2 +-
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
Value is normally an array of three longs: the file descriptor,
the start offset of the data, and its length; length may be
- AssetFileDescriptor.UNKOWN_LENGTH, meaning that the data extends
+ AssetFileDescriptor.UNKNOWN_LENGTH, meaning that the data extends
from that offset to the end of the file.
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,
size_t length;
jobject string;
int fd;
+ JNIEnv *env;
vp = (struct android_authority_vnode *) vnode;
@@ -3044,39 +3045,40 @@ android_authority_open (struct android_vnode *vnode,
int flags,
return -1;
}
+ /* Save the JNI environment within `env', to make wrapping
+ subsequent lines referencing CallNonvirtualIntMethod
+ feasible. */
+ env = android_java_env;
+
/* Allocate a buffer to hold the file name. */
length = strlen (vp->uri);
- string = (*android_java_env)->NewByteArray (android_java_env,
- length);
+ string = (*env)->NewByteArray (env, length);
if (!string)
{
- (*android_java_env)->ExceptionClear (android_java_env);
+ (*env)->ExceptionClear (env);
errno = ENOMEM;
return -1;
}
/* Copy the URI into this byte array. */
- (*android_java_env)->SetByteArrayRegion (android_java_env,
- string, 0, length,
- (jbyte *) vp->uri);
+ (*env)->SetByteArrayRegion (env, string, 0, length,
+ (jbyte *) vp->uri);
/* Try to open the file descriptor. */
- fd
- = (*android_java_env)->CallIntMethod (android_java_env,
- emacs_service,
- service_class.open_content_uri,
- string,
- (jboolean) ((mode & O_WRONLY
- || mode & O_RDWR)
- != 0),
- (jboolean) !(mode & O_WRONLY),
- (jboolean) ((mode & O_TRUNC)
- != 0));
-
- if ((*android_java_env)->ExceptionCheck (android_java_env))
+ fd = (*env)->CallNonvirtualIntMethod (env, emacs_service,
+ service_class.class,
+ service_class.open_content_uri,
+ string,
+ (jboolean) ((mode & O_WRONLY
+ || mode & O_RDWR)
+ != 0),
+ (jboolean) !(mode & O_WRONLY),
+ (jboolean) ((mode & O_TRUNC)
+ != 0));
+ if ((*env)->ExceptionCheck (env))
{
- (*android_java_env)->ExceptionClear (android_java_env);
+ (*env)->ExceptionClear (env);
errno = ENOMEM;
ANDROID_DELETE_LOCAL_REF (string);
return -1;
@@ -4252,10 +4254,11 @@ android_saf_delete_document (const char *tree, const
char *doc_id,
/* Now, try to delete the document. */
method = service_class.delete_document;
- rc = (*android_java_env)->CallIntMethod (android_java_env,
- emacs_service,
- method, uri, id,
- name);
+ rc = (*android_java_env)->CallNonvirtualIntMethod (android_java_env,
+ emacs_service,
+ service_class.class,
+ method, uri, id,
+ name);
if (android_saf_exception_check (3, id, uri, name))
return -1;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 38cd3cb4330: Update Android port,
Po Lu <=