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