diff options
| author | Eli Zaretskii | 2012-12-04 20:48:01 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2012-12-04 20:48:01 +0200 |
| commit | 2e7cddd30317b7951c5425a5769ac9f33136f72f (patch) | |
| tree | f7791324a1d88f9b0c1dbb3ddf97646889a70723 /src | |
| parent | 52d129cd62f502a855031c7cf5b6959a4a6e33da (diff) | |
| download | emacs-2e7cddd30317b7951c5425a5769ac9f33136f72f.tar.gz emacs-2e7cddd30317b7951c5425a5769ac9f33136f72f.zip | |
Fix another instance of bug #12933 with non-ASCII file names on Windows.
src/fileio.c (file_name_as_directory, directory_file_name) [DOS_NT]:
Encode the file name before passing it to dostounix_filename, in
case it will downcase it (under w32-downcase-file-names).
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 7 | ||||
| -rw-r--r-- | src/fileio.c | 22 |
2 files changed, 25 insertions, 4 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index d3d6d3969c8..6d2cd720672 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2012-12-04 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * fileio.c (file_name_as_directory, directory_file_name) [DOS_NT]: | ||
| 4 | Encode the file name before passing it to dostounix_filename, in | ||
| 5 | case it will downcase it (under w32-downcase-file-names). | ||
| 6 | (Bug#12933) | ||
| 7 | |||
| 1 | 2012-12-01 Chong Yidong <cyd@gnu.org> | 8 | 2012-12-01 Chong Yidong <cyd@gnu.org> |
| 2 | 9 | ||
| 3 | * fileio.c (Vauto_save_list_file_name): Doc fix. | 10 | * fileio.c (Vauto_save_list_file_name): Doc fix. |
diff --git a/src/fileio.c b/src/fileio.c index 490116dbc5c..77700ff5a5f 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -455,7 +455,7 @@ get a current directory to run processes in. */) | |||
| 455 | 455 | ||
| 456 | /* Convert from file name SRC of length SRCLEN to directory name | 456 | /* Convert from file name SRC of length SRCLEN to directory name |
| 457 | in DST. On UNIX, just make sure there is a terminating /. | 457 | in DST. On UNIX, just make sure there is a terminating /. |
| 458 | Return the length of DST. */ | 458 | Return the length of DST in bytes. */ |
| 459 | 459 | ||
| 460 | static ptrdiff_t | 460 | static ptrdiff_t |
| 461 | file_name_as_directory (char *dst, const char *src, ptrdiff_t srclen) | 461 | file_name_as_directory (char *dst, const char *src, ptrdiff_t srclen) |
| @@ -477,7 +477,14 @@ file_name_as_directory (char *dst, const char *src, ptrdiff_t srclen) | |||
| 477 | srclen++; | 477 | srclen++; |
| 478 | } | 478 | } |
| 479 | #ifdef DOS_NT | 479 | #ifdef DOS_NT |
| 480 | dostounix_filename (dst); | 480 | { |
| 481 | Lisp_Object tem_fn = make_specified_string (dst, -1, srclen, 1); | ||
| 482 | |||
| 483 | tem_fn = ENCODE_FILE (tem_fn); | ||
| 484 | dostounix_filename (SSDATA (tem_fn)); | ||
| 485 | tem_fn = DECODE_FILE (tem_fn); | ||
| 486 | memcpy (dst, SSDATA (tem_fn), (srclen = SBYTES (tem_fn)) + 1); | ||
| 487 | } | ||
| 481 | #endif | 488 | #endif |
| 482 | return srclen; | 489 | return srclen; |
| 483 | } | 490 | } |
| @@ -519,7 +526,7 @@ For a Unix-syntax file name, just appends a slash. */) | |||
| 519 | 526 | ||
| 520 | /* Convert from directory name SRC of length SRCLEN to | 527 | /* Convert from directory name SRC of length SRCLEN to |
| 521 | file name in DST. On UNIX, just make sure there isn't | 528 | file name in DST. On UNIX, just make sure there isn't |
| 522 | a terminating /. Return the length of DST. */ | 529 | a terminating /. Return the length of DST in bytes. */ |
| 523 | 530 | ||
| 524 | static ptrdiff_t | 531 | static ptrdiff_t |
| 525 | directory_file_name (char *dst, char *src, ptrdiff_t srclen) | 532 | directory_file_name (char *dst, char *src, ptrdiff_t srclen) |
| @@ -538,7 +545,14 @@ directory_file_name (char *dst, char *src, ptrdiff_t srclen) | |||
| 538 | srclen--; | 545 | srclen--; |
| 539 | } | 546 | } |
| 540 | #ifdef DOS_NT | 547 | #ifdef DOS_NT |
| 541 | dostounix_filename (dst); | 548 | { |
| 549 | Lisp_Object tem_fn = make_specified_string (dst, -1, srclen, 1); | ||
| 550 | |||
| 551 | tem_fn = ENCODE_FILE (tem_fn); | ||
| 552 | dostounix_filename (SSDATA (tem_fn)); | ||
| 553 | tem_fn = DECODE_FILE (tem_fn); | ||
| 554 | memcpy (dst, SSDATA (tem_fn), (srclen = SBYTES (tem_fn)) + 1); | ||
| 555 | } | ||
| 542 | #endif | 556 | #endif |
| 543 | return srclen; | 557 | return srclen; |
| 544 | } | 558 | } |