From ba7da9b733f2c5fc75ddbf73e2615bee1663c5b4 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 11 Sep 2013 14:55:19 +0200 Subject: Fix moc-crash when compiling QtScript on Windows. @file-arguments were not parsed correctly. Change-Id: I10dc7ebcd7c9eedb332c7c350aa06c7ac9c2e8b1 Reviewed-by: Olivier Goffart --- src/tools/moc/main.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src/tools/moc') 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; -- cgit v1.2.3