[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/emacs-24 r111199: Use file-name-coding-syst
From: |
Eli Zaretskii |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/emacs-24 r111199: Use file-name-coding-system when decoding symlinks on MS-Windows. |
Date: |
Fri, 25 Jan 2013 16:47:37 +0200 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 111199
committer: Eli Zaretskii <address@hidden>
branch nick: emacs-24
timestamp: Fri 2013-01-25 16:47:37 +0200
message:
Use file-name-coding-system when decoding symlinks on MS-Windows.
src/w32.c (readlink): Use the current file-name-coding-system, not the ANSI
codepage, to decode and handle targets of symlinks.
modified:
src/ChangeLog
src/w32.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2013-01-25 14:34:26 +0000
+++ b/src/ChangeLog 2013-01-25 14:47:37 +0000
@@ -2,6 +2,8 @@
* w32.c (w32_get_long_filename, init_environment, readlink):
Support file names encoded in DBCS codepages.
+ (readlink): Use the current file-name-coding-system, not the ANSI
+ codepage, to decode and handle targets of symlinks.
2013-01-23 Eli Zaretskii <address@hidden>
=== modified file 'src/w32.c'
--- a/src/w32.c 2013-01-25 14:34:26 +0000
+++ b/src/w32.c 2013-01-25 14:47:37 +0000
@@ -4305,6 +4305,8 @@
WCHAR *lwname_src =
reparse_data->SymbolicLinkReparseBuffer.PathBuffer
+
reparse_data->SymbolicLinkReparseBuffer.PrintNameOffset/sizeof(WCHAR);
+ /* This updates file_name_codepage which we need below. */
+ int dbcs_p = max_filename_mbslen () > 1;
/* According to MSDN, PrintNameLength does not include the
terminating null character. */
@@ -4312,9 +4314,7 @@
memcpy (lwname, lwname_src, lwname_len);
lwname[lwname_len/sizeof(WCHAR)] = 0; /* null-terminate */
- /* FIXME: Should we use the current file-name coding system
- instead of the fixed value of the ANSI codepage? */
- lname_len = WideCharToMultiByte (w32_ansi_code_page, 0, lwname, -1,
+ lname_len = WideCharToMultiByte (file_name_codepage, 0, lwname, -1,
lname, MAX_PATH, NULL, NULL);
if (!lname_len)
{
@@ -4342,12 +4342,11 @@
size_t size_to_copy = buf_size;
BYTE *p = lname, *p2;
BYTE *pend = p + lname_len;
- int dbcs_p = max_filename_mbslen () > 1;
/* Normalize like dostounix_filename does, but we don't
want to assume that lname is null-terminated. */
if (dbcs_p)
- p2 = CharNextExA (w32_ansi_code_page, p, 0);
+ p2 = CharNextExA (file_name_codepage, p, 0);
else
p2 = p + 1;
if (*p && *p2 == ':' && *p >= 'A' && *p <= 'Z')
@@ -4361,7 +4360,7 @@
*p = '/';
if (dbcs_p)
{
- p = CharNextExA (w32_ansi_code_page, p, 0);
+ p = CharNextExA (file_name_codepage, p, 0);
/* CharNextExA doesn't advance at null character. */
if (!*p)
break;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/emacs-24 r111199: Use file-name-coding-system when decoding symlinks on MS-Windows.,
Eli Zaretskii <=