From 0b0ae75ccf684f850f9112dbf17072b0c22da5f6 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Wed, 30 Aug 2017 18:04:04 -0700 Subject: I guess -1 isn't allowed for the output --- common/win_main_utf8.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'common') diff --git a/common/win_main_utf8.h b/common/win_main_utf8.h index a95914bb..821312d7 100644 --- a/common/win_main_utf8.h +++ b/common/win_main_utf8.h @@ -31,8 +31,8 @@ static FILE *my_fopen(const char *fname, const char *mode) wname = calloc(sizeof(WCHAR), namelen+modelen); wmode = wname + namelen; - MultiByteToWideChar(CP_UTF8, 0, fname, -1, wname, -1); - MultiByteToWideChar(CP_UTF8, 0, mode, -1, wmode, -1); + MultiByteToWideChar(CP_UTF8, 0, fname, -1, wname, namelen); + MultiByteToWideChar(CP_UTF8, 0, mode, -1, wmode, modelen); file = _wfopen(wname, wmode); @@ -71,10 +71,10 @@ static void GetUnicodeArgs(int *argc, char ***argv) (*argv)[0] = (char*)(*argv + nargs); for(i = 0;i < nargs-1;i++) { - int len = WideCharToMultiByte(CP_UTF8, 0, args[i], -1, (*argv)[i], -1, NULL, NULL); + int len = WideCharToMultiByte(CP_UTF8, 0, args[i], -1, (*argv)[i], 65535, NULL, NULL); (*argv)[i+1] = (*argv)[i] + len; } - WideCharToMultiByte(CP_UTF8, 0, args[i], -1, (*argv)[i], -1, NULL, NULL); + WideCharToMultiByte(CP_UTF8, 0, args[i], -1, (*argv)[i], 65535, NULL, NULL); *argc = nargs; LocalFree(args); -- cgit v1.2.3