summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <bram@vim.org>2013-08-30 17:11:33 +0200
committerBram Moolenaar <bram@vim.org>2013-08-30 17:11:33 +0200
commit9505355efa7d2273854db2c8f27f30a655941e90 (patch)
tree986892982610ba2ca3ce0c3e50f754db6af7b852
parent35ffaa01133aa4d3ffafac77170f04d5cbf61cc5 (diff)
downloadvim-7-4-015.tar.gz
updated for version 7.4.015v7.4.015v7-4-015
Problem: MS-Windows: Detecting node type does not work for multi-byte characters. Solution: Use wide character function when needed. (Ken Takata)
-rw-r--r--src/os_win32.c44
-rw-r--r--src/version.c2
2 files changed, 39 insertions, 7 deletions
diff --git a/src/os_win32.c b/src/os_win32.c
index 4013353c..33a72565 100644
--- a/src/os_win32.c
+++ b/src/os_win32.c
@@ -3107,6 +3107,9 @@ mch_nodetype(char_u *name)
{
HANDLE hFile;
int type;
+#ifdef FEAT_MBYTE
+ WCHAR *wn = NULL;
+#endif
/* 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
@@ -3114,14 +3117,41 @@ mch_nodetype(char_u *name)
if (STRNCMP(name, "\\\\.\\", 4) == 0)
return NODE_WRITABLE;
- 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
+ if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
+ {
+ wn = enc_to_utf16(name, NULL);
+ if (wn != NULL)
+ {
+ 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)
return NODE_NORMAL;
diff --git a/src/version.c b/src/version.c
index e8b93596..fb145933 100644
--- a/src/version.c
+++ b/src/version.c
@@ -739,6 +739,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 15,
+/**/
14,
/**/
13,