From 5da6d72bbe5e19e67dda7a862bb63255b8c6a13c Mon Sep 17 00:00:00 2001 From: jon_y Date: Sun, 29 Dec 2024 11:10:44 +0000 Subject: [PATCH 1/2] Newer runtime __wgetmainargs may return errors as per https://sourceforge.net/p/mpg123/bugs/375/ git-svn-id: svn://scm.orgis.org/mpg123/trunk@5469 35dc7657-300d-0410-a2e5-dc2837fedb53 --- src/win32_support.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/win32_support.c b/src/win32_support.c index c8d148e1..58b9efe2 100755 --- a/src/win32_support.c +++ b/src/win32_support.c @@ -31,7 +31,10 @@ int win32_cmdline_utf8(int * argc, char *** argv) if(argv == NULL || argc == NULL) return -1; startup.newmode = 0; - __wgetmainargs(argc, &argv_wide,&env,1, &startup); + if (__wgetmainargs(argc, &argv_wide, &env, 1, &startup) != 0) { + error("Cannot allocate memory for command line."); + return -1; + } *argv = (char **)calloc(sizeof (char *), *argc); if(*argv == NULL){ error("Cannot allocate memory for command line."); return -1; } From 936c178e225c37e41e4d50517139fb6eeab04879 Mon Sep 17 00:00:00 2001 From: jon_y Date: Sun, 29 Dec 2024 11:16:50 +0000 Subject: [PATCH 2/2] correct __wgetmainargs prototype git-svn-id: svn://scm.orgis.org/mpg123/trunk@5470 35dc7657-300d-0410-a2e5-dc2837fedb53 --- src/win32_support.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/win32_support.c b/src/win32_support.c index 58b9efe2..9e402cc5 100755 --- a/src/win32_support.c +++ b/src/win32_support.c @@ -11,7 +11,7 @@ typedef struct } _startupinfo; /* XP and later has an int return though */ -void __cdecl __declspec(dllimport) __wgetmainargs ( +int __cdecl __declspec(dllimport) __wgetmainargs ( int *_Argc, wchar_t ***_Argv, wchar_t ***_Env,