comparison src/dired.c @ 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 3af508d0bd74
children 436ee104782b
comparison
equal deleted inserted replaced
94177:bc3f03ffbdf9 94178:e65203929930
191 } 191 }
192 192
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! */
201 203
202 BLOCK_INPUT; 204 BLOCK_INPUT;
249 251
250 len = NAMLEN (dp); 252 len = NAMLEN (dp);
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);
258 260
259 /* Now that we have unwind_protect in place, we might as well 261 /* Now that we have unwind_protect in place, we might as well
504 dirname = Fexpand_file_name (dirname, Qnil); 506 dirname = Fexpand_file_name (dirname, Qnil);
505 507
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
513 /* With passcount = 0, ignore files that end in an ignored extension. 515 /* With passcount = 0, ignore files that end in an ignored extension.
514 If nothing found then try again with passcount = 1, don't ignore them. 516 If nothing found then try again with passcount = 1, don't ignore them.