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