lkundrak / rpms / vim

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