diff --git a/src/corelib/CMakeLists.txt b/src/corelib/CMakeLists.txt index 7385b0f27e6..cb466d389b8 100644 --- a/src/corelib/CMakeLists.txt +++ b/src/corelib/CMakeLists.txt @@ -157,7 +157,6 @@ qt_internal_add_module(Core kernel/qchronotimer.cpp kernel/qchronotimer.h kernel/qcoreapplication.cpp kernel/qcoreapplication.h kernel/qcoreapplication_p.h kernel/qcoreapplication_platform.h - kernel/qcorecmdlineargs_p.h kernel/qcoreevent.cpp kernel/qcoreevent.h kernel/qcoreevent_p.h kernel/qdeadlinetimer.cpp kernel/qdeadlinetimer.h kernel/qelapsedtimer.cpp kernel/qelapsedtimer.h diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index e804e738854..cdc4b47db90 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -13,7 +13,6 @@ #endif #include "qmetaobject.h" #include -#include "qcorecmdlineargs_p.h" #include #include #include @@ -110,6 +109,10 @@ #include #include +#ifdef Q_OS_WIN +# include +#endif + QT_BEGIN_NAMESPACE #ifndef QT_NO_QOBJECT @@ -2536,6 +2539,22 @@ qint64 QCoreApplication::applicationPid() #endif } +#ifdef Q_OS_WIN +static inline QStringList winCmdArgs(const QString &cmdLine) +{ + QStringList result; + int size; + if (wchar_t **argv = CommandLineToArgvW(reinterpret_cast(cmdLine.utf16()), &size)) { + result.reserve(size); + wchar_t **argvEnd = argv + size; + for (wchar_t **a = argv; a < argvEnd; ++a) + result.append(QString::fromWCharArray(*a)); + LocalFree(argv); + } + return result; +} +#endif // Q_OS_WIN + /*! \since 4.1 @@ -2591,7 +2610,7 @@ QStringList QCoreApplication::arguments() // the Windows API instead of using argv. Note that we only // do this when argv were not modified by the user in main(). QString cmdline = QString::fromWCharArray(GetCommandLine()); - QStringList commandLineArguments = qWinCmdArgs(cmdline); + QStringList commandLineArguments = winCmdArgs(cmdline); // Even if the user didn't modify argv before passing them // on to QCoreApplication, derived QApplications might have. diff --git a/src/corelib/kernel/qcorecmdlineargs_p.h b/src/corelib/kernel/qcorecmdlineargs_p.h deleted file mode 100644 index 2b8d9763f61..00000000000 --- a/src/corelib/kernel/qcorecmdlineargs_p.h +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only - -#ifndef QCORECMDLINEARGS_P_H -#define QCORECMDLINEARGS_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include -#include "QtCore/qstring.h" -#include "QtCore/qstringlist.h" - -#if defined(Q_OS_WIN) -# ifdef Q_OS_WIN32 -# include // first to suppress min, max macros. -# include -# else -# include -# endif - -QT_BEGIN_NAMESPACE - -#if defined(Q_OS_WIN32) - -static inline QStringList qWinCmdArgs(const QString &cmdLine) -{ - QStringList result; - int size; - if (wchar_t **argv = CommandLineToArgvW((const wchar_t *)cmdLine.utf16(), &size)) { - result.reserve(size); - wchar_t **argvEnd = argv + size; - for (wchar_t **a = argv; a < argvEnd; ++a) - result.append(QString::fromWCharArray(*a)); - LocalFree(argv); - } - return result; -} - -#endif // Q_OS_WIN32 - -QT_END_NAMESPACE - -#endif // Q_OS_WIN - -#endif // QCORECMDLINEARGS_WIN_P_H