aboutsummaryrefslogtreecommitdiffstats
path: root/common/win_main_utf8.h
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2017-08-30 18:04:04 -0700
committerChris Robinson <[email protected]>2017-08-30 18:04:04 -0700
commit0b0ae75ccf684f850f9112dbf17072b0c22da5f6 (patch)
treecc158a89591f4bd53a3e3fff440addf2ff43b2de /common/win_main_utf8.h
parent226efffd21d39948dc53bc4fb0bf81dfdeb085aa (diff)
I guess -1 isn't allowed for the output
Diffstat (limited to 'common/win_main_utf8.h')
-rw-r--r--common/win_main_utf8.h8
1 files changed, 4 insertions, 4 deletions
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);