summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2018-12-10 13:43:12 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2018-12-12 08:22:54 +0000
commite4ab3c1687e7e319813a916adb784b307e5f2113 (patch)
tree23af0d12b00ff8176c3af0d73bab6466b14431d1
parentf640dd08ca46c8657aab38d0c3d5dc350b0035cd (diff)
windeployqt: Simplify enabled/disabled modules option parsing
Use a simple vector of and use the mask bit from the qtModules array. Change-Id: I233b5226cce8dfe91018830328c268cf1d16104e Reviewed-by: Andre de la Rocha <andre.rocha@qt.io> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
-rw-r--r--src/windeployqt/main.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/windeployqt/main.cpp b/src/windeployqt/main.cpp
index de5238fdc..e1e68c0ab 100644
--- a/src/windeployqt/main.cpp
+++ b/src/windeployqt/main.cpp
@@ -311,8 +311,7 @@ static inline int parseArguments(const QStringList &arguments, QCommandLineParse
Options *options, QString *errorMessage)
{
typedef QSharedPointer<QCommandLineOption> CommandLineOptionPtr;
- typedef QPair<CommandLineOptionPtr, quint64> OptionMaskPair;
- typedef QVector<OptionMaskPair> OptionMaskVector;
+ using OptionPtrVector = QVector<CommandLineOptionPtr>;
parser->setSingleDashWordOptionMode(QCommandLineParser::ParseAsLongOptions);
parser->setApplicationDescription(QStringLiteral("Qt Deploy Tool ") + QLatin1String(QT_VERSION_STR)
@@ -444,21 +443,22 @@ static inline int parseArguments(const QStringList &arguments, QCommandLineParse
parser->addPositionalArgument(QStringLiteral("[files]"),
QStringLiteral("Binaries or directory containing the binary."));
- OptionMaskVector enabledModules;
- OptionMaskVector disabledModules;
- const size_t qtModulesCount = sizeof(qtModuleEntries)/sizeof(QtModuleEntry);
- for (size_t i = 0; i < qtModulesCount; ++i) {
+ OptionPtrVector enabledModuleOptions;
+ OptionPtrVector disabledModuleOptions;
+ const int qtModulesCount = int(sizeof(qtModuleEntries) / sizeof(QtModuleEntry));
+ enabledModuleOptions.reserve(qtModulesCount);
+ disabledModuleOptions.reserve(qtModulesCount);
+ for (int i = 0; i < qtModulesCount; ++i) {
const QString option = QLatin1String(qtModuleEntries[i].option);
const QString name = QLatin1String(qtModuleEntries[i].libraryName);
const QString enabledDescription = QStringLiteral("Add ") + name + QStringLiteral(" module.");
CommandLineOptionPtr enabledOption(new QCommandLineOption(option, enabledDescription));
parser->addOption(*enabledOption.data());
- enabledModules.push_back(OptionMaskPair(enabledOption, qtModuleEntries[i].module));
-
+ enabledModuleOptions.append(enabledOption);
const QString disabledDescription = QStringLiteral("Remove ") + name + QStringLiteral(" module.");
CommandLineOptionPtr disabledOption(new QCommandLineOption(QStringLiteral("no-") + option,
disabledDescription));
- disabledModules.push_back(OptionMaskPair(disabledOption, qtModuleEntries[i].module));
+ disabledModuleOptions.append(disabledOption);
parser->addOption(*disabledOption.data());
}
@@ -534,11 +534,11 @@ static inline int parseArguments(const QStringList &arguments, QCommandLineParse
options->patchQt = !parser->isSet(noPatchQtOption);
- for (size_t i = 0; i < qtModulesCount; ++i) {
- if (parser->isSet(*enabledModules.at(int(i)).first.data()))
- options->additionalLibraries |= enabledModules.at(int(i)).second;
- if (parser->isSet(*disabledModules.at(int(i)).first.data()))
- options->disabledLibraries |= disabledModules.at(int(i)).second;
+ for (int i = 0; i < qtModulesCount; ++i) {
+ if (parser->isSet(*enabledModuleOptions.at(i)))
+ options->additionalLibraries |= qtModuleEntries[i].module;
+ if (parser->isSet(*disabledModuleOptions.at(i)))
+ options->disabledLibraries |= qtModuleEntries[i].module;
}
// Add some dependencies