aboutsummaryrefslogtreecommitdiffstats
path: root/ui/qt/main.cpp
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2018-10-07 19:04:50 -0700
committerGuy Harris <guy@alum.mit.edu>2018-10-08 03:05:45 +0000
commitbce13644e9d528a153f87019738a1582c9cae606 (patch)
tree4b662ab2fd3274da65c1fdc09a8995a436af798b /ui/qt/main.cpp
parent9388bd0436550e456fb0d9957a8328f1124c4800 (diff)
Bring back arg_list_utf_16to8(), but have it just do UTF-16-to-UTF-8 mapping.
Call it from wmain() in the command-line tools, passing it the input argument count and vector, and call it from main() in Wireshark, after getting a UTF-16 argument vector from passing the result of GetCommandLineW() to CommandLineToArgvW(). Change-Id: I0e51703c0a6c92f7892d196e700ab437bd702514 Reviewed-on: https://code.wireshark.org/review/30063 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'ui/qt/main.cpp')
-rw-r--r--ui/qt/main.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/ui/qt/main.cpp b/ui/qt/main.cpp
index fbd367085a..351f71985e 100644
--- a/ui/qt/main.cpp
+++ b/ui/qt/main.cpp
@@ -357,7 +357,6 @@ int main(int argc, char *qt_argv[])
MainWindow *main_w;
#ifdef _WIN32
- int opt;
LPWSTR *wc_argv;
int wc_argc;
#endif
@@ -420,13 +419,11 @@ int main(int argc, char *qt_argv[])
// strings into UTF-8.
//
wc_argv = CommandLineToArgvW(GetCommandLineW(), &wc_argc);
- if (wc_argv && wc_argc == argc) {
- argv = (char **) g_malloc(sizeof(char *) * argc);
- for (opt = 0; opt < argc; opt++) {
- argv[opt] = g_utf16_to_utf8((const gunichar2 *)wc_argv[opt], -1, NULL, NULL, NULL);
- }
+ if (wc_argv) {
+ argc = wc_argc;
+ argv = arg_list_utf_16to8(wc_argc, wc_argv);
+ LocalFree(wc_argv);
} /* XXX else bail because something is horribly, horribly wrong? */
- LocalFree(wc_argv);
create_app_running_mutex();
#endif /* _WIN32 */