updated for version 7.0052
diff --git a/src/os_mswin.c b/src/os_mswin.c
index 5d45d7b..4f3a49b 100644
--- a/src/os_mswin.c
+++ b/src/os_mswin.c
@@ -1346,22 +1346,16 @@
break;
}
-#if defined(FEAT_MBYTE) && defined(WIN3264)
+# if defined(FEAT_MBYTE) && defined(WIN3264)
/* The text is in the active codepage. Convert to 'encoding',
* going through UCS-2. */
- MultiByteToWideChar_alloc(GetACP(), 0, str, str_size,
- (LPWSTR *)&to_free, &maxlen);
+ acp_to_enc(str, str_size, &to_free, &maxlen);
if (to_free != NULL)
{
str_size = maxlen;
- str = ucs2_to_enc((short_u *)to_free, &str_size);
- if (str != NULL)
- {
- vim_free(to_free);
- to_free = str;
- }
+ str = to_free;
}
-#endif
+# endif
}
}
#ifdef FEAT_MBYTE
@@ -1398,6 +1392,31 @@
#endif
}
+#if (defined(FEAT_MBYTE) && defined(WIN3264)) || defined(PROTO)
+/*
+ * Convert from the active codepage to 'encoding'.
+ * Input is "str[str_size]".
+ * The result is in allocated memory: "out[outlen]". With terminating NUL.
+ */
+ void
+acp_to_enc(str, str_size, out, outlen)
+ char_u *str;
+ int str_size;
+ char_u **out;
+ int *outlen;
+
+{
+ LPWSTR widestr;
+
+ MultiByteToWideChar_alloc(GetACP(), 0, str, str_size, &widestr, outlen);
+ if (widestr != NULL)
+ {
+ *out = ucs2_to_enc((short_u *)widestr, outlen);
+ vim_free(widestr);
+ }
+}
+#endif
+
/*
* Send the current selection to the clipboard.
*/