summaryrefslogtreecommitdiffstats
path: root/src/tools/moc
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/moc
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/moc')
-rw-r--r--src/tools/moc/main.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/tools/moc/main.cpp b/src/tools/moc/main.cpp
index 45ed85edf3..3fcb32e482 100644
--- a/src/tools/moc/main.cpp
+++ b/src/tools/moc/main.cpp
@@ -153,7 +153,7 @@ static QStringList argumentsFromCommandLineAndFile(const QStringList &arguments,
allArguments.reserve(arguments.size());
for (const QString &argument : arguments) {
// "@file" doesn't start with a '-' so we can't use QCommandLineParser for it
- if (argument.startsWith(QLatin1Char('@'))) {
+ if (argument.startsWith(u'@')) {
QString optionsFile = argument;
optionsFile.remove(0, 1);
if (optionsFile.isEmpty()) {
@@ -354,7 +354,7 @@ int runMoc(int argc, char **argv)
return collectJson(files, output, hasOptionFiles);
if (files.count() > 1) {
- error(qPrintable(QLatin1String("Too many input files specified: '") + files.join(QLatin1String("' '")) + QLatin1Char('\'')));
+ error(qPrintable(QLatin1String("Too many input files specified: '") + files.join(QLatin1String("' '")) + u'\''));
parser.showHelp(1);
} else if (!files.isEmpty()) {
filename = files.first();
@@ -452,10 +452,10 @@ int runMoc(int argc, char **argv)
moc.displayWarnings = moc.displayNotes = false;
if (autoInclude) {
- int spos = filename.lastIndexOf(QDir::separator());
- int ppos = filename.lastIndexOf(QLatin1Char('.'));
+ qsizetype spos = filename.lastIndexOf(QDir::separator());
+ qsizetype ppos = filename.lastIndexOf(u'.');
// spos >= -1 && ppos > spos => ppos >= 0
- moc.noInclude = (ppos > spos && filename.at(ppos + 1).toLower() != QLatin1Char('h'));
+ moc.noInclude = (ppos > spos && filename.at(ppos + 1).toLower() != u'h');
}
if (defaultInclude) {
if (moc.includePath.isEmpty()) {
@@ -484,13 +484,13 @@ int runMoc(int argc, char **argv)
const auto metadata = parser.values(metadataOption);
for (const QString &md : metadata) {
- int split = md.indexOf(QLatin1Char('='));
+ qsizetype split = md.indexOf(u'=');
QString key = md.left(split);
QString value = md.mid(split + 1);
if (split == -1 || key.isEmpty() || value.isEmpty()) {
error("missing key or value for option '-M'");
- } else if (key.indexOf(QLatin1Char('.')) != -1) {
+ } else if (key.indexOf(u'.') != -1) {
// Don't allow keys with '.' for now, since we might need this
// format later for more advanced meta data API
error("A key cannot contain the letter '.' for option '-M'");