mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-02-28 12:05:47 +08:00
* path.cc (cygwin_conv_path): Rearrange test for "." in POSIX to
relative DOS path conversion. Simplify fixing the path. In CCP_POSIX_TO_WIN_W conversion, always drop long path prefix if path fits into MAX_PATH. Explain why.
This commit is contained in:
parent
0de7cf04f3
commit
06cc41a63a
@ -1,3 +1,10 @@
|
|||||||
|
2010-08-04 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* path.cc (cygwin_conv_path): Rearrange test for "." in POSIX to
|
||||||
|
relative DOS path conversion. Simplify fixing the path.
|
||||||
|
In CCP_POSIX_TO_WIN_W conversion, always drop long path prefix if path
|
||||||
|
fits into MAX_PATH. Explain why.
|
||||||
|
|
||||||
2010-08-01 Christopher Faylor <me+cygwin@cgf.cx>
|
2010-08-01 Christopher Faylor <me+cygwin@cgf.cx>
|
||||||
|
|
||||||
* exceptions.cc (_cygtls::interrupt_now): Revert to checking for
|
* exceptions.cc (_cygtls::interrupt_now): Revert to checking for
|
||||||
|
@ -2805,6 +2805,7 @@ cygwin_conv_path (cygwin_conv_path_t what, const void *from, void *to,
|
|||||||
path_conv p;
|
path_conv p;
|
||||||
size_t lsiz = 0;
|
size_t lsiz = 0;
|
||||||
char *buf = NULL;
|
char *buf = NULL;
|
||||||
|
PWCHAR path = NULL;
|
||||||
int error = 0;
|
int error = 0;
|
||||||
bool relative = !!(what & CCP_RELATIVE);
|
bool relative = !!(what & CCP_RELATIVE);
|
||||||
what &= ~CCP_RELATIVE;
|
what &= ~CCP_RELATIVE;
|
||||||
@ -2833,11 +2834,11 @@ cygwin_conv_path (cygwin_conv_path_t what, const void *from, void *to,
|
|||||||
backslash ".\\" in the Win32 path. That's a result of the
|
backslash ".\\" in the Win32 path. That's a result of the
|
||||||
conversion in normalize_posix_path. This should not occur
|
conversion in normalize_posix_path. This should not occur
|
||||||
so the below code is just a band-aid. */
|
so the below code is just a band-aid. */
|
||||||
if (!strcmp ((const char *) from, ".") && relative
|
if (relative && !strcmp ((const char *) from, ".")
|
||||||
&& !strcmp (buf, ".\\"))
|
&& !strcmp (buf, ".\\"))
|
||||||
{
|
{
|
||||||
--lsiz;
|
lsiz = 2;
|
||||||
buf[lsiz - 1] = '\0';
|
buf[1] = '\0';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -2858,13 +2859,34 @@ cygwin_conv_path (cygwin_conv_path_t what, const void *from, void *to,
|
|||||||
return_with_errno (p.error);
|
return_with_errno (p.error);
|
||||||
}
|
}
|
||||||
lsiz = p.get_wide_win32_path_len () + 1;
|
lsiz = p.get_wide_win32_path_len () + 1;
|
||||||
|
path = p.get_nt_native_path ()->Buffer;
|
||||||
|
|
||||||
|
/* Convert native path to standard DOS path. */
|
||||||
|
if (!wcsncmp (path, L"\\??\\", 4))
|
||||||
|
{
|
||||||
|
path[1] = L'\\';
|
||||||
|
|
||||||
|
/* Drop long path prefix for short pathnames. Unfortunately there's
|
||||||
|
quite a bunch of Win32 functions, especially in user32.dll,
|
||||||
|
apparently, which don't grok long path names at all, not even
|
||||||
|
in the UNICODE API. */
|
||||||
|
if (lsiz <= MAX_PATH + 4 || (path[5] != L':' && lsiz <= MAX_PATH + 6))
|
||||||
|
{
|
||||||
|
path += 4;
|
||||||
|
lsiz -= 4;
|
||||||
|
if (path[1] != L':')
|
||||||
|
{
|
||||||
|
*(path += 2) = '\\';
|
||||||
|
lsiz -= 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
/* TODO: Same ".\\" band-aid as in CCP_POSIX_TO_WIN_A case. */
|
/* TODO: Same ".\\" band-aid as in CCP_POSIX_TO_WIN_A case. */
|
||||||
if (!strcmp ((const char *) from, ".") && relative
|
if (relative && !strcmp ((const char *) from, ".")
|
||||||
&& !wcscmp (p.get_nt_native_path ()->Buffer, L".\\"))
|
&& !wcscmp (path, L".\\"))
|
||||||
{
|
{
|
||||||
--lsiz;
|
lsiz = 2;
|
||||||
p.get_nt_native_path ()->Length -= sizeof (WCHAR);
|
path[1] = L'\0';
|
||||||
p.get_nt_native_path ()->Buffer[lsiz - 1] = L'\0';
|
|
||||||
}
|
}
|
||||||
lsiz *= sizeof (WCHAR);
|
lsiz *= sizeof (WCHAR);
|
||||||
break;
|
break;
|
||||||
@ -2903,7 +2925,7 @@ cygwin_conv_path (cygwin_conv_path_t what, const void *from, void *to,
|
|||||||
strcpy ((char *) to, buf);
|
strcpy ((char *) to, buf);
|
||||||
break;
|
break;
|
||||||
case CCP_POSIX_TO_WIN_W:
|
case CCP_POSIX_TO_WIN_W:
|
||||||
p.get_wide_win32_path ((PWCHAR) to);
|
wcscpy ((PWCHAR) to, path);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user