3ef2ca
To: vim_dev@googlegroups.com
3ef2ca
Subject: Patch 7.4.123
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.123
3ef2ca
Problem:    Win32: Getting user name does not use wide function.
3ef2ca
Solution:   Use GetUserNameW() if possible. (Ken Takata)
3ef2ca
Files:	    src/os_win32.c
3ef2ca
3ef2ca
3ef2ca
*** ../vim-7.4.122/src/os_win32.c	2013-12-11 17:58:29.000000000 +0100
3ef2ca
--- src/os_win32.c	2013-12-11 18:14:29.000000000 +0100
3ef2ca
***************
3ef2ca
*** 2768,2773 ****
3ef2ca
--- 2768,2793 ----
3ef2ca
      char szUserName[256 + 1];	/* UNLEN is 256 */
3ef2ca
      DWORD cch = sizeof szUserName;
3ef2ca
  
3ef2ca
+ #ifdef FEAT_MBYTE
3ef2ca
+     if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
3ef2ca
+     {
3ef2ca
+ 	WCHAR wszUserName[256 + 1];	/* UNLEN is 256 */
3ef2ca
+ 	DWORD wcch = sizeof(wszUserName) / sizeof(WCHAR);
3ef2ca
+ 
3ef2ca
+ 	if (GetUserNameW(wszUserName, &wcch))
3ef2ca
+ 	{
3ef2ca
+ 	    char_u  *p = utf16_to_enc(wszUserName, NULL);
3ef2ca
+ 
3ef2ca
+ 	    if (p != NULL)
3ef2ca
+ 	    {
3ef2ca
+ 		vim_strncpy(s, p, len - 1);
3ef2ca
+ 		vim_free(p);
3ef2ca
+ 		return OK;
3ef2ca
+ 	    }
3ef2ca
+ 	}
3ef2ca
+ 	/* Retry with non-wide function (for Windows 98). */
3ef2ca
+     }
3ef2ca
+ #endif
3ef2ca
      if (GetUserName(szUserName, &cch))
3ef2ca
      {
3ef2ca
  	vim_strncpy(s, szUserName, len - 1);
3ef2ca
*** ../vim-7.4.122/src/version.c	2013-12-11 17:58:29.000000000 +0100
3ef2ca
--- src/version.c	2013-12-11 18:15:48.000000000 +0100
3ef2ca
***************
3ef2ca
*** 740,741 ****
3ef2ca
--- 740,743 ----
3ef2ca
  {   /* Add new patch number below this line */
3ef2ca
+ /**/
3ef2ca
+     123,
3ef2ca
  /**/
3ef2ca
3ef2ca
-- 
3ef2ca
Everybody lies, but it doesn't matter since nobody listens.
3ef2ca
                                -- Lieberman's Law
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    ///