# HG changeset patch # User Stefan Monnier # Date 1208574587 0 # Node ID e6520392993018cca1165ca5adf0c7ae7f718d5a # Parent bc3f03ffbdf9a2921701d99a83e966ad23bcef8b (directory_files_internal, file_name_completion): Only call ENCODE_FILE if the string is indeed decoded. diff -r bc3f03ffbdf9 -r e65203929930 src/ChangeLog --- 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 + + * dired.c (directory_files_internal, file_name_completion): + Only call ENCODE_FILE if the string is indeed decoded. + 2008-04-18 Stefan Monnier * Makefile.in (TOOLKIT_DEFINES): Remove. diff -r bc3f03ffbdf9 -r e65203929930 src/dired.c --- 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);