summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main.c11
-rw-r--r--src/os_mswin.c4
-rw-r--r--src/os_win32.c5
-rw-r--r--src/version.c2
4 files changed, 18 insertions, 4 deletions
diff --git a/src/main.c b/src/main.c
index 2fb2edcb5..70d291171 100644
--- a/src/main.c
+++ b/src/main.c
@@ -178,6 +178,14 @@ main
*/
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
* functions without a lot of arguments. "argc" and "argv" are also
* copied, so that they can be changed. */
@@ -1496,6 +1504,9 @@ getout(exitval)
if (garbage_collect_at_exit)
garbage_collect();
#endif
+#if defined(WIN32) && defined(FEAT_MBYTE)
+ free_cmd_argsW();
+#endif
mch_exit(exitval);
}
diff --git a/src/os_mswin.c b/src/os_mswin.c
index 871afad9d..b5786800e 100644
--- a/src/os_mswin.c
+++ b/src/os_mswin.c
@@ -277,10 +277,6 @@ mch_early_init(void)
AnsiUpperBuff(toupper_tab, 256);
AnsiLowerBuff(tolower_tab, 256);
#endif
-
-#if defined(FEAT_MBYTE) && !defined(FEAT_GUI)
- (void)get_cmd_argsW(NULL);
-#endif
}
diff --git a/src/os_win32.c b/src/os_win32.c
index dd5714158..7192c51a0 100644
--- a/src/os_win32.c
+++ b/src/os_win32.c
@@ -6461,6 +6461,7 @@ get_cmd_argsW(char ***argvp)
int argc = 0;
int i;
+ free_cmd_argsW();
ArglistW = CommandLineToArgvW(GetCommandLineW(), &nArgsW);
if (ArglistW != NULL)
{
@@ -6493,7 +6494,11 @@ get_cmd_argsW(char ***argvp)
global_argc = argc;
global_argv = argv;
if (argc > 0)
+ {
+ if (used_file_indexes != NULL)
+ free(used_file_indexes);
used_file_indexes = malloc(argc * sizeof(int));
+ }
if (argvp != NULL)
*argvp = argv;
diff --git a/src/version.c b/src/version.c
index 838c1d607..18ea863d8 100644
--- a/src/version.c
+++ b/src/version.c
@@ -742,6 +742,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 432,
+/**/
431,
/**/
430,