diff options
author | Alon Bar-Lev <alon.barlev@gmail.com> | 2012-03-24 22:31:10 +0200 |
---|---|---|
committer | David Sommerseth <davids@redhat.com> | 2012-06-29 10:07:23 +0200 |
commit | 74370aa89df9285a95084616e9c2d3c8464760b9 (patch) | |
tree | a0f62d0a847e9163c9f7e08a8d89effc62ed9840 /src/openvpn/options.c | |
parent | 5a57e201223f7265af0a56859b00a594b0d98f5b (diff) | |
download | openvpn-74370aa89df9285a95084616e9c2d3c8464760b9.tar.gz openvpn-74370aa89df9285a95084616e9c2d3c8464760b9.tar.xz openvpn-74370aa89df9285a95084616e9c2d3c8464760b9.zip |
cleanup: windows: convert argv (UCS-2 to UTF-8) at earliest
Discussed at [1].
Use wmain under windows, drop the custom parsing and shell32 linkage.
There is no need for gc magic as this allocation is static.
[1] http://permalink.gmane.org/gmane.network.openvpn.devel/5433
Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
Message-Id: 1332621070-28464-1-git-send-email-alon.barlev@gmail.com
URL: http://article.gmane.org/gmane.network.openvpn.devel/6063
Tested-by: Samuli Seppänen <samuli@openvpn.net>
Signed-off-by: David Sommerseth <davids@redhat.com>
Diffstat (limited to 'src/openvpn/options.c')
-rw-r--r-- | src/openvpn/options.c | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/src/openvpn/options.c b/src/openvpn/options.c index 367c1bc..bccdf0c 100644 --- a/src/openvpn/options.c +++ b/src/openvpn/options.c @@ -3866,33 +3866,6 @@ parse_argv (struct options *options, { int i, j; -#ifdef WIN32 - /* - * Windows replaces Unicode characters in argv[] that are not present - * in the current codepage with '?'. Get the wide char command line and - * convert it to UTF-8 ourselves. - */ - int wargc; - WCHAR **wargv; - char **uargv; - - wargv = CommandLineToArgvW (GetCommandLineW (), &wargc); - if (wargv == NULL || wargc != argc) - usage (); - - uargv = gc_malloc (wargc * sizeof (*uargv), false, &options->gc); - - for (i = 0; i < wargc; i++) - { - int n = WideCharToMultiByte (CP_UTF8, 0, wargv[i], -1, NULL, 0, NULL, NULL); - uargv[i] = gc_malloc (n, false, &options->gc); - WideCharToMultiByte (CP_UTF8, 0, wargv[i], -1, uargv[i], n, NULL, NULL); - } - - LocalFree (wargv); - argv = uargv; -#endif - /* usage message */ if (argc <= 1) usage (); |