jkunstle / rpms / vim

Forked from rpms/vim 3 years ago
Clone

Blame SOURCES/7.4.122

3ef2ca
To: vim_dev@googlegroups.com
3ef2ca
Subject: Patch 7.4.122
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.122
3ef2ca
Problem:    Win32: When 'encoding' is set to "utf-8" and the active codepage
3ef2ca
	    is cp932 then ":grep" and other commands don't work for multi-byte
3ef2ca
	    characters.
3ef2ca
Solution:   (Yasuhiro Matsumoto)
3ef2ca
Files:	    src/os_win32.c
3ef2ca
3ef2ca
3ef2ca
*** ../vim-7.4.121/src/os_win32.c	2013-12-07 14:48:06.000000000 +0100
3ef2ca
--- src/os_win32.c	2013-12-11 17:57:48.000000000 +0100
3ef2ca
***************
3ef2ca
*** 3788,3793 ****
3ef2ca
--- 3788,3837 ----
3ef2ca
  }
3ef2ca
  #endif /* FEAT_GUI_W32 */
3ef2ca
  
3ef2ca
+     static BOOL
3ef2ca
+ vim_create_process(
3ef2ca
+     const char		*cmd,
3ef2ca
+     DWORD		flags,
3ef2ca
+     BOOL		inherit_handles,
3ef2ca
+     STARTUPINFO		*si,
3ef2ca
+     PROCESS_INFORMATION *pi)
3ef2ca
+ {
3ef2ca
+ #  ifdef FEAT_MBYTE
3ef2ca
+     if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
3ef2ca
+     {
3ef2ca
+ 	WCHAR	*wcmd = enc_to_utf16(cmd, NULL);
3ef2ca
+ 
3ef2ca
+ 	if (wcmd != NULL)
3ef2ca
+ 	{
3ef2ca
+ 	    BOOL ret;
3ef2ca
+ 	    ret = CreateProcessW(
3ef2ca
+ 		NULL,			/* Executable name */
3ef2ca
+ 		wcmd,			/* Command to execute */
3ef2ca
+ 		NULL,			/* Process security attributes */
3ef2ca
+ 		NULL,			/* Thread security attributes */
3ef2ca
+ 		inherit_handles,	/* Inherit handles */
3ef2ca
+ 		flags,			/* Creation flags */
3ef2ca
+ 		NULL,			/* Environment */
3ef2ca
+ 		NULL,			/* Current directory */
3ef2ca
+ 		si,			/* Startup information */
3ef2ca
+ 		pi);			/* Process information */
3ef2ca
+ 	    vim_free(wcmd);
3ef2ca
+ 	    return ret;
3ef2ca
+ 	}
3ef2ca
+     }
3ef2ca
+ #endif
3ef2ca
+     return CreateProcess(
3ef2ca
+ 	NULL,			/* Executable name */
3ef2ca
+ 	cmd,			/* Command to execute */
3ef2ca
+ 	NULL,			/* Process security attributes */
3ef2ca
+ 	NULL,			/* Thread security attributes */
3ef2ca
+ 	inherit_handles,	/* Inherit handles */
3ef2ca
+ 	flags,			/* Creation flags */
3ef2ca
+ 	NULL,			/* Environment */
3ef2ca
+ 	NULL,			/* Current directory */
3ef2ca
+ 	si,			/* Startup information */
3ef2ca
+ 	pi);			/* Process information */
3ef2ca
+ }
3ef2ca
  
3ef2ca
  
3ef2ca
  #if defined(FEAT_GUI_W32) || defined(PROTO)
3ef2ca
***************
3ef2ca
*** 3834,3851 ****
3ef2ca
  	cmd += 3;
3ef2ca
  
3ef2ca
      /* Now, run the command */
3ef2ca
!     CreateProcess(NULL,			/* Executable name */
3ef2ca
! 		  cmd,			/* Command to execute */
3ef2ca
! 		  NULL,			/* Process security attributes */
3ef2ca
! 		  NULL,			/* Thread security attributes */
3ef2ca
! 		  FALSE,		/* Inherit handles */
3ef2ca
! 		  CREATE_DEFAULT_ERROR_MODE |	/* Creation flags */
3ef2ca
! 			CREATE_NEW_CONSOLE,
3ef2ca
! 		  NULL,			/* Environment */
3ef2ca
! 		  NULL,			/* Current directory */
3ef2ca
! 		  &si,			/* Startup information */
3ef2ca
! 		  &pi);			/* Process information */
3ef2ca
! 
3ef2ca
  
3ef2ca
      /* Wait for the command to terminate before continuing */
3ef2ca
      if (g_PlatformId != VER_PLATFORM_WIN32s)
3ef2ca
--- 3878,3885 ----
3ef2ca
  	cmd += 3;
3ef2ca
  
3ef2ca
      /* Now, run the command */
3ef2ca
!     vim_create_process(cmd, FALSE,
3ef2ca
! 	    CREATE_DEFAULT_ERROR_MODE |	CREATE_NEW_CONSOLE, &si, &pi);
3ef2ca
  
3ef2ca
      /* Wait for the command to terminate before continuing */
3ef2ca
      if (g_PlatformId != VER_PLATFORM_WIN32s)
3ef2ca
***************
3ef2ca
*** 4177,4198 ****
3ef2ca
  	    p = cmd;
3ef2ca
      }
3ef2ca
  
3ef2ca
!     /* Now, run the command */
3ef2ca
!     CreateProcess(NULL,			/* Executable name */
3ef2ca
! 		  p,			/* Command to execute */
3ef2ca
! 		  NULL,			/* Process security attributes */
3ef2ca
! 		  NULL,			/* Thread security attributes */
3ef2ca
! 
3ef2ca
! 		  // this command can be litigious, handle inheritance was
3ef2ca
! 		  // deactivated for pending temp file, but, if we deactivate
3ef2ca
! 		  // it, the pipes don't work for some reason.
3ef2ca
! 		  TRUE,			/* Inherit handles, first deactivated,
3ef2ca
! 					 * but needed */
3ef2ca
! 		  CREATE_DEFAULT_ERROR_MODE, /* Creation flags */
3ef2ca
! 		  NULL,			/* Environment */
3ef2ca
! 		  NULL,			/* Current directory */
3ef2ca
! 		  &si,			/* Startup information */
3ef2ca
! 		  &pi);			/* Process information */
3ef2ca
  
3ef2ca
      if (p != cmd)
3ef2ca
  	vim_free(p);
3ef2ca
--- 4211,4221 ----
3ef2ca
  	    p = cmd;
3ef2ca
      }
3ef2ca
  
3ef2ca
!     /* Now, run the command.
3ef2ca
!      * About "Inherit handles" being TRUE: this command can be litigious,
3ef2ca
!      * handle inheritance was deactivated for pending temp file, but, if we
3ef2ca
!      * deactivate it, the pipes don't work for some reason. */
3ef2ca
!      vim_create_process(p, TRUE, CREATE_DEFAULT_ERROR_MODE, &si, &pi);
3ef2ca
  
3ef2ca
      if (p != cmd)
3ef2ca
  	vim_free(p);
3ef2ca
***************
3ef2ca
*** 4410,4416 ****
3ef2ca
  }
3ef2ca
  #else
3ef2ca
  
3ef2ca
! # define mch_system(c, o) system(c)
3ef2ca
  
3ef2ca
  #endif
3ef2ca
  
3ef2ca
--- 4433,4457 ----
3ef2ca
  }
3ef2ca
  #else
3ef2ca
  
3ef2ca
! # ifdef FEAT_MBYTE
3ef2ca
!     static int
3ef2ca
! mch_system(char *cmd, int options)
3ef2ca
! {
3ef2ca
!     if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
3ef2ca
!     {
3ef2ca
! 	WCHAR	*wcmd = enc_to_utf16(cmd, NULL);
3ef2ca
! 	if (wcmd != NULL)
3ef2ca
! 	{
3ef2ca
! 	    int ret = _wsystem(wcmd);
3ef2ca
! 	    vim_free(wcmd);
3ef2ca
! 	    return ret;
3ef2ca
! 	}
3ef2ca
!     }
3ef2ca
!     return system(cmd);
3ef2ca
! }
3ef2ca
! # else
3ef2ca
! #  define mch_system(c, o) system(c)
3ef2ca
! # endif
3ef2ca
  
3ef2ca
  #endif
3ef2ca
  
3ef2ca
***************
3ef2ca
*** 4578,4593 ****
3ef2ca
  	     * inherit our handles which causes unpleasant dangling swap
3ef2ca
  	     * files if we exit before the spawned process
3ef2ca
  	     */
3ef2ca
! 	    if (CreateProcess(NULL,		// Executable name
3ef2ca
! 		    newcmd,			// Command to execute
3ef2ca
! 		    NULL,			// Process security attributes
3ef2ca
! 		    NULL,			// Thread security attributes
3ef2ca
! 		    FALSE,			// Inherit handles
3ef2ca
! 		    flags,			// Creation flags
3ef2ca
! 		    NULL,			// Environment
3ef2ca
! 		    NULL,			// Current directory
3ef2ca
! 		    &si,			// Startup information
3ef2ca
! 		    &pi))			// Process information
3ef2ca
  		x = 0;
3ef2ca
  	    else
3ef2ca
  	    {
3ef2ca
--- 4619,4625 ----
3ef2ca
  	     * inherit our handles which causes unpleasant dangling swap
3ef2ca
  	     * files if we exit before the spawned process
3ef2ca
  	     */
3ef2ca
! 	    if (vim_create_process(newcmd, FALSE, flags, &si, &pi))
3ef2ca
  		x = 0;
3ef2ca
  	    else
3ef2ca
  	    {
3ef2ca
*** ../vim-7.4.121/src/version.c	2013-12-11 17:44:33.000000000 +0100
3ef2ca
--- src/version.c	2013-12-11 17:48:09.000000000 +0100
3ef2ca
***************
3ef2ca
*** 740,741 ****
3ef2ca
--- 740,743 ----
3ef2ca
  {   /* Add new patch number below this line */
3ef2ca
+ /**/
3ef2ca
+     122,
3ef2ca
  /**/
3ef2ca
3ef2ca
-- 
3ef2ca
Never overestimate a man's ability to underestimate a woman.
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    ///