Blame SOURCES/7.4.471

22c937
To: vim_dev@googlegroups.com
22c937
Subject: Patch 7.4.471
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.471
22c937
Problem:    MS-Windows: When printer name contains multi-byte, the name is
22c937
	    displayed as ???.
22c937
Solution:   Convert the printer name from the active codepage to 'encoding'.
22c937
	    (Yasuhiro Matsumoto)
22c937
Files:	    src/os_mswin.c
22c937
22c937
22c937
*** ../vim-7.4.470/src/os_mswin.c	2014-09-27 11:18:08.179520979 +0200
22c937
--- src/os_mswin.c	2014-10-09 17:03:20.500915911 +0200
22c937
***************
22c937
*** 1635,1645 ****
22c937
--- 1635,1667 ----
22c937
  	char_u	*printer_name = (char_u *)devname + devname->wDeviceOffset;
22c937
  	char_u	*port_name = (char_u *)devname +devname->wOutputOffset;
22c937
  	char_u	*text = _("to %s on %s");
22c937
+ #ifdef FEAT_MBYTE
22c937
+ 	char_u  *printer_name_orig = printer_name;
22c937
+ 	char_u	*port_name_orig = port_name;
22c937
  
22c937
+ 	if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
22c937
+ 	{
22c937
+ 	    char_u  *to_free = NULL;
22c937
+ 	    int     maxlen;
22c937
+ 
22c937
+ 	    acp_to_enc(printer_name, STRLEN(printer_name), &to_free, &maxlen);
22c937
+ 	    if (to_free != NULL)
22c937
+ 		printer_name = to_free;
22c937
+ 	    acp_to_enc(port_name, STRLEN(port_name), &to_free, &maxlen);
22c937
+ 	    if (to_free != NULL)
22c937
+ 		port_name = to_free;
22c937
+ 	}
22c937
+ #endif
22c937
  	prt_name = alloc((unsigned)(STRLEN(printer_name) + STRLEN(port_name)
22c937
  							     + STRLEN(text)));
22c937
  	if (prt_name != NULL)
22c937
  	    wsprintf(prt_name, text, printer_name, port_name);
22c937
+ #ifdef FEAT_MBYTE
22c937
+ 	if (printer_name != printer_name_orig)
22c937
+ 	    vim_free(printer_name);
22c937
+ 	if (port_name != port_name_orig)
22c937
+ 	    vim_free(port_name);
22c937
+ #endif
22c937
      }
22c937
      GlobalUnlock(prt_dlg.hDevNames);
22c937
  
22c937
*** ../vim-7.4.470/src/version.c	2014-10-09 15:37:02.492904600 +0200
22c937
--- src/version.c	2014-10-09 17:00:58.632915601 +0200
22c937
***************
22c937
*** 743,744 ****
22c937
--- 743,746 ----
22c937
  {   /* Add new patch number below this line */
22c937
+ /**/
22c937
+     471,
22c937
  /**/
22c937
22c937
-- 
22c937
"Marriage is the process of finding out what kind of man your wife
22c937
would have preferred"
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    ///