diff options
author | Friedemann Kleint <Friedemann.Kleint@digia.com> | 2013-09-11 14:55:19 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-11 21:46:52 +0200 |
commit | ba7da9b733f2c5fc75ddbf73e2615bee1663c5b4 (patch) | |
tree | ab35661e6fcd7313221f1b4e6e4cff90a83ada7f /src/tools | |
parent | 546d52e605b6a74d9a5be26fb374b831a46f2550 (diff) |
Fix moc-crash when compiling QtScript on Windows.
@file-arguments were not parsed correctly.
Change-Id: I10dc7ebcd7c9eedb332c7c350aa06c7ac9c2e8b1
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/moc/main.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/tools/moc/main.cpp b/src/tools/moc/main.cpp index d5218571f5..999cae0e60 100644 --- a/src/tools/moc/main.cpp +++ b/src/tools/moc/main.cpp @@ -152,12 +152,12 @@ QByteArray composePreprocessorOutput(const Symbols &symbols) { static QStringList argumentsFromCommandLineAndFile(const QStringList &arguments) { - QStringList allArguments = arguments; - int n = 0; - while (n < allArguments.count()) { + QStringList allArguments; + allArguments.reserve(arguments.size()); + foreach (const QString &argument, arguments) { // "@file" doesn't start with a '-' so we can't use QCommandLineParser for it - if (arguments.at(n).startsWith(QLatin1Char('@'))) { - QString optionsFile = arguments.at(n); + if (argument.startsWith(QLatin1Char('@'))) { + QString optionsFile = argument; optionsFile.remove(0, 1); if (optionsFile.isEmpty()) { error("The @ option requires an input file"); @@ -168,14 +168,13 @@ static QStringList argumentsFromCommandLineAndFile(const QStringList &arguments) error("Cannot open options file specified with @"); return QStringList(); } - allArguments.removeAt(n); while (!f.atEnd()) { QString line = QString::fromLocal8Bit(f.readLine().trimmed()); if (!line.isEmpty()) - allArguments.insert(n++, line); + allArguments << line; } } else { - ++n; + allArguments << argument; } } return allArguments; |