summaryrefslogtreecommitdiff
path: root/java/org/gnu/emacs/EmacsService.java
diff options
context:
space:
mode:
authorPo Lu <luangruo@yahoo.com>2023-07-27 21:59:58 +0800
committerPo Lu <luangruo@yahoo.com>2023-07-27 21:59:58 +0800
commitde0e0939f01a747b8201e06bda5cd50dfa95187f (patch)
tree20e23c8b0539169ef9f88a561165e7ae90eecc79 /java/org/gnu/emacs/EmacsService.java
parent4e754817b56c80b1a8c9cf4a9ae811d8217347a4 (diff)
Update Android port
* doc/emacs/android.texi (Android Document Providers): Improve wording of paragraph clarifying limits on subprocesses. * java/org/gnu/emacs/EmacsService.java (getDocumentTrees): Use Java standard US-ASCII coding standard instead of the undocumented ``ASCII'' alias. (decodeFileName): Remove unused function. (documentIdFromName): * src/android.c (android_init_emacs_service): Take a String for NAME instead of a byte array. * src/androidvfs.c (android_verify_jni_string): New function. (android_document_id_from_name): Verify that STRING is a valid Modified UTF-8 string.
Diffstat (limited to 'java/org/gnu/emacs/EmacsService.java')
-rw-r--r--java/org/gnu/emacs/EmacsService.java34
1 files changed, 6 insertions, 28 deletions
diff --git a/java/org/gnu/emacs/EmacsService.java b/java/org/gnu/emacs/EmacsService.java
index 6059439551f..bc62e050345 100644
--- a/java/org/gnu/emacs/EmacsService.java
+++ b/java/org/gnu/emacs/EmacsService.java
@@ -1282,7 +1282,7 @@ public final class EmacsService extends Service
try
{
- providerName = new String (provider, "ASCII");
+ providerName = new String (provider, "US-ASCII");
}
catch (UnsupportedEncodingException exception)
{
@@ -1306,24 +1306,6 @@ public final class EmacsService extends Service
return treeList.toArray (new String[0]);
}
- /* Decode the specified STRING into a String object using the UTF-8
- format. If an exception is thrown, return null. */
-
- private String
- decodeFileName (byte[] string)
- {
- try
- {
- return new String (string, "UTF-8");
- }
- catch (Exception e) /* UnsupportedEncodingException, etc. */
- {
- ;;
- }
-
- return null;
- }
-
/* Find the document ID of the file within TREE_URI designated by
NAME.
@@ -1342,11 +1324,10 @@ public final class EmacsService extends Service
If the designated file can't be located, return -1. */
private int
- documentIdFromName (String tree_uri, byte name[],
- String[] id_return)
+ documentIdFromName (String tree_uri, String name, String[] id_return)
{
Uri uri, treeUri;
- String nameString, id, type;
+ String id, type;
String[] components, projection;
Cursor cursor;
int column;
@@ -1360,11 +1341,8 @@ public final class EmacsService extends Service
/* Parse the URI identifying the tree first. */
uri = Uri.parse (tree_uri);
- /* Next, decode NAME. */
- nameString = decodeFileName (name);
-
/* Now, split NAME into its individual components. */
- components = nameString.split ("/");
+ components = name.split ("/");
/* Set id and type to the value at the root of the tree. */
type = id = null;
@@ -1462,7 +1440,7 @@ public final class EmacsService extends Service
try
{
- nameString = cursor.getString (column);
+ name = cursor.getString (column);
}
catch (Exception exception)
{
@@ -1473,7 +1451,7 @@ public final class EmacsService extends Service
/* Break out of the loop only once a matching component is
found. */
- if (nameString.equals (component))
+ if (name.equals (component))
break;
}