Blob Blame History Raw
To: vim_dev@googlegroups.com
Subject: Patch 7.3.276
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 7.3.276
Problem:    GvimExt sets $LANG in the wrong way.
Solution:   Save the environment and use it for gvim. (Yasuhiro Matsumoto)
Files:	    src/GvimExt/gvimext.cpp


*** ../vim-7.3.275/src/GvimExt/gvimext.cpp	2011-07-20 17:27:17.000000000 +0200
--- src/GvimExt/gvimext.cpp	2011-08-10 16:25:32.000000000 +0200
***************
*** 142,147 ****
--- 142,148 ----
  static int dyn_libintl_init(char *dir);
  static void dyn_libintl_end(void);
  
+ static wchar_t *oldenv = NULL;
  static HINSTANCE hLibintlDLL = 0;
  static char *(*dyn_libintl_gettext)(const char *) = null_libintl_gettext;
  static char *(*dyn_libintl_textdomain)(const char *) = null_libintl_textdomain;
***************
*** 339,346 ****
  inc_cRefThisDLL()
  {
  #ifdef FEAT_GETTEXT
!     if (g_cRefThisDll == 0)
  	dyn_gettext_load();
  #endif
      InterlockedIncrement((LPLONG)&g_cRefThisDll);
  }
--- 340,349 ----
  inc_cRefThisDLL()
  {
  #ifdef FEAT_GETTEXT
!     if (g_cRefThisDll == 0) {
  	dyn_gettext_load();
+ 	oldenv = GetEnvironmentStringsW();
+     }
  #endif
      InterlockedIncrement((LPLONG)&g_cRefThisDll);
  }
***************
*** 349,356 ****
  dec_cRefThisDLL()
  {
  #ifdef FEAT_GETTEXT
!     if (InterlockedDecrement((LPLONG)&g_cRefThisDll) == 0)
  	dyn_gettext_free();
  #else
      InterlockedDecrement((LPLONG)&g_cRefThisDll);
  #endif
--- 352,364 ----
  dec_cRefThisDLL()
  {
  #ifdef FEAT_GETTEXT
!     if (InterlockedDecrement((LPLONG)&g_cRefThisDll) == 0) {
  	dyn_gettext_free();
+ 	if (oldenv != NULL) {
+ 	    FreeEnvironmentStringsW(oldenv);
+ 	    oldenv = NULL;
+ 	}
+     }
  #else
      InterlockedDecrement((LPLONG)&g_cRefThisDll);
  #endif
***************
*** 905,912 ****
  			NULL,		// Process handle not inheritable.
  			NULL,		// Thread handle not inheritable.
  			FALSE,		// Set handle inheritance to FALSE.
! 			0,		// No creation flags.
! 			NULL,		// Use parent's environment block.
  			NULL,		// Use parent's starting directory.
  			&si,		// Pointer to STARTUPINFO structure.
  			&pi)		// Pointer to PROCESS_INFORMATION structure.
--- 913,920 ----
  			NULL,		// Process handle not inheritable.
  			NULL,		// Thread handle not inheritable.
  			FALSE,		// Set handle inheritance to FALSE.
! 			oldenv == NULL ? 0 : CREATE_UNICODE_ENVIRONMENT,
! 			oldenv,		// Use unmodified environment block.
  			NULL,		// Use parent's starting directory.
  			&si,		// Pointer to STARTUPINFO structure.
  			&pi)		// Pointer to PROCESS_INFORMATION structure.
***************
*** 987,994 ****
  		NULL,		// Process handle not inheritable.
  		NULL,		// Thread handle not inheritable.
  		FALSE,		// Set handle inheritance to FALSE.
! 		0,		// No creation flags.
! 		NULL,		// Use parent's environment block.
  		NULL,		// Use parent's starting directory.
  		&si,		// Pointer to STARTUPINFO structure.
  		&pi)		// Pointer to PROCESS_INFORMATION structure.
--- 995,1002 ----
  		NULL,		// Process handle not inheritable.
  		NULL,		// Thread handle not inheritable.
  		FALSE,		// Set handle inheritance to FALSE.
! 		oldenv == NULL ? 0 : CREATE_UNICODE_ENVIRONMENT,
! 		oldenv,		// Use unmodified environment block.
  		NULL,		// Use parent's starting directory.
  		&si,		// Pointer to STARTUPINFO structure.
  		&pi)		// Pointer to PROCESS_INFORMATION structure.
*** ../vim-7.3.275/src/version.c	2011-08-10 15:56:24.000000000 +0200
--- src/version.c	2011-08-10 16:28:42.000000000 +0200
***************
*** 711,712 ****
--- 711,714 ----
  {   /* Add new patch number below this line */
+ /**/
+     276,
  /**/

-- 
User:       I'm having problems with my text editor.
Help desk:  Which editor are you using?
User:       I don't know, but it's version VI (pronounced: 6).
Help desk:  Oh, then you should upgrade to version VIM (pronounced: 994).

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///