Blame SOURCES/7.4.123

22c937
To: vim_dev@googlegroups.com
22c937
Subject: Patch 7.4.123
22c937
Fcc: outbox
22c937
From: Bram Moolenaar <Bram@moolenaar.net>
22c937
Mime-Version: 1.0
22c937
Content-Type: text/plain; charset=UTF-8
22c937
Content-Transfer-Encoding: 8bit
22c937
------------
22c937
22c937
Patch 7.4.123
22c937
Problem:    Win32: Getting user name does not use wide function.
22c937
Solution:   Use GetUserNameW() if possible. (Ken Takata)
22c937
Files:	    src/os_win32.c
22c937
22c937
22c937
*** ../vim-7.4.122/src/os_win32.c	2013-12-11 17:58:29.000000000 +0100
22c937
--- src/os_win32.c	2013-12-11 18:14:29.000000000 +0100
22c937
***************
22c937
*** 2768,2773 ****
22c937
--- 2768,2793 ----
22c937
      char szUserName[256 + 1];	/* UNLEN is 256 */
22c937
      DWORD cch = sizeof szUserName;
22c937
  
22c937
+ #ifdef FEAT_MBYTE
22c937
+     if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
22c937
+     {
22c937
+ 	WCHAR wszUserName[256 + 1];	/* UNLEN is 256 */
22c937
+ 	DWORD wcch = sizeof(wszUserName) / sizeof(WCHAR);
22c937
+ 
22c937
+ 	if (GetUserNameW(wszUserName, &wcch))
22c937
+ 	{
22c937
+ 	    char_u  *p = utf16_to_enc(wszUserName, NULL);
22c937
+ 
22c937
+ 	    if (p != NULL)
22c937
+ 	    {
22c937
+ 		vim_strncpy(s, p, len - 1);
22c937
+ 		vim_free(p);
22c937
+ 		return OK;
22c937
+ 	    }
22c937
+ 	}
22c937
+ 	/* Retry with non-wide function (for Windows 98). */
22c937
+     }
22c937
+ #endif
22c937
      if (GetUserName(szUserName, &cch))
22c937
      {
22c937
  	vim_strncpy(s, szUserName, len - 1);
22c937
*** ../vim-7.4.122/src/version.c	2013-12-11 17:58:29.000000000 +0100
22c937
--- src/version.c	2013-12-11 18:15:48.000000000 +0100
22c937
***************
22c937
*** 740,741 ****
22c937
--- 740,743 ----
22c937
  {   /* Add new patch number below this line */
22c937
+ /**/
22c937
+     123,
22c937
  /**/
22c937
22c937
-- 
22c937
Everybody lies, but it doesn't matter since nobody listens.
22c937
                                -- Lieberman's Law
22c937
22c937
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
22c937
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
22c937
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
22c937
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///