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