8b9a1c
To: vim_dev@googlegroups.com
8b9a1c
Subject: Patch 7.4.015
8b9a1c
Fcc: outbox
8b9a1c
From: Bram Moolenaar <Bram@moolenaar.net>
8b9a1c
Mime-Version: 1.0
8b9a1c
Content-Type: text/plain; charset=UTF-8
8b9a1c
Content-Transfer-Encoding: 8bit
8b9a1c
------------
8b9a1c
8b9a1c
Patch 7.4.015
8b9a1c
Problem:    MS-Windows: Detecting node type does not work for multi-byte
8b9a1c
	    characters.
8b9a1c
Solution:   Use wide character function when needed. (Ken Takata)
8b9a1c
Files:	    src/os_win32.c
8b9a1c
8b9a1c
8b9a1c
*** ../vim-7.4.014/src/os_win32.c	2013-08-10 12:39:12.000000000 +0200
8b9a1c
--- src/os_win32.c	2013-08-30 17:09:47.000000000 +0200
8b9a1c
***************
8b9a1c
*** 3107,3112 ****
8b9a1c
--- 3107,3115 ----
8b9a1c
  {
8b9a1c
      HANDLE	hFile;
8b9a1c
      int		type;
8b9a1c
+ #ifdef FEAT_MBYTE
8b9a1c
+     WCHAR	*wn = NULL;
8b9a1c
+ #endif
8b9a1c
  
8b9a1c
      /* We can't open a file with a name "\\.\con" or "\\.\prn" and trying to
8b9a1c
       * read from it later will cause Vim to hang.  Thus return NODE_WRITABLE
8b9a1c
***************
8b9a1c
*** 3114,3127 ****
8b9a1c
      if (STRNCMP(name, "\\\\.\\", 4) == 0)
8b9a1c
  	return NODE_WRITABLE;
8b9a1c
  
8b9a1c
!     hFile = CreateFile(name,		/* file name */
8b9a1c
! 		GENERIC_WRITE,		/* access mode */
8b9a1c
! 		0,			/* share mode */
8b9a1c
! 		NULL,			/* security descriptor */
8b9a1c
! 		OPEN_EXISTING,		/* creation disposition */
8b9a1c
! 		0,			/* file attributes */
8b9a1c
! 		NULL);			/* handle to template file */
8b9a1c
  
8b9a1c
      if (hFile == INVALID_HANDLE_VALUE)
8b9a1c
  	return NODE_NORMAL;
8b9a1c
  
8b9a1c
--- 3117,3157 ----
8b9a1c
      if (STRNCMP(name, "\\\\.\\", 4) == 0)
8b9a1c
  	return NODE_WRITABLE;
8b9a1c
  
8b9a1c
! #ifdef FEAT_MBYTE
8b9a1c
!     if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
8b9a1c
!     {
8b9a1c
! 	wn = enc_to_utf16(name, NULL);
8b9a1c
! 	if (wn != NULL)
8b9a1c
! 	{
8b9a1c
! 	    hFile = CreateFileW(wn,	/* file name */
8b9a1c
! 			GENERIC_WRITE,	/* access mode */
8b9a1c
! 			0,		/* share mode */
8b9a1c
! 			NULL,		/* security descriptor */
8b9a1c
! 			OPEN_EXISTING,	/* creation disposition */
8b9a1c
! 			0,		/* file attributes */
8b9a1c
! 			NULL);		/* handle to template file */
8b9a1c
! 	    if (hFile == INVALID_HANDLE_VALUE
8b9a1c
! 			      && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
8b9a1c
! 	    {
8b9a1c
! 		/* Retry with non-wide function (for Windows 98). */
8b9a1c
! 		vim_free(wn);
8b9a1c
! 		wn = NULL;
8b9a1c
! 	    }
8b9a1c
! 	}
8b9a1c
!     }
8b9a1c
!     if (wn == NULL)
8b9a1c
! #endif
8b9a1c
! 	hFile = CreateFile(name,	/* file name */
8b9a1c
! 		    GENERIC_WRITE,	/* access mode */
8b9a1c
! 		    0,			/* share mode */
8b9a1c
! 		    NULL,		/* security descriptor */
8b9a1c
! 		    OPEN_EXISTING,	/* creation disposition */
8b9a1c
! 		    0,			/* file attributes */
8b9a1c
! 		    NULL);		/* handle to template file */
8b9a1c
  
8b9a1c
+ #ifdef FEAT_MBYTE
8b9a1c
+     vim_free(wn);
8b9a1c
+ #endif
8b9a1c
      if (hFile == INVALID_HANDLE_VALUE)
8b9a1c
  	return NODE_NORMAL;
8b9a1c
  
8b9a1c
*** ../vim-7.4.014/src/version.c	2013-08-30 17:06:56.000000000 +0200
8b9a1c
--- src/version.c	2013-08-30 17:09:35.000000000 +0200
8b9a1c
***************
8b9a1c
*** 740,741 ****
8b9a1c
--- 740,743 ----
8b9a1c
  {   /* Add new patch number below this line */
8b9a1c
+ /**/
8b9a1c
+     15,
8b9a1c
  /**/
8b9a1c
8b9a1c
-- 
8b9a1c
hundred-and-one symptoms of being an internet addict:
8b9a1c
144. You eagerly await the update of the "Cool Site of the Day."
8b9a1c
8b9a1c
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
8b9a1c
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
8b9a1c
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
8b9a1c
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///