0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

updated for version 7.4.432

Problem:    When the startup code expands command line arguments, setting
            'encoding' will not properly convert the arguments.
Solution:   Call get_cmd_argsW() early in main(). (Yasuhiro Matsumoto)
This commit is contained in:
Bram Moolenaar
2014-09-09 12:25:33 +02:00
parent 120f4a878f
commit 14993322b1
4 changed files with 18 additions and 4 deletions

View File

@@ -178,6 +178,14 @@ main
*/ */
mch_early_init(); mch_early_init();
#if defined(WIN32) && defined(FEAT_MBYTE)
/*
* MingW expands command line arguments, which confuses our code to
* convert when 'encoding' changes. Get the unexpanded arguments.
*/
argc = get_cmd_argsW(&argv);
#endif
/* Many variables are in "params" so that we can pass them to invoked /* Many variables are in "params" so that we can pass them to invoked
* functions without a lot of arguments. "argc" and "argv" are also * functions without a lot of arguments. "argc" and "argv" are also
* copied, so that they can be changed. */ * copied, so that they can be changed. */
@@ -1496,6 +1504,9 @@ getout(exitval)
if (garbage_collect_at_exit) if (garbage_collect_at_exit)
garbage_collect(); garbage_collect();
#endif #endif
#if defined(WIN32) && defined(FEAT_MBYTE)
free_cmd_argsW();
#endif
mch_exit(exitval); mch_exit(exitval);
} }

View File

@@ -277,10 +277,6 @@ mch_early_init(void)
AnsiUpperBuff(toupper_tab, 256); AnsiUpperBuff(toupper_tab, 256);
AnsiLowerBuff(tolower_tab, 256); AnsiLowerBuff(tolower_tab, 256);
#endif #endif
#if defined(FEAT_MBYTE) && !defined(FEAT_GUI)
(void)get_cmd_argsW(NULL);
#endif
} }

View File

@@ -6461,6 +6461,7 @@ get_cmd_argsW(char ***argvp)
int argc = 0; int argc = 0;
int i; int i;
free_cmd_argsW();
ArglistW = CommandLineToArgvW(GetCommandLineW(), &nArgsW); ArglistW = CommandLineToArgvW(GetCommandLineW(), &nArgsW);
if (ArglistW != NULL) if (ArglistW != NULL)
{ {
@@ -6493,7 +6494,11 @@ get_cmd_argsW(char ***argvp)
global_argc = argc; global_argc = argc;
global_argv = argv; global_argv = argv;
if (argc > 0) if (argc > 0)
{
if (used_file_indexes != NULL)
free(used_file_indexes);
used_file_indexes = malloc(argc * sizeof(int)); used_file_indexes = malloc(argc * sizeof(int));
}
if (argvp != NULL) if (argvp != NULL)
*argvp = argv; *argvp = argv;

View File

@@ -741,6 +741,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
432,
/**/ /**/
431, 431,
/**/ /**/