summaryrefslogtreecommitdiffstats
path: root/src/winmain
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2019-02-08 09:28:00 +0100
committerEdward Welbourne <edward.welbourne@qt.io>2019-02-08 12:31:02 +0100
commitfbfacd33be482fa3cf0aa5cffaf7006d538a2f92 (patch)
tree92da72786b3740e37004623612c4fc1c9640d30f /src/winmain
parentc1f4286a5cbc1794fe7be5bdbbd6a0bf29ef84d4 (diff)
parent74e04d6ace7aa949db97ae2e46c38a4dc0d4d36a (diff)
Merge remote-tracking branch 'origin/5.12' into 5.13
Conflicts: src/android/templates/AndroidManifest.xml src/network/ssl/qsslsocket_mac.cpp src/widgets/styles/qstylesheetstyle.cpp tests/auto/corelib/kernel/qtimer/BLACKLIST tests/auto/testlib/selftests/blacklisted/tst_blacklisted.cpp tests/auto/testlib/selftests/expected_blacklisted.lightxml tests/auto/testlib/selftests/expected_blacklisted.tap tests/auto/testlib/selftests/expected_blacklisted.teamcity tests/auto/testlib/selftests/expected_blacklisted.txt tests/auto/testlib/selftests/expected_blacklisted.xml tests/auto/testlib/selftests/expected_blacklisted.xunitxml tests/auto/testlib/selftests/expected_float.tap tests/auto/testlib/selftests/expected_float.teamcity tests/auto/testlib/selftests/expected_float.txt tests/auto/testlib/selftests/expected_float.xunitxml Done-With: Christian Ehrlicher <ch.ehrlicher@gmx.de> Done-With: Edward Welbourne <edward.welbourne@qt.io> Done-With: Timur Pocheptsov <timur.pocheptsov@qt.io> Change-Id: If93cc432a56ae3ac1b6533d0028e4dc497415a52
Diffstat (limited to 'src/winmain')
-rw-r--r--src/winmain/qtmain_win.cpp27
-rw-r--r--src/winmain/winmain.pro2
2 files changed, 11 insertions, 18 deletions
diff --git a/src/winmain/qtmain_win.cpp b/src/winmain/qtmain_win.cpp
index 3dc1ac0fba..5520a447a9 100644
--- a/src/winmain/qtmain_win.cpp
+++ b/src/winmain/qtmain_win.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Windows main function of the Qt Toolkit.
@@ -48,12 +48,8 @@
**
****************************************************************************/
-#include "qt_windows.h"
-#include "qbytearray.h"
-#include "qstring.h"
-#include "qvector.h"
-
-#include <shlobj.h>
+#include <windows.h>
+#include <shellapi.h>
/*
This file contains the code in the qtmain library for Windows.
@@ -64,9 +60,6 @@
invoked.
*/
-QT_USE_NAMESPACE
-
-
#if defined(QT_NEEDS_QMAIN)
int qMain(int, char **);
#define main qMain
@@ -82,27 +75,27 @@ extern "C" int main(int, char **);
// Convert a wchar_t to char string, equivalent to QString::toLocal8Bit()
// when passed CP_ACP.
-static inline char *wideToMulti(int codePage, const wchar_t *aw)
+static inline char *wideToMulti(unsigned int codePage, const wchar_t *aw)
{
- const int required = WideCharToMultiByte(codePage, 0, aw, -1, NULL, 0, NULL, NULL);
+ const int required = WideCharToMultiByte(codePage, 0, aw, -1, nullptr, 0, nullptr, nullptr);
char *result = new char[required];
- WideCharToMultiByte(codePage, 0, aw, -1, result, required, NULL, NULL);
+ WideCharToMultiByte(codePage, 0, aw, -1, result, required, nullptr, nullptr);
return result;
}
extern "C" int APIENTRY WinMain(HINSTANCE, HINSTANCE, LPSTR /*cmdParamarg*/, int /* cmdShow */)
{
- int argc;
+ int argc = 0;
wchar_t **argvW = CommandLineToArgvW(GetCommandLineW(), &argc);
- if (!argvW)
+ if (argvW == nullptr)
return -1;
char **argv = new char *[argc + 1];
- for (int i = 0; i < argc; ++i)
+ for (int i = 0; i != argc; ++i)
argv[i] = wideToMulti(CP_ACP, argvW[i]);
argv[argc] = nullptr;
LocalFree(argvW);
const int exitCode = main(argc, argv);
- for (int i = 0; i < argc && argv[i]; ++i)
+ for (int i = 0; (i != argc) && (argv[i] != nullptr); ++i)
delete [] argv[i];
delete [] argv;
return exitCode;
diff --git a/src/winmain/winmain.pro b/src/winmain/winmain.pro
index 61e9f29d23..9cb6ab0c59 100644
--- a/src/winmain/winmain.pro
+++ b/src/winmain/winmain.pro
@@ -21,8 +21,8 @@ mingw: DEFINES += QT_NEEDS_QMAIN
winrt {
SOURCES = qtmain_winrt.cpp
} else {
+ CONFIG -= qt
SOURCES = qtmain_win.cpp
-
LIBS += -lshell32
}