mirror of
https://github.com/neovim/neovim.git
synced 2024-12-24 13:15:09 -07:00
Merge #7205 from justinmk/win-wmain
This commit is contained in:
commit
0f2873ce99
@ -220,24 +220,18 @@ void early_init(void)
|
|||||||
|
|
||||||
#ifdef MAKE_LIB
|
#ifdef MAKE_LIB
|
||||||
int nvim_main(int argc, char **argv)
|
int nvim_main(int argc, char **argv)
|
||||||
#elif defined WIN32
|
#elif defined(WIN32)
|
||||||
// don't use codepage encoded arguments. see #7060
|
int wmain(int argc, wchar_t **argv_w) // multibyte args on Windows. #7060
|
||||||
int wmain(int argc, wchar_t **argv_w)
|
|
||||||
#else
|
#else
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#if defined(WIN32) && !defined(MAKE_LIB)
|
||||||
char *argv[argc];
|
char *argv[argc];
|
||||||
|
for (int i = 0; i < argc; i++) {
|
||||||
for (size_t i = 0; i < (size_t)argc; i++) {
|
char *buf = NULL;
|
||||||
// get required buffer size
|
utf16_to_utf8(argv_w[i], &buf);
|
||||||
size_t dest_size = (size_t)WideCharToMultiByte(
|
assert(buf);
|
||||||
CP_UTF8, 0, argv_w[i], -1, NULL, 0, NULL, NULL);
|
|
||||||
char *buf = (char *)xmallocz(dest_size);
|
|
||||||
// convert from utf16 (widechar) utf8 (multibyte)
|
|
||||||
WideCharToMultiByte(CP_UTF8, 0, argv_w[i], -1, buf, (int)dest_size,
|
|
||||||
NULL, NULL);
|
|
||||||
argv[i] = buf;
|
argv[i] = buf;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user