summaryrefslogtreecommitdiff
path: root/src/dired.c
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2022-07-10 11:15:27 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2022-07-10 11:15:27 -0400
commitd51d72b4a62384f33a593f5a2c0922c1aaecf106 (patch)
treecbd7c2d486a5a5eee5c08937a11eac917fdc17c0 /src/dired.c
parent46a2e5dc93ccbb36309f859460cb527c91adc4d1 (diff)
downloademacs-d51d72b4a62384f33a593f5a2c0922c1aaecf106.tar.gz
emacs-d51d72b4a62384f33a593f5a2c0922c1aaecf106.tar.bz2
emacs-d51d72b4a62384f33a593f5a2c0922c1aaecf106.zip
* src/dired.c (directory_files_internal): Update comment
Diffstat (limited to 'src/dired.c')
-rw-r--r--src/dired.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/dired.c b/src/dired.c
index 9aeff516369..c2c099f0a5f 100644
--- a/src/dired.c
+++ b/src/dired.c
@@ -270,7 +270,17 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full,
ptrdiff_t name_nbytes = SBYTES (name);
ptrdiff_t nbytes = directory_nbytes + needsep + name_nbytes;
ptrdiff_t nchars = SCHARS (directory) + needsep + SCHARS (name);
- /* FIXME: Why not make them all multibyte? */
+ /* DECODE_FILE may return non-ASCII unibyte strings (e.g. when
+ file-name-coding-system is 'binary'), so we don't know for sure
+ that the bytes we have follow our internal utf-8 representation
+ for multibyte strings. If nchars == nbytes we don't need to
+ care and just return a unibyte string; and if not, that means
+ one of 'name' or 'directory' is multibyte, in which case we
+ presume that the other one would also be multibyte if it
+ contained non-ASCII.
+ FIXME: This last presumption is broken when 'directory' is
+ multibyte (with non-ASCII), and 'name' is unibyte with non-ASCII
+ (because file-name-coding-system is 'binary'). */
finalname = (nchars == nbytes)
? make_uninit_string (nbytes)
: make_uninit_multibyte_string (nchars, nbytes);