mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
updated for version 7.4.015
Problem: MS-Windows: Detecting node type does not work for multi-byte characters. Solution: Use wide character function when needed. (Ken Takata)
This commit is contained in:
parent
4e4f529792
commit
4dee1bb0db
@ -3107,6 +3107,9 @@ mch_nodetype(char_u *name)
|
|||||||
{
|
{
|
||||||
HANDLE hFile;
|
HANDLE hFile;
|
||||||
int type;
|
int type;
|
||||||
|
#ifdef FEAT_MBYTE
|
||||||
|
WCHAR *wn = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* We can't open a file with a name "\\.\con" or "\\.\prn" and trying to
|
/* We can't open a file with a name "\\.\con" or "\\.\prn" and trying to
|
||||||
* read from it later will cause Vim to hang. Thus return NODE_WRITABLE
|
* read from it later will cause Vim to hang. Thus return NODE_WRITABLE
|
||||||
@ -3114,14 +3117,41 @@ mch_nodetype(char_u *name)
|
|||||||
if (STRNCMP(name, "\\\\.\\", 4) == 0)
|
if (STRNCMP(name, "\\\\.\\", 4) == 0)
|
||||||
return NODE_WRITABLE;
|
return NODE_WRITABLE;
|
||||||
|
|
||||||
hFile = CreateFile(name, /* file name */
|
#ifdef FEAT_MBYTE
|
||||||
GENERIC_WRITE, /* access mode */
|
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
||||||
0, /* share mode */
|
{
|
||||||
NULL, /* security descriptor */
|
wn = enc_to_utf16(name, NULL);
|
||||||
OPEN_EXISTING, /* creation disposition */
|
if (wn != NULL)
|
||||||
0, /* file attributes */
|
{
|
||||||
NULL); /* handle to template file */
|
hFile = CreateFileW(wn, /* file name */
|
||||||
|
GENERIC_WRITE, /* access mode */
|
||||||
|
0, /* share mode */
|
||||||
|
NULL, /* security descriptor */
|
||||||
|
OPEN_EXISTING, /* creation disposition */
|
||||||
|
0, /* file attributes */
|
||||||
|
NULL); /* handle to template file */
|
||||||
|
if (hFile == INVALID_HANDLE_VALUE
|
||||||
|
&& GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
|
||||||
|
{
|
||||||
|
/* Retry with non-wide function (for Windows 98). */
|
||||||
|
vim_free(wn);
|
||||||
|
wn = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (wn == NULL)
|
||||||
|
#endif
|
||||||
|
hFile = CreateFile(name, /* file name */
|
||||||
|
GENERIC_WRITE, /* access mode */
|
||||||
|
0, /* share mode */
|
||||||
|
NULL, /* security descriptor */
|
||||||
|
OPEN_EXISTING, /* creation disposition */
|
||||||
|
0, /* file attributes */
|
||||||
|
NULL); /* handle to template file */
|
||||||
|
|
||||||
|
#ifdef FEAT_MBYTE
|
||||||
|
vim_free(wn);
|
||||||
|
#endif
|
||||||
if (hFile == INVALID_HANDLE_VALUE)
|
if (hFile == INVALID_HANDLE_VALUE)
|
||||||
return NODE_NORMAL;
|
return NODE_NORMAL;
|
||||||
|
|
||||||
|
@ -738,6 +738,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
15,
|
||||||
/**/
|
/**/
|
||||||
14,
|
14,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user