aboutsummaryrefslogtreecommitdiffstats
path: root/src/dired.c
diff options
context:
space:
mode:
authorStefan Monnier2008-04-19 03:09:47 +0000
committerStefan Monnier2008-04-19 03:09:47 +0000
commit6c8b4f07d1ccde31589e46d3582cedaab8af8062 (patch)
treee865151d10fc5a8ec49f37811f935c512044880a /src/dired.c
parent95de358c3050d1e0162238bbafe05cd598193640 (diff)
downloademacs-6c8b4f07d1ccde31589e46d3582cedaab8af8062.tar.gz
emacs-6c8b4f07d1ccde31589e46d3582cedaab8af8062.zip
(directory_files_internal, file_name_completion):
Only call ENCODE_FILE if the string is indeed decoded.
Diffstat (limited to 'src/dired.c')
-rw-r--r--src/dired.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/dired.c b/src/dired.c
index 3efc87ac844..f8b8f2dc84a 100644
--- a/src/dired.c
+++ b/src/dired.c
@@ -193,8 +193,10 @@ directory_files_internal (directory, full, match, nosort, attrs, id_format)
193 /* Note: ENCODE_FILE and DECODE_FILE can GC because they can run 193 /* Note: ENCODE_FILE and DECODE_FILE can GC because they can run
194 run_pre_post_conversion_on_str which calls Lisp directly and 194 run_pre_post_conversion_on_str which calls Lisp directly and
195 indirectly. */ 195 indirectly. */
196 dirfilename = ENCODE_FILE (dirfilename); 196 if (STRING_MULTIBYTE (dirfilename))
197 encoded_directory = ENCODE_FILE (directory); 197 dirfilename = ENCODE_FILE (dirfilename);
198 encoded_directory = (STRING_MULTIBYTE (directory)
199 ? ENCODE_FILE (directory) : directory);
198 200
199 /* Now *bufp is the compiled form of MATCH; don't call anything 201 /* Now *bufp is the compiled form of MATCH; don't call anything
200 which might compile a new regexp until we're done with the loop! */ 202 which might compile a new regexp until we're done with the loop! */
@@ -251,7 +253,7 @@ directory_files_internal (directory, full, match, nosort, attrs, id_format)
251 name = finalname = make_unibyte_string (dp->d_name, len); 253 name = finalname = make_unibyte_string (dp->d_name, len);
252 GCPRO2 (finalname, name); 254 GCPRO2 (finalname, name);
253 255
254 /* Note: ENCODE_FILE can GC; it should protect its argument, 256 /* Note: DECODE_FILE can GC; it should protect its argument,
255 though. */ 257 though. */
256 name = DECODE_FILE (name); 258 name = DECODE_FILE (name);
257 len = SBYTES (name); 259 len = SBYTES (name);
@@ -506,7 +508,7 @@ file_name_completion (file, dirname, all_flag, ver_flag, predicate)
506 /* Do completion on the encoded file name 508 /* Do completion on the encoded file name
507 because the other names in the directory are (we presume) 509 because the other names in the directory are (we presume)
508 encoded likewise. We decode the completed string at the end. */ 510 encoded likewise. We decode the completed string at the end. */
509 encoded_file = ENCODE_FILE (file); 511 encoded_file = STRING_MULTIBYTE (file) ? ENCODE_FILE (file) : file;
510 512
511 encoded_dir = ENCODE_FILE (dirname); 513 encoded_dir = ENCODE_FILE (dirname);
512 514