summaryrefslogtreecommitdiffstats
path: root/src/tools/rcc
diff options
context:
space:
mode:
authorSona Kurazyan <sona.kurazyan@qt.io>2022-04-13 14:30:28 +0200
committerMarc Mutz <marc.mutz@qt.io>2022-05-02 23:38:45 +0000
commita0539ed53f45619df7e4aad664369301dd6da091 (patch)
tree3529ce5147346c7686bc9c901894b88b06a5dcc2 /src/tools/rcc
parent8d6eae7ffd1da8322dff7ca87c092232d9a5f7b4 (diff)
Tools: stop using QLatin1Char constructor for creating char literals
Required for porting away from QLatin1Char/QLatin1String in scope of QTBUG-98434. As a drive-by, fix qsizetype -> int narrowing conversion warnings for the touched lines. Change-Id: Ib9e01ede4e0d7869fc95414d36f37df4a30b16b4 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Diffstat (limited to 'src/tools/rcc')
-rw-r--r--src/tools/rcc/main.cpp15
-rw-r--r--src/tools/rcc/rcc.cpp16
2 files changed, 15 insertions, 16 deletions
diff --git a/src/tools/rcc/main.cpp b/src/tools/rcc/main.cpp
index d9d211c19d..14da7099e5 100644
--- a/src/tools/rcc/main.cpp
+++ b/src/tools/rcc/main.cpp
@@ -105,11 +105,11 @@ QString makefileEscape(const QString &filepath)
// Always use forward slashes
QString result = QDir::cleanPath(filepath);
// Spaces are escaped with a backslash
- result.replace(QLatin1Char(' '), QLatin1String("\\ "));
+ result.replace(u' ', QLatin1String("\\ "));
// Pipes are escaped with a backslash
- result.replace(QLatin1Char('|'), QLatin1String("\\|"));
+ result.replace(u'|', QLatin1String("\\|"));
// Dollars are escaped with a dollar
- result.replace(QLatin1Char('$'), QLatin1String("$$"));
+ result.replace(u'$', QLatin1String("$$"));
return result;
}
@@ -118,16 +118,16 @@ void writeDepFile(QIODevice &iodev, const QStringList &depsList, const QString &
{
QTextStream out(&iodev);
out << qPrintable(makefileEscape(targetName));
- out << QLatin1Char(':');
+ out << QChar(u':');
// Write depfile
for (int i = 0; i < depsList.size(); ++i) {
- out << QLatin1Char(' ');
+ out << QChar(u' ');
out << qPrintable(makefileEscape(depsList.at(i)));
}
- out << QLatin1Char('\n');
+ out << QChar(u'\n');
}
int runRcc(int argc, char *argv[])
@@ -244,8 +244,7 @@ int runRcc(int argc, char *argv[])
library.setInitName(parser.value(nameOption));
if (parser.isSet(rootOption)) {
library.setResourceRoot(QDir::cleanPath(parser.value(rootOption)));
- if (library.resourceRoot().isEmpty()
- || library.resourceRoot().at(0) != QLatin1Char('/'))
+ if (library.resourceRoot().isEmpty() || library.resourceRoot().at(0) != u'/')
errorMsg = QLatin1String("Root must start with a /");
}
diff --git a/src/tools/rcc/rcc.cpp b/src/tools/rcc/rcc.cpp
index 1825c77b53..a01d5bc310 100644
--- a/src/tools/rcc/rcc.cpp
+++ b/src/tools/rcc/rcc.cpp
@@ -169,8 +169,8 @@ QString RCCFileInfo::resourceName() const
{
QString resource = m_name;
for (RCCFileInfo *p = m_parent; p; p = p->m_parent)
- resource = resource.prepend(p->m_name + QLatin1Char('/'));
- return QLatin1Char(':') + resource;
+ resource = resource.prepend(p->m_name + u'/');
+ return u':' + resource;
}
void RCCFileInfo::writeDataInfo(RCCResourceLibrary &lib)
@@ -499,7 +499,7 @@ bool RCCResourceLibrary::interpretResourceFile(QIODevice *inputDevice,
const QString &fname, QString currentPath, bool listMode)
{
Q_ASSERT(m_errorDevice);
- const QChar slash = QLatin1Char('/');
+ const QChar slash = u'/';
if (!currentPath.isEmpty() && !currentPath.endsWith(slash))
currentPath += slash;
@@ -734,7 +734,7 @@ bool RCCResourceLibrary::addFile(const QString &alias, const RCCFileInfo &file)
m_root = new RCCFileInfo(QString(), QFileInfo(), QLocale::C, QLocale::AnyTerritory, RCCFileInfo::Directory);
RCCFileInfo *parent = m_root;
- const QStringList nodes = alias.split(QLatin1Char('/'));
+ const QStringList nodes = alias.split(u'/');
for (int i = 1; i < nodes.size()-1; ++i) {
const QString node = nodes.at(i);
if (node.isEmpty())
@@ -845,7 +845,7 @@ QStringList RCCResourceLibrary::dataFiles() const
// Determine map of resource identifier (':/newPrefix/images/p1.png') to file via recursion
static void resourceDataFileMapRecursion(const RCCFileInfo *m_root, const QString &path, RCCResourceLibrary::ResourceDataFileMap &m)
{
- const QChar slash = QLatin1Char('/');
+ const QChar slash = u'/';
const auto cend = m_root->m_children.constEnd();
for (auto it = m_root->m_children.constBegin(); it != cend; ++it) {
const RCCFileInfo *child = it.value();
@@ -862,7 +862,7 @@ RCCResourceLibrary::ResourceDataFileMap RCCResourceLibrary::resourceDataFileMap(
{
ResourceDataFileMap rc;
if (m_root)
- resourceDataFileMapRecursion(m_root, QString(QLatin1Char(':')), rc);
+ resourceDataFileMapRecursion(m_root, QString(u':'), rc);
return rc;
}
@@ -1348,7 +1348,7 @@ bool RCCResourceLibrary::writeInitializer()
//write("\nQT_BEGIN_NAMESPACE\n");
QString initNameStr = m_initName;
if (!initNameStr.isEmpty()) {
- initNameStr.prepend(QLatin1Char('_'));
+ initNameStr.prepend(u'_');
auto isAsciiLetterOrNumber = [] (QChar c) -> bool {
ushort ch = c.unicode();
return (ch >= '0' && ch <= '9') ||
@@ -1358,7 +1358,7 @@ bool RCCResourceLibrary::writeInitializer()
};
for (QChar &c : initNameStr) {
if (!isAsciiLetterOrNumber(c))
- c = QLatin1Char('_');
+ c = u'_';
}
}
QByteArray initName = initNameStr.toLatin1();