diff options
author | Kai Koehne <kai.koehne@qt.io> | 2016-11-07 15:57:08 +0100 |
---|---|---|
committer | Kai Koehne <kai.koehne@qt.io> | 2016-11-08 19:17:15 +0000 |
commit | 9bf3196033c81099c7d74d4dfddf2bce01cbaff5 (patch) | |
tree | f4a17a179fb06f858c2e8b8cefe2fd10dccdd39e /tests/fuzzy-test | |
parent | 9596e734b3f251a8ab3b74910ba0614fffe72f8f (diff) |
Do not use fromLocal8Bit() for string literals
The current locale encoding does have nothing to do with string
literals. Use fromLatin1(), which tends to be the fastest
for ASCII.
Change-Id: I9f1ff603f26812a63e5b23a413ba240c47d5ac23
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'tests/fuzzy-test')
-rw-r--r-- | tests/fuzzy-test/commandlineparser.cpp | 16 | ||||
-rw-r--r-- | tests/fuzzy-test/fuzzytester.cpp | 16 |
2 files changed, 16 insertions, 16 deletions
diff --git a/tests/fuzzy-test/commandlineparser.cpp b/tests/fuzzy-test/commandlineparser.cpp index 0aae0c71a..2378df367 100644 --- a/tests/fuzzy-test/commandlineparser.cpp +++ b/tests/fuzzy-test/commandlineparser.cpp @@ -64,7 +64,7 @@ void CommandLineParser::parse(const QStringList &commandLine) else if (arg == logOption()) m_log = true; else - throw ParseException(QString::fromLocal8Bit("Unknown parameter '%1'").arg(arg)); + throw ParseException(QString::fromLatin1("Unknown parameter '%1'").arg(arg)); } if (m_profile.isEmpty()) throw ParseException("No profile given."); @@ -74,8 +74,8 @@ void CommandLineParser::parse(const QStringList &commandLine) QString CommandLineParser::usageString() const { - return QString::fromLocal8Bit("%1 %2 <profile> %3 <start commit> [%4 <duration>] " - "[%5 <job count>] [%6]") + return QString::fromLatin1("%1 %2 <profile> %3 <start commit> [%4 <duration>] " + "[%5 <job count>] [%6]") .arg(QFileInfo(m_command).fileName(), profileOption(), startCommitOption(), maxDurationoption(), jobCountOption(), logOption()); } @@ -83,10 +83,10 @@ QString CommandLineParser::usageString() const void CommandLineParser::assignOptionArgument(const QString &option, QString &argument) { if (m_commandLine.isEmpty()) - throw ParseException(QString::fromLocal8Bit("Option '%1' needs an argument.").arg(option)); + throw ParseException(QString::fromLatin1("Option '%1' needs an argument.").arg(option)); argument = m_commandLine.takeFirst(); if (argument.isEmpty()) { - throw ParseException(QString::fromLocal8Bit("Argument for option '%1' must not be empty.") + throw ParseException(QString::fromLatin1("Argument for option '%1' must not be empty.") .arg(option)); } } @@ -98,7 +98,7 @@ void CommandLineParser::assignOptionArgument(const QString &option, int &argumen bool ok; argument = numberString.toInt(&ok); if (!ok || argument <= 0) { - throw ParseException(QString::fromLocal8Bit("Invalid argument '%1' for option '%2'.") + throw ParseException(QString::fromLatin1("Invalid argument '%1' for option '%2'.") .arg(numberString, option)); } } @@ -116,7 +116,7 @@ void CommandLineParser::parseDuration() bool ok; m_maxDuration = choppedDurationString.toInt(&ok); if (!ok || m_maxDuration <= 0) { - throw ParseException(QString::fromLocal8Bit("Invalid duration argument '%1'.") + throw ParseException(QString::fromLatin1("Invalid duration argument '%1'.") .arg(durationString)); } if (hasSuffix) { @@ -125,7 +125,7 @@ void CommandLineParser::parseDuration() case 'd': m_maxDuration *= 24; // Fall-through. case 'h': m_maxDuration *= 60; break; default: - throw ParseException(QString::fromLocal8Bit("Invalid duration suffix '%1'.") + throw ParseException(QString::fromLatin1("Invalid duration suffix '%1'.") .arg(suffix)); } } diff --git a/tests/fuzzy-test/fuzzytester.cpp b/tests/fuzzy-test/fuzzytester.cpp index ce0aebac9..55a7c91ae 100644 --- a/tests/fuzzy-test/fuzzytester.cpp +++ b/tests/fuzzy-test/fuzzytester.cpp @@ -110,7 +110,7 @@ void FuzzyTester::runTest(const QString &profile, const QString &startCommit, QString message = "An incremental build succeeded " "with a commit for which a clean build failed."; if (!m_log) { - message += QString::fromLocal8Bit("\nThe qbs error message " + message += QString::fromLatin1("\nThe qbs error message " "for the clean build was: '%1'").arg(qbsError); } throwIncrementalBuildError(message, buildSequence); @@ -121,7 +121,7 @@ void FuzzyTester::runTest(const QString &profile, const QString &startCommit, QString message = "An incremental build failed " "with a commit for which a clean build succeeded."; if (!m_log) { - message += QString::fromLocal8Bit("\nThe qbs error message for " + message += QString::fromLatin1("\nThe qbs error message for " "the incremental build was: '%1'").arg(qbsError); } throwIncrementalBuildError(message, buildSequence); @@ -172,7 +172,7 @@ QString FuzzyTester::findWorkingStartCommit(const QString &startCommit) qDebug("Commit %s is not buildable.", qPrintable(m_currentCommit)); m_unbuildableCommits << m_currentCommit; } - throw TestError(QString::fromLocal8Bit("Cannot run test: Failed to find a single commit that " + throw TestError(QString::fromLatin1("Cannot run test: Failed to find a single commit that " "builds successfully with qbs. The last qbs error was: '%1'").arg(qbsError)); } @@ -183,9 +183,9 @@ void FuzzyTester::runGit(const QStringList &arguments, QString *output) if (!git.waitForStarted()) throw TestError("Failed to start git. It is expected to be in the PATH."); if (!git.waitForFinished(300000) || git.exitStatus() != QProcess::NormalExit) // 5 minutes ought to be enough for everyone - throw TestError(QString::fromLocal8Bit("git failed: %1").arg(git.errorString())); + throw TestError(QString::fromLatin1("git failed: %1").arg(git.errorString())); if (git.exitCode() != 0) { - throw TestError(QString::fromLocal8Bit("git failed: %1") + throw TestError(QString::fromLatin1("git failed: %1") .arg(QString::fromLocal8Bit(git.readAllStandardError()))); } if (output) @@ -220,7 +220,7 @@ bool FuzzyTester::runQbs(const QString &buildDir, const QString &command, QStrin commandLine << ("profile:" + m_profile); qbs.start("qbs", commandLine); if (!qbs.waitForStarted()) { - throw TestError(QString::fromLocal8Bit("Failed to start qbs. It is expected to be " + throw TestError(QString::fromLatin1("Failed to start qbs. It is expected to be " "in the PATH. QProcess error string: '%1'").arg(qbs.errorString())); } if (!qbs.waitForFinished(-1) || qbs.exitCode() != 0) { @@ -235,7 +235,7 @@ void FuzzyTester::removeDir(const QString &dirPath) { QDir dir(dirPath); if (!dir.removeRecursively()) { - throw TestError(QString::fromLocal8Bit("Failed to remove temporary dir '%1'.") + throw TestError(QString::fromLatin1("Failed to remove temporary dir '%1'.") .arg(dir.absolutePath())); } } @@ -264,7 +264,7 @@ void FuzzyTester::throwIncrementalBuildError(const QString &message, const QStringList &commitSequence) { const QString commitSequenceString = commitSequence.join(QLatin1Char(',')); - throw TestError(QString::fromLocal8Bit("Found qbs bug with incremental build!\n" + throw TestError(QString::fromLatin1("Found qbs bug with incremental build!\n" "%1\n" "The sequence of commits was: %2.").arg(message, commitSequenceString)); } |