diff options
author | Robert Griebl <robert.griebl@qt.io> | 2021-07-02 13:49:29 +0200 |
---|---|---|
committer | Robert Griebl <robert.griebl@qt.io> | 2021-07-02 16:58:39 +0200 |
commit | 089ccc1e0ad3eb532462f0d1fb895ab355fa0ec2 (patch) | |
tree | bcb86df5c2eeb1828e3a5d45dd5580c286d06ee5 | |
parent | 6feb9f7f2a4dabc96a0a5c18c6cf599e1b9a1b02 (diff) | |
download | qtapplicationmanager-089ccc1e0ad3eb532462f0d1fb895ab355fa0ec2.tar.gz |
Replace strdup with qstrdup to avoid warnings on Windows
Change-Id: I995212ea852ebc3d34b6c8ee8c7df94bb49367a9
Reviewed-by: Dominik Holland <dominik.holland@qt.io>
-rw-r--r-- | src/tools/testrunner/testrunner.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/tools/testrunner/testrunner.cpp b/src/tools/testrunner/testrunner.cpp index 4a03bc24..e6988ffe 100644 --- a/src/tools/testrunner/testrunner.cpp +++ b/src/tools/testrunner/testrunner.cpp @@ -66,18 +66,20 @@ void TestRunner::initialize(const QString &testFile, const QStringList &testRunn Q_ASSERT(!testRunnerArguments.isEmpty()); const QString name = QFileInfo(testRunnerArguments.at(0)).fileName() + qSL("::") + QDir().relativeFilePath(testFile); - static const char *programName = strdup(name.toLocal8Bit().constData()); + static const char *programName = qstrdup(name.toLocal8Bit().constData()); QuickTestResult::setProgramName(programName); // Convert all the arguments back into a char * array. // These need to be alive as long as the program is running! static QVector<char *> testArgV; for (const auto &arg : testRunnerArguments) - testArgV << strdup(arg.toLocal8Bit().constData()); + testArgV << qstrdup(arg.toLocal8Bit().constData()); atexit([]() { - free(const_cast<char*>(programName)); - std::for_each(testArgV.constBegin(), testArgV.constEnd(), free); + delete [] programName; + std::for_each(testArgV.constBegin(), testArgV.constEnd(), [](char *arg) { + delete [] arg; + }); }); QuickTestResult::setCurrentAppname(testArgV.constFirst()); |