Karsten Hopp c72a48
To: vim_dev@googlegroups.com
Karsten Hopp c72a48
Subject: Patch 7.4.432
Karsten Hopp c72a48
Fcc: outbox
Karsten Hopp c72a48
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp c72a48
Mime-Version: 1.0
Karsten Hopp c72a48
Content-Type: text/plain; charset=UTF-8
Karsten Hopp c72a48
Content-Transfer-Encoding: 8bit
Karsten Hopp c72a48
------------
Karsten Hopp c72a48
Karsten Hopp c72a48
Patch 7.4.432
Karsten Hopp c72a48
Problem:    When the startup code expands command line arguments, setting
Karsten Hopp c72a48
	    'encoding' will not properly convert the arguments.
Karsten Hopp c72a48
Solution:   Call get_cmd_argsW() early in main(). (Yasuhiro Matsumoto)
Karsten Hopp c72a48
Files:	    src/os_win32.c, src/main.c, src/os_mswin.c
Karsten Hopp c72a48
Karsten Hopp c72a48
Karsten Hopp c72a48
*** ../vim-7.4.431/src/os_win32.c	2014-08-29 17:45:28.066467800 +0200
Karsten Hopp c72a48
--- src/os_win32.c	2014-09-09 12:14:15.768500395 +0200
Karsten Hopp c72a48
***************
Karsten Hopp c72a48
*** 6461,6466 ****
Karsten Hopp c72a48
--- 6461,6467 ----
Karsten Hopp c72a48
      int		argc = 0;
Karsten Hopp c72a48
      int		i;
Karsten Hopp c72a48
  
Karsten Hopp c72a48
+     free_cmd_argsW();
Karsten Hopp c72a48
      ArglistW = CommandLineToArgvW(GetCommandLineW(), &nArgsW);
Karsten Hopp c72a48
      if (ArglistW != NULL)
Karsten Hopp c72a48
      {
Karsten Hopp c72a48
***************
Karsten Hopp c72a48
*** 6493,6499 ****
Karsten Hopp c72a48
--- 6494,6504 ----
Karsten Hopp c72a48
      global_argc = argc;
Karsten Hopp c72a48
      global_argv = argv;
Karsten Hopp c72a48
      if (argc > 0)
Karsten Hopp c72a48
+     {
Karsten Hopp c72a48
+ 	if (used_file_indexes != NULL)
Karsten Hopp c72a48
+ 	    free(used_file_indexes);
Karsten Hopp c72a48
  	used_file_indexes = malloc(argc * sizeof(int));
Karsten Hopp c72a48
+     }
Karsten Hopp c72a48
  
Karsten Hopp c72a48
      if (argvp != NULL)
Karsten Hopp c72a48
  	*argvp = argv;
Karsten Hopp c72a48
*** ../vim-7.4.431/src/main.c	2014-08-10 13:34:59.056785459 +0200
Karsten Hopp c72a48
--- src/main.c	2014-09-09 12:16:09.016500642 +0200
Karsten Hopp c72a48
***************
Karsten Hopp c72a48
*** 178,183 ****
Karsten Hopp c72a48
--- 178,191 ----
Karsten Hopp c72a48
       */
Karsten Hopp c72a48
      mch_early_init();
Karsten Hopp c72a48
  
Karsten Hopp c72a48
+ #if defined(WIN32) && defined(FEAT_MBYTE)
Karsten Hopp c72a48
+     /*
Karsten Hopp c72a48
+      * MingW expands command line arguments, which confuses our code to
Karsten Hopp c72a48
+      * convert when 'encoding' changes.  Get the unexpanded arguments.
Karsten Hopp c72a48
+      */
Karsten Hopp c72a48
+     argc = get_cmd_argsW(&argv);
Karsten Hopp c72a48
+ #endif
Karsten Hopp c72a48
+ 
Karsten Hopp c72a48
      /* Many variables are in "params" so that we can pass them to invoked
Karsten Hopp c72a48
       * functions without a lot of arguments.  "argc" and "argv" are also
Karsten Hopp c72a48
       * copied, so that they can be changed. */
Karsten Hopp c72a48
***************
Karsten Hopp c72a48
*** 1496,1501 ****
Karsten Hopp c72a48
--- 1504,1512 ----
Karsten Hopp c72a48
      if (garbage_collect_at_exit)
Karsten Hopp c72a48
  	garbage_collect();
Karsten Hopp c72a48
  #endif
Karsten Hopp c72a48
+ #if defined(WIN32) && defined(FEAT_MBYTE)
Karsten Hopp c72a48
+     free_cmd_argsW();
Karsten Hopp c72a48
+ #endif
Karsten Hopp c72a48
  
Karsten Hopp c72a48
      mch_exit(exitval);
Karsten Hopp c72a48
  }
Karsten Hopp c72a48
*** ../vim-7.4.431/src/os_mswin.c	2014-03-19 12:37:18.537826062 +0100
Karsten Hopp c72a48
--- src/os_mswin.c	2014-09-09 12:17:25.696500810 +0200
Karsten Hopp c72a48
***************
Karsten Hopp c72a48
*** 277,286 ****
Karsten Hopp c72a48
      AnsiUpperBuff(toupper_tab, 256);
Karsten Hopp c72a48
      AnsiLowerBuff(tolower_tab, 256);
Karsten Hopp c72a48
  #endif
Karsten Hopp c72a48
- 
Karsten Hopp c72a48
- #if defined(FEAT_MBYTE) && !defined(FEAT_GUI)
Karsten Hopp c72a48
-     (void)get_cmd_argsW(NULL);
Karsten Hopp c72a48
- #endif
Karsten Hopp c72a48
  }
Karsten Hopp c72a48
  
Karsten Hopp c72a48
  
Karsten Hopp c72a48
--- 277,282 ----
Karsten Hopp c72a48
*** ../vim-7.4.431/src/version.c	2014-09-09 12:21:57.716501404 +0200
Karsten Hopp c72a48
--- src/version.c	2014-09-09 12:24:38.440501755 +0200
Karsten Hopp c72a48
***************
Karsten Hopp c72a48
*** 743,744 ****
Karsten Hopp c72a48
--- 743,746 ----
Karsten Hopp c72a48
  {   /* Add new patch number below this line */
Karsten Hopp c72a48
+ /**/
Karsten Hopp c72a48
+     432,
Karsten Hopp c72a48
  /**/
Karsten Hopp c72a48
Karsten Hopp c72a48
-- 
Karsten Hopp c72a48
hundred-and-one symptoms of being an internet addict:
Karsten Hopp c72a48
106. When told to "go to your room" you inform your parents that you
Karsten Hopp c72a48
     can't...because you were kicked out and banned.
Karsten Hopp c72a48
Karsten Hopp c72a48
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp c72a48
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp c72a48
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp c72a48
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///