changeset 94178:e65203929930

(directory_files_internal, file_name_completion): Only call ENCODE_FILE if the string is indeed decoded.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Sat, 19 Apr 2008 03:09:47 +0000
parents bc3f03ffbdf9
children d55e28c98546
files src/ChangeLog src/dired.c
diffstat 2 files changed, 11 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Fri Apr 18 18:24:29 2008 +0000
+++ b/src/ChangeLog	Sat Apr 19 03:09:47 2008 +0000
@@ -1,3 +1,8 @@
+2008-04-19  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* dired.c (directory_files_internal, file_name_completion):
+	Only call ENCODE_FILE if the string is indeed decoded.
+
 2008-04-18  Stefan Monnier  <monnier@iro.umontreal.ca>
 
 	* Makefile.in (TOOLKIT_DEFINES): Remove.
--- a/src/dired.c	Fri Apr 18 18:24:29 2008 +0000
+++ b/src/dired.c	Sat Apr 19 03:09:47 2008 +0000
@@ -193,8 +193,10 @@
   /* Note: ENCODE_FILE and DECODE_FILE can GC because they can run
      run_pre_post_conversion_on_str which calls Lisp directly and
      indirectly.  */
-  dirfilename = ENCODE_FILE (dirfilename);
-  encoded_directory = ENCODE_FILE (directory);
+  if (STRING_MULTIBYTE (dirfilename))
+    dirfilename = ENCODE_FILE (dirfilename);
+  encoded_directory = (STRING_MULTIBYTE (directory)
+		       ? ENCODE_FILE (directory) : directory);
 
   /* Now *bufp is the compiled form of MATCH; don't call anything
      which might compile a new regexp until we're done with the loop!  */
@@ -251,7 +253,7 @@
 	  name = finalname = make_unibyte_string (dp->d_name, len);
 	  GCPRO2 (finalname, name);
 
-	  /* Note: ENCODE_FILE can GC; it should protect its argument,
+	  /* Note: DECODE_FILE can GC; it should protect its argument,
 	     though.  */
 	  name = DECODE_FILE (name);
 	  len = SBYTES (name);
@@ -506,7 +508,7 @@
   /* Do completion on the encoded file name
      because the other names in the directory are (we presume)
      encoded likewise.  We decode the completed string at the end.  */
-  encoded_file = ENCODE_FILE (file);
+  encoded_file = STRING_MULTIBYTE (file) ? ENCODE_FILE (file) : file;
 
   encoded_dir = ENCODE_FILE (dirname);