From d7f457a124ff4d2297abb16b9d011de3854bddec Mon Sep 17 00:00:00 2001 From: Montel Laurent Date: Mon, 2 Nov 2015 21:57:43 +0100 Subject: [PATCH] Use QStringLiteral --- autotests/readtest.cpp | 2 +- autotests/writetest.cpp | 2 +- src/imageformats/rgb.cpp | 2 +- tests/imageconverter.cpp | 28 ++++++++++++++-------------- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/autotests/readtest.cpp b/autotests/readtest.cpp index 64df599..ece0e3f 100644 --- a/autotests/readtest.cpp +++ b/autotests/readtest.cpp @@ -129,7 +129,7 @@ int main(int argc, char ** argv) foreach (QFileInfo fi, imgdir.entryInfoList()) { int suffixPos = fi.filePath().count() - suffix.count(); QString inputfile = fi.filePath(); - QString expfile = fi.filePath().replace(suffixPos, suffix.count(), "png"); + QString expfile = fi.filePath().replace(suffixPos, suffix.count(), QStringLiteral("png")); QString expfilename = QFileInfo(expfile).fileName(); QImageReader inputReader(inputfile, format.constData()); diff --git a/autotests/writetest.cpp b/autotests/writetest.cpp index cd50ff0..527d99b 100644 --- a/autotests/writetest.cpp +++ b/autotests/writetest.cpp @@ -75,7 +75,7 @@ int main(int argc, char ** argv) foreach (QFileInfo fi, imgdir.entryInfoList()) { int suffixPos = fi.filePath().count() - suffix.count(); - QString pngfile = fi.filePath().replace(suffixPos, suffix.count(), "png"); + QString pngfile = fi.filePath().replace(suffixPos, suffix.count(), QStringLiteral("png")); QString pngfilename = QFileInfo(pngfile).fileName(); QImageReader pngReader(pngfile, "png"); diff --git a/src/imageformats/rgb.cpp b/src/imageformats/rgb.cpp index c115f0f..27fac8b 100644 --- a/src/imageformats/rgb.cpp +++ b/src/imageformats/rgb.cpp @@ -699,7 +699,7 @@ bool RGBHandler::canRead(QIODevice *device) device->seek(oldPos); } - const QRegExp regexp(QLatin1String("^\x01\xda\x01[\x01\x02]")); + const QRegExp regexp(QStringLiteral("^\x01\xda\x01[\x01\x02]")); QString data(QString::fromLocal8Bit(head)); return data.contains(regexp); diff --git a/tests/imageconverter.cpp b/tests/imageconverter.cpp index 835f86b..0982b27 100644 --- a/tests/imageconverter.cpp +++ b/tests/imageconverter.cpp @@ -32,29 +32,29 @@ int main(int argc, char **argv) { QCoreApplication app(argc, argv); - QCoreApplication::addLibraryPath(QLatin1String(PLUGIN_DIR)); - QCoreApplication::setApplicationName(QLatin1String("imageconverter")); - QCoreApplication::setApplicationVersion(QLatin1String("1.01.01.0")); + QCoreApplication::addLibraryPath(QStringLiteral(PLUGIN_DIR)); + QCoreApplication::setApplicationName(QStringLiteral("imageconverter")); + QCoreApplication::setApplicationVersion(QStringLiteral("1.01.01.0")); QCommandLineParser parser; - parser.setApplicationDescription(QLatin1String("Converts images from one format to another")); + parser.setApplicationDescription(QStringLiteral("Converts images from one format to another")); parser.addHelpOption(); parser.addVersionOption(); - parser.addPositionalArgument(QLatin1String("in"), QLatin1String("input image file")); - parser.addPositionalArgument(QLatin1String("out"), QLatin1String("output image file")); + parser.addPositionalArgument(QStringLiteral("in"), QStringLiteral("input image file")); + parser.addPositionalArgument(QStringLiteral("out"), QStringLiteral("output image file")); QCommandLineOption informat( - QStringList() << QLatin1String("i") << QLatin1String("informat"), - QLatin1String("Image format for input file"), - QLatin1String("format")); + QStringList() << QStringLiteral("i") << QStringLiteral("informat"), + QStringLiteral("Image format for input file"), + QStringLiteral("format")); parser.addOption(informat); QCommandLineOption outformat( - QStringList() << QLatin1String("o") << QLatin1String("outformat"), - QLatin1String("Image format for output file"), - QLatin1String("format")); + QStringList() << QStringLiteral("o") << QStringLiteral("outformat"), + QStringLiteral("Image format for output file"), + QStringLiteral("format")); parser.addOption(outformat); QCommandLineOption listformats( - QStringList() << QLatin1String("l") << QLatin1String("list"), - QLatin1String("List supported image formats")); + QStringList() << QStringLiteral("l") << QStringLiteral("list"), + QStringLiteral("List supported image formats")); parser.addOption(listformats); parser.process(app);