mirror of
https://github.com/masscollaborationlabs/emacs.git
synced 2025-07-13 07:30:56 +00:00
w32.c (readlink): Support DBCS codepages.
This commit is contained in:
parent
d8cd7742b3
commit
69bb66c12e
2 changed files with 22 additions and 4 deletions
|
@ -1,5 +1,7 @@
|
||||||
2013-01-25 Eli Zaretskii <eliz@gnu.org>
|
2013-01-25 Eli Zaretskii <eliz@gnu.org>
|
||||||
|
|
||||||
|
* w32.c (readlink): Support DBCS codepages.
|
||||||
|
|
||||||
* w32notify.c (Fw32notify_add_watch): Doc fix. (Bug#13540)
|
* w32notify.c (Fw32notify_add_watch): Doc fix. (Bug#13540)
|
||||||
|
|
||||||
2013-01-25 Dmitry Antipov <dmantipov@yandex.ru>
|
2013-01-25 Dmitry Antipov <dmantipov@yandex.ru>
|
||||||
|
|
20
src/w32.c
20
src/w32.c
|
@ -4639,17 +4639,33 @@ readlink (const char *name, char *buf, size_t buf_size)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
size_t size_to_copy = buf_size;
|
size_t size_to_copy = buf_size;
|
||||||
BYTE *p = lname;
|
BYTE *p = lname, *p2;
|
||||||
BYTE *pend = p + lname_len;
|
BYTE *pend = p + lname_len;
|
||||||
|
int dbcs_p = max_filename_mbslen () > 1;
|
||||||
|
|
||||||
/* Normalize like dostounix_filename does, but we don't
|
/* Normalize like dostounix_filename does, but we don't
|
||||||
want to assume that lname is null-terminated. */
|
want to assume that lname is null-terminated. */
|
||||||
if (*p && p[1] == ':' && *p >= 'A' && *p <= 'Z')
|
if (dbcs_p)
|
||||||
|
p2 = CharNextExA (file_name_codepage, p, 0);
|
||||||
|
else
|
||||||
|
p2 = p + 1;
|
||||||
|
if (*p && *p2 == ':' && *p >= 'A' && *p <= 'Z')
|
||||||
|
{
|
||||||
*p += 'a' - 'A';
|
*p += 'a' - 'A';
|
||||||
|
p += 2;
|
||||||
|
}
|
||||||
while (p <= pend)
|
while (p <= pend)
|
||||||
{
|
{
|
||||||
if (*p == '\\')
|
if (*p == '\\')
|
||||||
*p = '/';
|
*p = '/';
|
||||||
|
if (dbcs_p)
|
||||||
|
{
|
||||||
|
p = CharNextExA (file_name_codepage, p, 0);
|
||||||
|
/* CharNextExA doesn't advance at null character. */
|
||||||
|
if (!*p)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
++p;
|
++p;
|
||||||
}
|
}
|
||||||
/* Testing for null-terminated LNAME is paranoia:
|
/* Testing for null-terminated LNAME is paranoia:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue