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