1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-04 08:47:11 +00:00

Minor adjustments to Android port

* java/org/gnu/emacs/EmacsService.java (readDirectoryEntry):
Also refrain from returning NULL or file names containing
non-representable NULL bytes.
* src/callproc.c (get_current_directory): Clean up by employing
android_is_special_directory.
This commit is contained in:
Po Lu 2023-08-11 14:55:21 +08:00
parent cc6fed326a
commit 43cc92d6e4
2 changed files with 11 additions and 6 deletions

View File

@ -1503,9 +1503,13 @@ In addition, arbitrary runtime exceptions (such as
return entry;
}
/* Skip this entry if its name cannot be represented. */
/* Skip this entry if its name cannot be represented. NAME
can still be null here, since some Cursors are permitted to
return NULL if INDEX is not a string. */
if (name.equals ("..") || name.equals (".") || name.contains ("/"))
if (name == null || name.equals ("..")
|| name.equals (".") || name.contains ("/")
|| name.contains ("\0"))
continue;
/* Now, look for its type. */

View File

@ -170,10 +170,11 @@ get_current_directory (bool encode)
/* If DIR is an asset directory or a content directory, return
the home directory instead. */
if (encode && (!strcmp (SSDATA (dir), "/assets")
|| !strncmp (SSDATA (dir), "/assets/", 8)
|| !strcmp (SSDATA (dir), "/content")
|| !strncmp (SSDATA (dir), "/content/", 9)))
if (encode
&& (android_is_special_directory (SSDATA (dir),
"/assets")
|| android_is_special_directory (SSDATA (dir),
"/content")))
dir = build_string ("~");
#endif /* HAVE_ANDROID && ANDROID_STUBIFY */