diff options
author | Timothée Keller <timothee.keller@qt.io> | 2023-03-21 14:40:59 +0100 |
---|---|---|
committer | Timothée Keller <timothee.keller@qt.io> | 2023-04-06 17:51:36 +0200 |
commit | a516a368c2aa7ea1460a9002114c8d16ed61cf75 (patch) | |
tree | 693fe3809ef4888dbfda212640d2035277795ab8 /src/tools/windeployqt/main.cpp | |
parent | a215e6650a3c9a1da8c6ae4b7a0038a1a073a1eb (diff) |
Windeployqt: change qtModule return value to prevent invalid modules
When the change from quint64 to bitsets was originally made, the return
value of the qtModule function was not adapted. Where returning 0 was
fine for the quint64 values which started at 1, returning 0 now adds
the first module instead of adding nothing to the used/required modules
Fixes: QTBUG-111984
Pick-to: 6.5
Change-Id: Id1e2b3237a36335ec5071180b4c73f99d5eb5c8d
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Diffstat (limited to 'src/tools/windeployqt/main.cpp')
-rw-r--r-- | src/tools/windeployqt/main.cpp | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/tools/windeployqt/main.cpp b/src/tools/windeployqt/main.cpp index 68f7601789..6f655044ae 100644 --- a/src/tools/windeployqt/main.cpp +++ b/src/tools/windeployqt/main.cpp @@ -806,7 +806,7 @@ private: DllDirectoryFileEntryFunction m_dllFilter; }; -static quint64 qtModule(QString module, const QString &infix) +static qint64 qtModule(QString module, const QString &infix) { // Match needle 'path/Qt6Core<infix><d>.dll' or 'path/libQt6Core<infix>.so.5.0' const qsizetype lastSlashPos = module.lastIndexOf(u'/'); @@ -827,7 +827,8 @@ static quint64 qtModule(QString module, const QString &infix) return qtModule.id; } } - return 0; + std::wcerr << "Warning: module " << qPrintable(module) << " could not be found\n"; + return -1; } // Return the path if a plugin is to be deployed @@ -855,8 +856,11 @@ static QString deployPlugin(const QString &plugin, const QDir &subDir, QString errorMessage; if (findDependentQtLibraries(libraryLocation, pluginPath, platform, &errorMessage, &dependentQtLibs)) { - for (int d = 0; d < dependentQtLibs.size(); ++ d) - neededModules[qtModule(dependentQtLibs.at(d), infix)] = 1; + for (int d = 0; d < dependentQtLibs.size(); ++d) { + const qint64 module = qtModule(dependentQtLibs.at(d), infix); + if (module >= 0) + neededModules[module] = 1; + } } else { std::wcerr << "Warning: Cannot determine dependencies of " << QDir::toNativeSeparators(pluginPath) << ": " << errorMessage << '\n'; @@ -1253,8 +1257,9 @@ static DeployResult deploy(const Options &options, const QMap<QString, QString> // Determine application type, check Quick2 is used by looking at the // direct dependencies (do not be fooled by QtWebKit depending on it). for (int m = 0; m < dependentQtLibs.size(); ++m) { - const quint64 module = qtModule(dependentQtLibs.at(m), infix); - result.directlyUsedQtLibraries[module] = 1; + const qint64 module = qtModule(dependentQtLibs.at(m), infix); + if (module >= 0) + result.directlyUsedQtLibraries[module] = 1; } const bool usesQml = result.directlyUsedQtLibraries.test(QtQmlModuleId); @@ -1365,8 +1370,9 @@ static DeployResult deploy(const Options &options, const QMap<QString, QString> // QtModule enumeration (and thus controlled by flags) and others. QStringList deployedQtLibraries; for (int i = 0 ; i < dependentQtLibs.size(); ++i) { - if (const quint64 qtm = qtModule(dependentQtLibs.at(i), infix)) - result.usedQtLibraries[qtm] = 1; + const qint64 module = qtModule(dependentQtLibs.at(i), infix); + if (module >= 0) + result.usedQtLibraries[module] = 1; else deployedQtLibraries.push_back(dependentQtLibs.at(i)); // Not represented by flag. } |