aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorPo Lu2023-07-27 21:59:58 +0800
committerPo Lu2023-07-27 21:59:58 +0800
commitde0e0939f01a747b8201e06bda5cd50dfa95187f (patch)
tree20e23c8b0539169ef9f88a561165e7ae90eecc79 /java
parent4e754817b56c80b1a8c9cf4a9ae811d8217347a4 (diff)
downloademacs-de0e0939f01a747b8201e06bda5cd50dfa95187f.tar.gz
emacs-de0e0939f01a747b8201e06bda5cd50dfa95187f.zip
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')
-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
1282 1282
1283 try 1283 try
1284 { 1284 {
1285 providerName = new String (provider, "ASCII"); 1285 providerName = new String (provider, "US-ASCII");
1286 } 1286 }
1287 catch (UnsupportedEncodingException exception) 1287 catch (UnsupportedEncodingException exception)
1288 { 1288 {
@@ -1306,24 +1306,6 @@ public final class EmacsService extends Service
1306 return treeList.toArray (new String[0]); 1306 return treeList.toArray (new String[0]);
1307 } 1307 }
1308 1308
1309 /* Decode the specified STRING into a String object using the UTF-8
1310 format. If an exception is thrown, return null. */
1311
1312 private String
1313 decodeFileName (byte[] string)
1314 {
1315 try
1316 {
1317 return new String (string, "UTF-8");
1318 }
1319 catch (Exception e) /* UnsupportedEncodingException, etc. */
1320 {
1321 ;;
1322 }
1323
1324 return null;
1325 }
1326
1327 /* Find the document ID of the file within TREE_URI designated by 1309 /* Find the document ID of the file within TREE_URI designated by
1328 NAME. 1310 NAME.
1329 1311
@@ -1342,11 +1324,10 @@ public final class EmacsService extends Service
1342 If the designated file can't be located, return -1. */ 1324 If the designated file can't be located, return -1. */
1343 1325
1344 private int 1326 private int
1345 documentIdFromName (String tree_uri, byte name[], 1327 documentIdFromName (String tree_uri, String name, String[] id_return)
1346 String[] id_return)
1347 { 1328 {
1348 Uri uri, treeUri; 1329 Uri uri, treeUri;
1349 String nameString, id, type; 1330 String id, type;
1350 String[] components, projection; 1331 String[] components, projection;
1351 Cursor cursor; 1332 Cursor cursor;
1352 int column; 1333 int column;
@@ -1360,11 +1341,8 @@ public final class EmacsService extends Service
1360 /* Parse the URI identifying the tree first. */ 1341 /* Parse the URI identifying the tree first. */
1361 uri = Uri.parse (tree_uri); 1342 uri = Uri.parse (tree_uri);
1362 1343
1363 /* Next, decode NAME. */
1364 nameString = decodeFileName (name);
1365
1366 /* Now, split NAME into its individual components. */ 1344 /* Now, split NAME into its individual components. */
1367 components = nameString.split ("/"); 1345 components = name.split ("/");
1368 1346
1369 /* Set id and type to the value at the root of the tree. */ 1347 /* Set id and type to the value at the root of the tree. */
1370 type = id = null; 1348 type = id = null;
@@ -1462,7 +1440,7 @@ public final class EmacsService extends Service
1462 1440
1463 try 1441 try
1464 { 1442 {
1465 nameString = cursor.getString (column); 1443 name = cursor.getString (column);
1466 } 1444 }
1467 catch (Exception exception) 1445 catch (Exception exception)
1468 { 1446 {
@@ -1473,7 +1451,7 @@ public final class EmacsService extends Service
1473 /* Break out of the loop only once a matching component is 1451 /* Break out of the loop only once a matching component is
1474 found. */ 1452 found. */
1475 1453
1476 if (nameString.equals (component)) 1454 if (name.equals (component))
1477 break; 1455 break;
1478 } 1456 }
1479 1457