diff options
-rw-r--r-- | src/tools/cmake_automoc_parser/main.cpp | 6 | ||||
-rw-r--r-- | src/tools/macdeployqt/shared/shared.cpp | 36 | ||||
-rw-r--r-- | src/tools/moc/main.cpp | 14 | ||||
-rw-r--r-- | src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp | 8 | ||||
-rw-r--r-- | src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp | 36 | ||||
-rw-r--r-- | src/tools/qlalr/cppgenerator.cpp | 4 | ||||
-rw-r--r-- | src/tools/qlalr/lalr.g | 34 | ||||
-rw-r--r-- | src/tools/qlalr/recognizer.cpp | 32 | ||||
-rw-r--r-- | src/tools/qlalr/recognizer.h | 2 | ||||
-rw-r--r-- | src/tools/qvkgen/qvkgen.cpp | 14 | ||||
-rw-r--r-- | src/tools/rcc/main.cpp | 15 | ||||
-rw-r--r-- | src/tools/rcc/rcc.cpp | 16 | ||||
-rw-r--r-- | src/tools/tracegen/etw.cpp | 2 | ||||
-rw-r--r-- | src/tools/tracegen/helpers.cpp | 2 | ||||
-rw-r--r-- | src/tools/tracegen/lttng.cpp | 2 | ||||
-rw-r--r-- | src/tools/tracegen/provider.cpp | 6 | ||||
-rw-r--r-- | src/tools/windeployqt/main.cpp | 73 | ||||
-rw-r--r-- | src/tools/windeployqt/qmlutils.cpp | 6 | ||||
-rw-r--r-- | src/tools/windeployqt/utils.cpp | 48 | ||||
-rw-r--r-- | src/tools/windeployqt/utils.h | 8 |
20 files changed, 180 insertions, 184 deletions
diff --git a/src/tools/cmake_automoc_parser/main.cpp b/src/tools/cmake_automoc_parser/main.cpp index edcb08ef2e..6d8ae5d9fa 100644 --- a/src/tools/cmake_automoc_parser/main.cpp +++ b/src/tools/cmake_automoc_parser/main.cpp @@ -163,7 +163,7 @@ static bool readParseCache(ParseCacheMap &entries, const QString &parseCacheFile QString line; bool mmc_key_found = false; while (textStream.readLineInto(&line)) { - if (!line.startsWith(QLatin1Char(' '))) { + if (!line.startsWith(u' ')) { if (!mocEntries.isEmpty() || mmc_key_found || !mocIncludes.isEmpty()) { entries.insert(source, ParseCacheEntry { std::move(mocEntries), std::move(mocIncludes) }); @@ -348,7 +348,7 @@ int main(int argc, char **argv) const QString base = fileInfo.path() + fileInfo.completeBaseName(); // 1a) erase header for (const auto &ext : headerExtList) { - const QString headerPath = base + QLatin1Char('.') + ext; + const QString headerPath = base + u'.' + ext; auto it = autoGenHeaders.find(headerPath); if (it != autoGenHeaders.end()) { autoGenHeaders.erase(it); @@ -368,7 +368,7 @@ int main(int argc, char **argv) QFileInfo(mocFile.right(mocFile.size() - mocKeyLen)).completeBaseName(); bool breakFree = false; for (auto &ext : headerExtList) { - const QString headerSuffix = headerBaseName + QLatin1Char('.') + ext; + const QString headerSuffix = headerBaseName + u'.' + ext; for (auto it = autoGenHeaders.begin(); it != autoGenHeaders.end(); ++it) { if (it.key().endsWith(headerSuffix) && QFileInfo(it.key()).completeBaseName() == headerBaseName) { diff --git a/src/tools/macdeployqt/shared/shared.cpp b/src/tools/macdeployqt/shared/shared.cpp index 4d6872a3b8..4e550750f6 100644 --- a/src/tools/macdeployqt/shared/shared.cpp +++ b/src/tools/macdeployqt/shared/shared.cpp @@ -311,15 +311,15 @@ FrameworkInfo parseOtoolLibraryLine(const QString &line, const QString &appBundl for (QString &path : librarySearchPath) { if (!path.endsWith("/")) path += '/'; - QString nameInPath = path + parts.join(QLatin1Char('/')); + QString nameInPath = path + parts.join(u'/'); if (QFile::exists(nameInPath)) { - info.frameworkDirectory = path + partsCopy.join(QLatin1Char('/')); + info.frameworkDirectory = path + partsCopy.join(u'/'); break; } } if (currentPart.contains(".framework")) { if (info.frameworkDirectory.isEmpty()) - info.frameworkDirectory = "/Library/Frameworks/" + partsCopy.join(QLatin1Char('/')); + info.frameworkDirectory = "/Library/Frameworks/" + partsCopy.join(u'/'); if (!info.frameworkDirectory.endsWith("/")) info.frameworkDirectory += "/"; state = FrameworkName; @@ -327,7 +327,7 @@ FrameworkInfo parseOtoolLibraryLine(const QString &line, const QString &appBundl continue; } else if (currentPart.contains(".dylib")) { if (info.frameworkDirectory.isEmpty()) - info.frameworkDirectory = "/usr/lib/" + partsCopy.join(QLatin1Char('/')); + info.frameworkDirectory = "/usr/lib/" + partsCopy.join(u'/'); if (!info.frameworkDirectory.endsWith("/")) info.frameworkDirectory += "/"; state = DylibName; @@ -682,7 +682,7 @@ void recursiveCopyAndDeploy(const QString &appBundlePath, const QList<QString> & QStringList files = QDir(sourcePath).entryList(QStringList() << QStringLiteral("*"), QDir::Files | QDir::NoDotAndDotDot); for (const QString &file : files) { - const QString fileSourcePath = sourcePath + QLatin1Char('/') + file; + const QString fileSourcePath = sourcePath + u'/' + file; if (file.endsWith("_debug.dylib")) { continue; // Skip debug versions @@ -703,7 +703,7 @@ void recursiveCopyAndDeploy(const QString &appBundlePath, const QList<QString> & QString fileDestinationPath = fileDestinationDir + file; // The .dylib symlink destination path: - QString linkDestinationPath = destinationPath + QLatin1Char('/') + file; + QString linkDestinationPath = destinationPath + u'/' + file; // The (relative) link; with a correct number of "../"'s. QString linkPath = QStringLiteral("PlugIns/quick/") + file; @@ -721,14 +721,14 @@ void recursiveCopyAndDeploy(const QString &appBundlePath, const QList<QString> & deployQtFrameworks(frameworks, appBundlePath, QStringList(fileDestinationPath), useDebugLibs, useLoaderPath); } } else { - QString fileDestinationPath = destinationPath + QLatin1Char('/') + file; + QString fileDestinationPath = destinationPath + u'/' + file; copyFilePrintStatus(fileSourcePath, fileDestinationPath); } } QStringList subdirs = QDir(sourcePath).entryList(QStringList() << QStringLiteral("*"), QDir::Dirs | QDir::NoDotAndDotDot); for (const QString &dir : subdirs) { - recursiveCopyAndDeploy(appBundlePath, rpaths, sourcePath + QLatin1Char('/') + dir, destinationPath + QLatin1Char('/') + dir); + recursiveCopyAndDeploy(appBundlePath, rpaths, sourcePath + u'/' + dir, destinationPath + u'/' + dir); } } @@ -741,8 +741,8 @@ QString copyDylib(const FrameworkInfo &framework, const QString path) // Construct destination paths. The full path typically looks like // MyApp.app/Contents/Frameworks/libfoo.dylib - QString dylibDestinationDirectory = path + QLatin1Char('/') + framework.frameworkDestinationDirectory; - QString dylibDestinationBinaryPath = dylibDestinationDirectory + QLatin1Char('/') + framework.binaryName; + QString dylibDestinationDirectory = path + u'/' + framework.frameworkDestinationDirectory; + QString dylibDestinationBinaryPath = dylibDestinationDirectory + u'/' + framework.binaryName; // Create destination directory if (!QDir().mkpath(dylibDestinationDirectory)) { @@ -768,9 +768,9 @@ QString copyFramework(const FrameworkInfo &framework, const QString path) // Construct destination paths. The full path typically looks like // MyApp.app/Contents/Frameworks/Foo.framework/Versions/5/QtFoo - QString frameworkDestinationDirectory = path + QLatin1Char('/') + framework.frameworkDestinationDirectory; - QString frameworkBinaryDestinationDirectory = frameworkDestinationDirectory + QLatin1Char('/') + framework.binaryDirectory; - QString frameworkDestinationBinaryPath = frameworkBinaryDestinationDirectory + QLatin1Char('/') + framework.binaryName; + QString frameworkDestinationDirectory = path + u'/' + framework.frameworkDestinationDirectory; + QString frameworkBinaryDestinationDirectory = frameworkDestinationDirectory + u'/' + framework.binaryDirectory; + QString frameworkDestinationBinaryPath = frameworkBinaryDestinationDirectory + u'/' + framework.binaryName; // Return if the framework has aleardy been deployed if (QDir(frameworkDestinationDirectory).exists() && !alwaysOwerwriteEnabled) @@ -851,7 +851,7 @@ void changeInstallName(const QString &bundlePath, const FrameworkInfo &framework QString deployedInstallName; if (useLoaderPath) { deployedInstallName = QLatin1String("@loader_path/") - + QFileInfo(binary).absoluteDir().relativeFilePath(absBundlePath + QLatin1Char('/') + framework.binaryDestinationDirectory + QLatin1Char('/') + framework.binaryName); + + QFileInfo(binary).absoluteDir().relativeFilePath(absBundlePath + u'/' + framework.binaryDestinationDirectory + u'/' + framework.binaryName); } else { deployedInstallName = framework.deployedInstallName; } @@ -1093,13 +1093,13 @@ void deployPlugins(const ApplicationBundleInfo &appBundleInfo, const QString &pl const auto addPlugins = [&pluginSourcePath,&pluginList,useDebugLibs](const QString &subDirectory, const std::function<bool(QString)> &predicate = std::function<bool(QString)>()) { - const QStringList libs = QDir(pluginSourcePath + QLatin1Char('/') + subDirectory) + const QStringList libs = QDir(pluginSourcePath + u'/' + subDirectory) .entryList({QStringLiteral("*.dylib")}); for (const QString &lib : libs) { if (lib.endsWith(QStringLiteral("_debug.dylib")) != useDebugLibs) continue; if (!predicate || predicate(lib)) - pluginList.append(subDirectory + QLatin1Char('/') + lib); + pluginList.append(subDirectory + u'/' + lib); } }; @@ -1362,10 +1362,10 @@ bool deployQmlImports(const QString &appBundlePath, DeploymentInfo deploymentInf // Create the destination path from the name // and version (grabbed from the source path) // ### let qmlimportscanner provide this. - name.replace(QLatin1Char('.'), QLatin1Char('/')); + name.replace(u'.', u'/'); int secondTolast = path.length() - 2; QString version = path.mid(secondTolast); - if (version.startsWith(QLatin1Char('.'))) + if (version.startsWith(u'.')) name.append(version); deployQmlImport(appBundlePath, deploymentInfo.rpathsUsed, path, name); 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'"); diff --git a/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp b/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp index 967f567a6d..ee46970c74 100644 --- a/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp +++ b/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp @@ -277,7 +277,7 @@ QString qDBusInterfaceFromClassDef(const ClassDef *mo) if (interface.startsWith(QLatin1String("QDBus"))) { interface.prepend(QLatin1String("org.qtproject.QtDBus.")); - } else if (interface.startsWith(QLatin1Char('Q')) && + } else if (interface.startsWith(u'Q') && interface.length() >= 2 && interface.at(1).isUpper()) { // assume it's Qt interface.prepend(QLatin1String("local.org.qtproject.Qt.")); @@ -364,7 +364,7 @@ static void parseCmdLine(QStringList &arguments) if (arg == QLatin1String("--help")) showHelp(); - if (!arg.startsWith(QLatin1Char('-'))) + if (!arg.startsWith(u'-')) continue; char c = arg.size() == 2 ? arg.at(1).toLatin1() : char(0); @@ -419,7 +419,7 @@ static void parseCmdLine(QStringList &arguments) break; case 'o': - if (arguments.count() < i + 2 || arguments.at(i + 1).startsWith(QLatin1Char('-'))) { + if (arguments.count() < i + 2 || arguments.at(i + 1).startsWith(u'-')) { printf("-o expects a filename\n"); exit(1); } @@ -459,7 +459,7 @@ int main(int argc, char **argv) for (int i = 0; i < args.count(); ++i) { const QString arg = args.at(i); - if (arg.startsWith(QLatin1Char('-'))) + if (arg.startsWith(u'-')) continue; QFile f(arg); diff --git a/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp b/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp index 45802b7492..9ed18e1659 100644 --- a/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp +++ b/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp @@ -111,7 +111,7 @@ static void cleanInterfaces(QDBusIntrospection::Interfaces &interfaces) // produce a header name from the file name static QString header(const QString &name) { - QStringList parts = name.split(QLatin1Char(':')); + QStringList parts = name.split(u':'); QString retval = parts.first(); if (retval.isEmpty() || retval == QLatin1String("-")) @@ -127,7 +127,7 @@ static QString header(const QString &name) // produce a cpp name from the file name static QString cpp(const QString &name) { - QStringList parts = name.split(QLatin1Char(':')); + QStringList parts = name.split(u':'); QString retval = parts.last(); if (retval.isEmpty() || retval == QLatin1String("-")) @@ -180,7 +180,7 @@ static QString classNameForInterface(const QString &interface, ClassType classTy if (!globalClassName.isEmpty()) return globalClassName; - const auto parts = QStringView{interface}.split(QLatin1Char('.')); + const auto parts = QStringView{interface}.split(u'.'); QString retval; if (classType == Proxy) { @@ -282,7 +282,7 @@ static QStringList makeArgNames(const QDBusIntrospection::Arguments &inputArgs, if (name.isEmpty()) name = QString( QLatin1String("in%1") ).arg(i); else - name.replace(QLatin1Char('-'), QLatin1Char('_')); + name.replace(u'-', u'_'); while (retval.contains(name)) name += QLatin1String("_"); retval << name; @@ -293,7 +293,7 @@ static QStringList makeArgNames(const QDBusIntrospection::Arguments &inputArgs, if (name.isEmpty()) name = QString( QLatin1String("out%1") ).arg(i); else - name.replace(QLatin1Char('-'), QLatin1Char('_')); + name.replace(u'-', u'_'); while (retval.contains(name)) name += QLatin1String("_"); retval << name; @@ -406,13 +406,13 @@ static QString stringify(const QString &data) QString retval; int i; for (i = 0; i < data.length(); ++i) { - retval += QLatin1Char('\"'); - for ( ; i < data.length() && data[i] != QLatin1Char('\n') && data[i] != QLatin1Char('\r'); ++i) - if (data[i] == QLatin1Char('\"')) + retval += u'\"'; + for ( ; i < data.length() && data[i] != u'\n' && data[i] != u'\r'; ++i) + if (data[i] == u'\"') retval += QLatin1String("\\\""); else retval += data[i]; - if (i+1 < data.length() && data[i] == QLatin1Char('\r') && data[i+1] == QLatin1Char('\n')) + if (i+1 < data.length() && data[i] == u'\r' && data[i+1] == u'\n') i++; retval += QLatin1String("\\n\"\n"); } @@ -457,8 +457,8 @@ static void writeProxy(const QString &filename, const QDBusIntrospection::Interf // include guards: QString includeGuard; if (!headerName.isEmpty() && headerName != QLatin1String("-")) { - includeGuard = headerName.toUpper().replace(QLatin1Char('.'), QLatin1Char('_')); - int pos = includeGuard.lastIndexOf(QLatin1Char('/')); + includeGuard = headerName.toUpper().replace(u'.', u'_'); + qsizetype pos = includeGuard.lastIndexOf(u'/'); if (pos != -1) includeGuard = includeGuard.mid(pos + 1); } else { @@ -694,7 +694,7 @@ static void writeProxy(const QString &filename, const QDBusIntrospection::Interf QStringList current; QString name; if (it != interfaces.constEnd()) { - current = it->constData()->name.split(QLatin1Char('.')); + current = it->constData()->name.split(u'.'); name = current.takeLast(); } @@ -705,15 +705,15 @@ static void writeProxy(const QString &filename, const QDBusIntrospection::Interf // i parts matched // close last.arguments().count() - i namespaces: for (int j = i; j < last.count(); ++j) - hs << QString((last.count() - j - 1 + i) * 2, QLatin1Char(' ')) << "}" << Qt::endl; + hs << QString((last.count() - j - 1 + i) * 2, u' ') << "}" << Qt::endl; // open current.arguments().count() - i namespaces for (int j = i; j < current.count(); ++j) - hs << QString(j * 2, QLatin1Char(' ')) << "namespace " << current.at(j) << " {" << Qt::endl; + hs << QString(j * 2, u' ') << "namespace " << current.at(j) << " {" << Qt::endl; // add this class: if (!name.isEmpty()) { - hs << QString(current.count() * 2, QLatin1Char(' ')) + hs << QString(current.count() * 2, u' ') << "using " << name << " = ::" << classNameForInterface(it->constData()->name, Proxy) << ";" << Qt::endl; } @@ -770,8 +770,8 @@ static void writeAdaptor(const QString &filename, const QDBusIntrospection::Inte // include guards: QString includeGuard; if (!headerName.isEmpty() && headerName != QLatin1String("-")) { - includeGuard = headerName.toUpper().replace(QLatin1Char('.'), QLatin1Char('_')); - int pos = includeGuard.lastIndexOf(QLatin1Char('/')); + includeGuard = headerName.toUpper().replace(u'.', u'_'); + qsizetype pos = includeGuard.lastIndexOf(u'/'); if (pos != -1) includeGuard = includeGuard.mid(pos + 1); } else { @@ -1143,7 +1143,7 @@ int main(int argc, char **argv) QStringList args = app.arguments(); args.removeFirst(); commandLine = QLatin1String(PROGRAMNAME " "); - commandLine += args.join(QLatin1Char(' ')); + commandLine += args.join(u' '); if (!proxyFile.isEmpty() || adaptorFile.isEmpty()) writeProxy(proxyFile, interfaces); diff --git a/src/tools/qlalr/cppgenerator.cpp b/src/tools/qlalr/cppgenerator.cpp index 7efe94a5c2..2179d33b74 100644 --- a/src/tools/qlalr/cppgenerator.cpp +++ b/src/tools/qlalr/cppgenerator.cpp @@ -112,7 +112,7 @@ QString CppGenerator::privateCopyrightHeader() const QString CppGenerator::startIncludeGuard(const QString &fileName) { - const QString normalized(QString(fileName).replace(QLatin1Char('.'), QLatin1Char('_')).toUpper()); + const QString normalized(QString(fileName).replace(u'.', u'_').toUpper()); return QString::fromLatin1("#ifndef %1\n" "#define %2\n").arg(normalized, normalized); @@ -120,7 +120,7 @@ QString CppGenerator::startIncludeGuard(const QString &fileName) QString CppGenerator::endIncludeGuard(const QString &fileName) { - const QString normalized(QString(fileName).replace(QLatin1Char('.'), QLatin1Char('_')).toUpper()); + const QString normalized(QString(fileName).replace(u'.', u'_').toUpper()); return QString::fromLatin1("#endif // %1\n").arg(normalized); } diff --git a/src/tools/qlalr/lalr.g b/src/tools/qlalr/lalr.g index 3c1d1d3ebd..d59bb03a76 100644 --- a/src/tools/qlalr/lalr.g +++ b/src/tools/qlalr/lalr.g @@ -126,7 +126,7 @@ protected: // scanner { ch = *_M_currentChar++; - if (ch == QLatin1Char('\n')) + if (ch == u'\n') ++_M_line; } else @@ -247,9 +247,9 @@ int Recognizer::nextToken() { inp(); // skip " text.clear (); - while (! ch.isNull () && ch != QLatin1Char ('"')) + while (! ch.isNull () && ch != u'"') { - if (ch == QLatin1Char ('\\')) + if (ch == u'\\') { text += ch; inp(); @@ -258,7 +258,7 @@ int Recognizer::nextToken() inp (); } - if (ch == QLatin1Char ('"')) + if (ch == u'"') inp (); else qerr() << _M_input_file << ":" << _M_line << ": Warning. Expected `\"'" << Qt::endl; @@ -267,11 +267,11 @@ int Recognizer::nextToken() return (token = STRING_LITERAL); } - else if (ch.isLetterOrNumber () || ch == QLatin1Char ('_')) + else if (ch.isLetterOrNumber () || ch == u'_') { text.clear (); do { text += ch; inp (); } - while (ch.isLetterOrNumber () || ch == QLatin1Char ('_') || ch == QLatin1Char ('.')); + while (ch.isLetterOrNumber () || ch == u'_' || ch == u'.'); _M_current_value = text; return (token = ID); } @@ -284,7 +284,7 @@ int Recognizer::nextToken() while (ch.isSpace ()); do { text += ch; inp (); } - while (ch.isLetterOrNumber () || ch == QLatin1Char ('_') || ch == QLatin1Char ('-')); + while (ch.isLetterOrNumber () || ch == u'_' || ch == u'-'); if (text == QLatin1String("token_prefix")) return (token = TOKEN_PREFIX); @@ -322,23 +322,23 @@ int Recognizer::nextToken() inp (); - if (token == '-' && ch == QLatin1Char ('-')) + if (token == '-' && ch == u'-') { do { inp (); } - while (! ch.isNull () && ch != QLatin1Char ('\n')); + while (! ch.isNull () && ch != u'\n'); goto Lagain; } - else if (token == ':' && ch == QLatin1Char (':')) + else if (token == ':' && ch == u':') { inp (); - if (ch != QLatin1Char ('=')) + if (ch != u'=') return (token = ERROR); inp (); return (token = COLON); } - else if (token == '/' && ch == QLatin1Char (':')) + else if (token == '/' && ch == u':') { _M_action_line = _M_line; @@ -355,13 +355,13 @@ int Recognizer::nextToken() token = ch.unicode (); inp (); - if (token == ':' && ch == QLatin1Char ('/')) + if (token == ':' && ch == u'/') break; text += QLatin1Char (token); } - if (ch != QLatin1Char ('/')) + if (ch != u'/') return (token = ERROR); inp (); @@ -376,7 +376,7 @@ int Recognizer::nextToken() } } - else if (token == '/' && ch == QLatin1Char ('.')) + else if (token == '/' && ch == u'.') { _M_action_line = _M_line; @@ -394,13 +394,13 @@ int Recognizer::nextToken() token = ch.unicode (); inp (); - if (token == '.' && ch == QLatin1Char ('/')) + if (token == '.' && ch == u'/') break; text += QLatin1Char (token); } - if (ch != QLatin1Char ('/')) + if (ch != u'/') return (token = ERROR); inp (); diff --git a/src/tools/qlalr/recognizer.cpp b/src/tools/qlalr/recognizer.cpp index 760a094460..f4526d164b 100644 --- a/src/tools/qlalr/recognizer.cpp +++ b/src/tools/qlalr/recognizer.cpp @@ -83,9 +83,9 @@ int Recognizer::nextToken() { inp(); // skip " text.clear (); - while (! ch.isNull () && ch != QLatin1Char ('"')) + while (!ch.isNull () && ch != u'"') { - if (ch == QLatin1Char ('\\')) + if (ch == u'\\') { text += ch; inp(); @@ -94,7 +94,7 @@ int Recognizer::nextToken() inp (); } - if (ch == QLatin1Char ('"')) + if (ch == u'"') inp (); else qerr() << _M_input_file << ":" << _M_line << ": Warning. Expected `\"'" << Qt::endl; @@ -103,11 +103,11 @@ int Recognizer::nextToken() return (token = STRING_LITERAL); } - else if (ch.isLetterOrNumber () || ch == QLatin1Char ('_')) + else if (ch.isLetterOrNumber () || ch == u'_') { text.clear (); do { text += ch; inp (); } - while (ch.isLetterOrNumber () || ch == QLatin1Char ('_') || ch == QLatin1Char ('.')); + while (ch.isLetterOrNumber () || ch == u'_' || ch == u'.'); _M_current_value = text; return (token = ID); } @@ -120,7 +120,7 @@ int Recognizer::nextToken() while (ch.isSpace ()); do { text += ch; inp (); } - while (ch.isLetterOrNumber () || ch == QLatin1Char ('_') || ch == QLatin1Char ('-')); + while (ch.isLetterOrNumber () || ch == u'_' || ch == u'-'); if (text == QLatin1String("token_prefix")) return (token = TOKEN_PREFIX); @@ -158,23 +158,23 @@ int Recognizer::nextToken() inp (); - if (token == '-' && ch == QLatin1Char ('-')) + if (token == '-' && ch == u'-') { do { inp (); } - while (! ch.isNull () && ch != QLatin1Char ('\n')); + while (!ch.isNull () && ch != u'\n'); goto Lagain; } - else if (token == ':' && ch == QLatin1Char (':')) + else if (token == ':' && ch == u':') { inp (); - if (ch != QLatin1Char ('=')) + if (ch != u'=') return (token = ERROR); inp (); return (token = COLON); } - else if (token == '/' && ch == QLatin1Char (':')) + else if (token == '/' && ch == u':') { _M_action_line = _M_line; @@ -191,13 +191,13 @@ int Recognizer::nextToken() token = ch.unicode (); inp (); - if (token == ':' && ch == QLatin1Char ('/')) + if (token == ':' && ch == u'/') break; text += QLatin1Char (token); } - if (ch != QLatin1Char ('/')) + if (ch != u'/') return (token = ERROR); inp (); @@ -212,7 +212,7 @@ int Recognizer::nextToken() } } - else if (token == '/' && ch == QLatin1Char ('.')) + else if (token == '/' && ch == u'.') { _M_action_line = _M_line; @@ -230,13 +230,13 @@ int Recognizer::nextToken() token = ch.unicode (); inp (); - if (token == '.' && ch == QLatin1Char ('/')) + if (token == '.' && ch == u'/') break; text += QLatin1Char (token); } - if (ch != QLatin1Char ('/')) + if (ch != u'/') return (token = ERROR); inp (); diff --git a/src/tools/qlalr/recognizer.h b/src/tools/qlalr/recognizer.h index 001de3bcf1..1849aef80f 100644 --- a/src/tools/qlalr/recognizer.h +++ b/src/tools/qlalr/recognizer.h @@ -63,7 +63,7 @@ protected: // scanner { ch = *_M_currentChar++; - if (ch == QLatin1Char('\n')) + if (ch == u'\n') ++_M_line; } else diff --git a/src/tools/qvkgen/qvkgen.cpp b/src/tools/qvkgen/qvkgen.cpp index 9470b748f3..3a143456e0 100644 --- a/src/tools/qvkgen/qvkgen.cpp +++ b/src/tools/qvkgen/qvkgen.cpp @@ -235,11 +235,11 @@ VkSpecParser::TypedName VkSpecParser::parseParamOrProto(const QString &tag) } else { auto text = m_reader.text().trimmed(); if (!text.isEmpty()) { - if (text.startsWith(QLatin1Char('['))) { + if (text.startsWith(u'[')) { t.typeSuffix += text; } else { if (!t.type.isEmpty()) - t.type += QLatin1Char(' '); + t.type += u' '; t.type += text; } } @@ -267,7 +267,7 @@ QString funcSig(const VkSpecParser::Command &c, const char *className = nullptr) (className ? className : ""), (className ? "::" : ""), qPrintable(c.cmd.name))); if (!c.args.isEmpty()) { - s += QLatin1Char('('); + s += u'('; bool first = true; for (const VkSpecParser::TypedName &a : c.args) { if (!first) @@ -275,10 +275,10 @@ QString funcSig(const VkSpecParser::Command &c, const char *className = nullptr) else first = false; s += QString::asprintf("%s%s%s%s", qPrintable(a.type), - (a.type.endsWith(QLatin1Char('*')) ? "" : " "), + (a.type.endsWith(u'*') ? "" : " "), qPrintable(a.name), qPrintable(a.typeSuffix)); } - s += QLatin1Char(')'); + s += u')'; } return s; } @@ -292,7 +292,7 @@ QString funcCall(const VkSpecParser::Command &c, int idx) qPrintable(c.cmd.name), idx); if (!c.args.isEmpty()) { - s += QLatin1Char('('); + s += u'('; bool first = true; for (const VkSpecParser::TypedName &a : c.args) { if (!first) @@ -301,7 +301,7 @@ QString funcCall(const VkSpecParser::Command &c, int idx) first = false; s += a.name; } - s += QLatin1Char(')'); + s += u')'; } return s; } 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(); diff --git a/src/tools/tracegen/etw.cpp b/src/tools/tracegen/etw.cpp index 8b0b7bf888..7363236c5f 100644 --- a/src/tools/tracegen/etw.cpp +++ b/src/tools/tracegen/etw.cpp @@ -146,7 +146,7 @@ static void writePrologue(QTextStream &stream, const QString &fileName, const Pr stream << "\n"; if (!provider.prefixText.isEmpty()) - stream << provider.prefixText.join(QLatin1Char('\n')) << "\n\n"; + stream << provider.prefixText.join(u'\n') << "\n\n"; stream << "#ifdef TRACEPOINT_DEFINE\n" << "/* " << guidString << " */\n" diff --git a/src/tools/tracegen/helpers.cpp b/src/tools/tracegen/helpers.cpp index 8ffc088fed..aa34f81b75 100644 --- a/src/tools/tracegen/helpers.cpp +++ b/src/tools/tracegen/helpers.cpp @@ -46,7 +46,7 @@ QString includeGuard(const QString &filename) for (int i = 0; i < guard.size(); ++i) { if (!guard.at(i).isLetterOrNumber()) - guard[i] = QLatin1Char('_'); + guard[i] = u'_'; } return guard; diff --git a/src/tools/tracegen/lttng.cpp b/src/tools/tracegen/lttng.cpp index 9a8dfc9f4a..2d87c5c6dc 100644 --- a/src/tools/tracegen/lttng.cpp +++ b/src/tools/tracegen/lttng.cpp @@ -117,7 +117,7 @@ static void writePrologue(QTextStream &stream, const QString &fileName, const Pr stream << qtHeaders(); stream << "\n"; if (!provider.prefixText.isEmpty()) - stream << provider.prefixText.join(QLatin1Char('\n')) << "\n\n"; + stream << provider.prefixText.join(u'\n') << "\n\n"; stream << "#endif\n\n"; /* the first guard is the usual one, the second is required diff --git a/src/tools/tracegen/provider.cpp b/src/tools/tracegen/provider.cpp index 7984fa12a7..7e40d7de0e 100644 --- a/src/tools/tracegen/provider.cpp +++ b/src/tools/tracegen/provider.cpp @@ -190,7 +190,7 @@ static Tracepoint::Field::BackendType backendType(QString rawType) static const QRegularExpression constMatch(QStringLiteral("\\bconst\\b")); rawType.remove(constMatch); - rawType.remove(QLatin1Char('&')); + rawType.remove(u'&'); static const QRegularExpression ptrMatch(QStringLiteral("\\s*\\*\\s*")); rawType.replace(ptrMatch, QStringLiteral("_ptr")); @@ -291,14 +291,14 @@ Provider parseProvider(const QString &filename) continue; } - if (line.isEmpty() || line.startsWith(QLatin1Char('#'))) + if (line.isEmpty() || line.startsWith(u'#')) continue; auto match = tracedef.match(line); if (match.hasMatch()) { const QString name = match.captured(1); const QString argsString = match.captured(2); - const QStringList args = argsString.split(QLatin1Char(','), Qt::SkipEmptyParts); + const QStringList args = argsString.split(u',', Qt::SkipEmptyParts); provider.tracepoints << parseTracepoint(name, args, filename, lineNumber); } else { diff --git a/src/tools/windeployqt/main.cpp b/src/tools/windeployqt/main.cpp index 27b57ea9ad..9cf7ff9aa1 100644 --- a/src/tools/windeployqt/main.cpp +++ b/src/tools/windeployqt/main.cpp @@ -291,8 +291,7 @@ static inline QString findBinary(const QString &directory, Platform platform) static QString msgFileDoesNotExist(const QString & file) { - return QLatin1Char('"') + QDir::toNativeSeparators(file) - + QStringLiteral("\" does not exist."); + return u'"' + QDir::toNativeSeparators(file) + QStringLiteral("\" does not exist."); } enum CommandLineParseFlag { @@ -483,7 +482,7 @@ static inline int parseArguments(const QStringList &arguments, QCommandLineParse options->libraries = !parser->isSet(noLibraryOption); options->translations = !parser->isSet(noTranslationOption); if (parser->isSet(translationOption)) - options->languages = parser->value(translationOption).split(QLatin1Char(',')); + options->languages = parser->value(translationOption).split(u','); options->systemD3dCompiler = !parser->isSet(noSystemD3DCompilerOption); options->quickImports = !parser->isSet(noQuickImportOption); @@ -609,7 +608,7 @@ static inline int parseArguments(const QStringList &arguments, QCommandLineParse } if (!fi.isExecutable()) { - *errorMessage = QLatin1Char('"') + QDir::toNativeSeparators(qtpathsBinary) + *errorMessage = u'"' + QDir::toNativeSeparators(qtpathsBinary) + QStringLiteral("\" is not an executable."); return CommandLineParseError; } @@ -630,7 +629,7 @@ static inline int parseArguments(const QStringList &arguments, QCommandLineParse } if (!options->directory.isEmpty() && !fi.isFile()) { // -dir was specified - expecting file. - *errorMessage = QLatin1Char('"') + file + QStringLiteral("\" is not an executable file."); + *errorMessage = u'"' + file + QStringLiteral("\" is not an executable file."); return CommandLineParseError; } @@ -641,7 +640,7 @@ static inline int parseArguments(const QStringList &arguments, QCommandLineParse } else { const QString binary = findBinary(fi.absoluteFilePath(), options->platform); if (binary.isEmpty()) { - *errorMessage = QStringLiteral("Unable to find binary in \"") + file + QLatin1Char('"'); + *errorMessage = QStringLiteral("Unable to find binary in \"") + file + u'"'; return CommandLineParseError; } options->directory = fi.absoluteFilePath(); @@ -660,7 +659,7 @@ static inline int parseArguments(const QStringList &arguments, QCommandLineParse const QStringList libraries = findSharedLibraries(QDir(path), options->platform, MatchDebugOrRelease, QString()); for (const QString &library : libraries) - options->binaries.append(path + QLatin1Char('/') + library); + options->binaries.append(path + u'/' + library); } else { options->binaries.append(path); } @@ -672,10 +671,10 @@ static inline int parseArguments(const QStringList &arguments, QCommandLineParse // Simple line wrapping at 80 character boundaries. static inline QString lineBreak(QString s) { - for (int i = 80; i < s.size(); i += 80) { - const int lastBlank = s.lastIndexOf(QLatin1Char(' '), i); + for (qsizetype i = 80; i < s.size(); i += 80) { + const qsizetype lastBlank = s.lastIndexOf(u' ', i); if (lastBlank >= 0) { - s[lastBlank] = QLatin1Char('\n'); + s[lastBlank] = u'\n'; i = lastBlank + 1; } } @@ -695,7 +694,7 @@ static inline QString helpText(const QCommandLineParser &p) "\n\nQt libraries can be added by passing their name (-xml) or removed by passing\n" "the name prepended by --no- (--no-xml). Available libraries:\n"); moduleHelp += lineBreak(QString::fromLatin1(formatQtModules(0xFFFFFFFFFFFFFFFFull, true))); - moduleHelp += QLatin1Char('\n'); + moduleHelp += u'\n'; result.replace(moduleStart, argumentsStart - moduleStart, moduleHelp); return result; } @@ -729,7 +728,7 @@ static bool findDependentQtLibraries(const QString &qtBinDir, const QString &bin const int start = result->size(); for (const QString &lib : qAsConst(dependentLibs)) { if (isQtModule(lib)) { - const QString path = normalizeFileName(qtBinDir + QLatin1Char('/') + QFileInfo(lib).fileName()); + const QString path = normalizeFileName(qtBinDir + u'/' + QFileInfo(lib).fileName()); if (!result->contains(path)) result->append(path); } @@ -764,7 +763,7 @@ private: static QString pdbFileName(QString libraryFileName) { - const int lastDot = libraryFileName.lastIndexOf(QLatin1Char('.')) + 1; + const qsizetype lastDot = libraryFileName.lastIndexOf(u'.') + 1; if (lastDot <= 0) return QString(); libraryFileName.replace(lastDot, libraryFileName.size() - lastDot, QLatin1String("pdb")); @@ -881,14 +880,14 @@ static inline quint64 qtModuleForPlugin(const QString &subDirName) static quint64 qtModule(QString module, const QString &infix) { // Match needle 'path/Qt6Core<infix><d>.dll' or 'path/libQt6Core<infix>.so.5.0' - const int lastSlashPos = module.lastIndexOf(QLatin1Char('/')); + const qsizetype lastSlashPos = module.lastIndexOf(u'/'); if (lastSlashPos > 0) module.remove(0, lastSlashPos + 1); if (module.startsWith(QLatin1String("lib"))) module.remove(0, 3); int endPos = infix.isEmpty() ? -1 : module.lastIndexOf(infix); if (endPos == -1) - endPos = module.indexOf(QLatin1Char('.')); // strip suffixes '.so.5.0'. + endPos = module.indexOf(u'.'); // strip suffixes '.so.5.0'. if (endPos > 0) module.truncate(endPos); // That should leave us with 'Qt6Core<d>'. @@ -990,7 +989,7 @@ static QStringList translationNameFilters(quint64 modules, const QString &prefix for (const auto &qtModule : qtModuleEntries) { if ((qtModule.module & modules) && qtModule.translation) { const QString name = QLatin1String(qtModule.translation) + - QLatin1Char('_') + prefix + QStringLiteral(".qm"); + u'_' + prefix + QStringLiteral(".qm"); if (!result.contains(name)) result.push_back(name); } @@ -1026,9 +1025,9 @@ static bool deployTranslations(const QString &sourcePath, quint64 usedQtModules, arguments.clear(); const QString targetFile = QStringLiteral("qt_") + prefix + QStringLiteral(".qm"); arguments.append(QStringLiteral("-o")); - const QString targetFilePath = absoluteTarget + QLatin1Char('/') + targetFile; + const QString targetFilePath = absoluteTarget + u'/' + targetFile; if (options.json) - options.json->addFile(sourcePath + QLatin1Char('/') + targetFile, absoluteTarget); + options.json->addFile(sourcePath + u'/' + targetFile, absoluteTarget); arguments.append(QDir::toNativeSeparators(targetFilePath)); const QFileInfoList &langQmFiles = sourceDir.entryInfoList(translationNameFilters(usedQtModules, prefix)); for (const QFileInfo &langQmFileFi : langQmFiles) { @@ -1064,12 +1063,12 @@ struct DeployResult static QString libraryPath(const QString &libraryLocation, const char *name, const QString &qtLibInfix, Platform platform, bool debug) { - QString result = libraryLocation + QLatin1Char('/'); + QString result = libraryLocation + u'/'; if (platform & WindowsBased) { result += QLatin1String(name); result += qtLibInfix; if (debug && platformHasDebugSuffix(platform)) - result += QLatin1Char('d'); + result += u'd'; } else if (platform.testFlag(UnixBased)) { result += QStringLiteral("lib"); result += QLatin1String(name); @@ -1084,7 +1083,7 @@ static QString vcDebugRedistDir() { return QStringLiteral("Debug_NonRedist"); } static QString vcRedistDir() { const char vcDirVar[] = "VCINSTALLDIR"; - const QChar slash(QLatin1Char('/')); + const QChar slash(u'/'); QString vcRedistDirName = QDir::cleanPath(QFile::decodeName(qgetenv(vcDirVar))); if (vcRedistDirName.isEmpty()) { std::wcerr << "Warning: Cannot find Visual Studio installation directory, " << vcDirVar @@ -1129,7 +1128,7 @@ static QStringList compilerRunTimeLibs(Platform platform, bool isDebug, unsigned } const QString binPath = QFileInfo(gcc).absolutePath(); QStringList filters; - const QString suffix = QLatin1Char('*') + sharedLibrarySuffix(platform); + const QString suffix = u'*' + sharedLibrarySuffix(platform); for (auto minGwRuntime : minGwRuntimes) filters.append(QLatin1String(minGwRuntime) + suffix); const QFileInfoList &dlls = QDir(binPath).entryInfoList(filters, QDir::Files); @@ -1159,11 +1158,11 @@ static QStringList compilerRunTimeLibs(Platform platform, bool isDebug, unsigned QString releaseRedistDir = vcRedistDirName; const QStringList countryCodes = vcRedistDir.entryList(QStringList(QStringLiteral("[0-9]*")), QDir::Dirs); if (!countryCodes.isEmpty()) // Pre MSVC2017 - releaseRedistDir += QLatin1Char('/') + countryCodes.constFirst(); - QFileInfo fi(releaseRedistDir + QLatin1Char('/') + QStringLiteral("vc_redist.") + releaseRedistDir += u'/' + countryCodes.constFirst(); + QFileInfo fi(releaseRedistDir + u'/' + QStringLiteral("vc_redist.") + machineArchString + QStringLiteral(".exe")); if (!fi.isFile()) { // Pre MSVC2017/15.5 - fi.setFile(releaseRedistDir + QLatin1Char('/') + QStringLiteral("vcredist_") + fi.setFile(releaseRedistDir + u'/' + QStringLiteral("vcredist_") + machineArchString + QStringLiteral(".exe")); } if (fi.isFile()) @@ -1187,7 +1186,7 @@ static QStringList compilerRunTimeLibs(Platform platform, bool isDebug, unsigned static inline int qtVersion(const QMap<QString, QString> &qtpathsVariables) { const QString versionString = qtpathsVariables.value(QStringLiteral("QT_VERSION")); - const QChar dot = QLatin1Char('.'); + const QChar dot = u'.'; const int majorVersion = versionString.section(dot, 0, 0).toInt(); const int minorVersion = versionString.section(dot, 1, 1).toInt(); const int patchVersion = versionString.section(dot, 2, 2).toInt(); @@ -1197,8 +1196,8 @@ static inline int qtVersion(const QMap<QString, QString> &qtpathsVariables) // Determine the Qt lib infix from the library path of "Qt6Core<qtblibinfix>[d].dll". static inline QString qtlibInfixFromCoreLibName(const QString &path, bool isDebug, Platform platform) { - const int startPos = path.lastIndexOf(QLatin1Char('/')) + 8; - int endPos = path.lastIndexOf(QLatin1Char('.')); + const qsizetype startPos = path.lastIndexOf(u'/') + 8; + qsizetype endPos = path.lastIndexOf(u'.'); if (isDebug && (platform & WindowsBased)) endPos--; return endPos > startPos ? path.mid(startPos, endPos - startPos) : QString(); @@ -1240,7 +1239,7 @@ static DeployResult deploy(const Options &options, const QMap<QString, QString> { DeployResult result; - const QChar slash = QLatin1Char('/'); + const QChar slash = u'/'; const QString qtBinDir = qtpathsVariables.value(QStringLiteral("QT_INSTALL_BINS")); const QString libraryLocation = options.platform == Unix @@ -1439,7 +1438,7 @@ static DeployResult deploy(const Options &options, const QMap<QString, QString> } if (optVerboseLevel > 1) - std::wcout << "Plugins: " << plugins.join(QLatin1Char(',')) << '\n'; + std::wcout << "Plugins: " << plugins.join(u',') << '\n'; if ((result.deployedQtLibraries & QtGuiModule) && platformPlugin.isEmpty()) { *errorMessage =QStringLiteral("Unable to find the platform plugin."); @@ -1480,7 +1479,7 @@ static DeployResult deploy(const Options &options, const QMap<QString, QString> const QString qt6CoreName = QFileInfo(libraryPath(libraryLocation, "Qt6Core", qtLibInfix, options.platform, result.isDebug)).fileName(); #ifndef QT_RELOCATABLE - if (!patchQtCore(targetPath + QLatin1Char('/') + qt6CoreName, errorMessage)) { + if (!patchQtCore(targetPath + u'/' + qt6CoreName, errorMessage)) { std::wcerr << "Warning: " << *errorMessage << '\n'; errorMessage->clear(); } @@ -1495,7 +1494,7 @@ static DeployResult deploy(const Options &options, const QMap<QString, QString> QDir dir(targetPath); if (!dir.exists() && !dir.mkpath(QStringLiteral("."))) { *errorMessage = QLatin1String("Cannot create ") + - QDir::toNativeSeparators(dir.absolutePath()) + QLatin1Char('.'); + QDir::toNativeSeparators(dir.absolutePath()) + u'.'; return result; } for (const QString &plugin : plugins) { @@ -1505,7 +1504,7 @@ static DeployResult deploy(const Options &options, const QMap<QString, QString> if (optVerboseLevel) std::wcout << "Creating directory " << targetPath << ".\n"; if (!(options.updateFileFlags & SkipUpdateFile) && !dir.mkdir(targetDirName)) { - *errorMessage = QStringLiteral("Cannot create ") + targetDirName + QLatin1Char('.'); + *errorMessage = QStringLiteral("Cannot create ") + targetDirName + u'.'; return result; } } @@ -1571,11 +1570,11 @@ static bool deployWebProcess(const QMap<QString, QString> &qtpathsVariables, con // Copy the web process and its dependencies const QString webProcess = webProcessBinary(binaryName, sourceOptions.platform); const QString webProcessSource = qtpathsVariables.value(QStringLiteral("QT_INSTALL_LIBEXECS")) - + QLatin1Char('/') + webProcess; + + u'/' + webProcess; if (!updateFile(webProcessSource, sourceOptions.directory, sourceOptions.updateFileFlags, sourceOptions.json, errorMessage)) return false; Options options(sourceOptions); - options.binaries.append(options.directory + QLatin1Char('/') + webProcess); + options.binaries.append(options.directory + u'/' + webProcess); options.quickImports = false; options.translations = false; return deploy(options, qtpathsVariables, errorMessage); @@ -1598,7 +1597,7 @@ static bool deployWebEngineCore(const QMap<QString, QString> &qtpathsVariables, return false; const QString resourcesSubDir = QStringLiteral("/resources"); const QString resourcesSourceDir = qtpathsVariables.value(QStringLiteral("QT_INSTALL_DATA")) - + resourcesSubDir + QLatin1Char('/'); + + resourcesSubDir + u'/'; const QString resourcesTargetDir(options.directory + resourcesSubDir); if (!createDirectory(resourcesTargetDir, errorMessage)) return false; @@ -1628,7 +1627,7 @@ static bool deployWebEngineCore(const QMap<QString, QString> &qtpathsVariables, << QDir::toNativeSeparators(enUSpak.absoluteFilePath()) << ".\n"; return true; } - const QString webEngineTranslationsDir = options.translationsDirectory + QLatin1Char('/') + const QString webEngineTranslationsDir = options.translationsDirectory + u'/' + translations.fileName(); if (!createDirectory(webEngineTranslationsDir, errorMessage)) return false; diff --git a/src/tools/windeployqt/qmlutils.cpp b/src/tools/windeployqt/qmlutils.cpp index 6eebf6d86e..f51462b2df 100644 --- a/src/tools/windeployqt/qmlutils.cpp +++ b/src/tools/windeployqt/qmlutils.cpp @@ -48,9 +48,9 @@ bool operator==(const QmlImportScanResult::Module &m1, const QmlImportScanResult QString QmlImportScanResult::Module::installPath(const QString &root) const { QString result = root; - const int lastSlashPos = relativePath.lastIndexOf(QLatin1Char('/')); + const qsizetype lastSlashPos = relativePath.lastIndexOf(u'/'); if (lastSlashPos != -1) { - result += QLatin1Char('/'); + result += u'/'; result += QStringView{relativePath}.left(lastSlashPos); } return result; @@ -121,7 +121,7 @@ QmlImportScanResult runQmlImportScanner(const QString &directory, const QStringL if (data.isNull() ) { *errorMessage = binary + QStringLiteral(" returned invalid JSON output: ") + jsonParseError.errorString() + QStringLiteral(" :\"") - + QString::fromLocal8Bit(stdOut) + QLatin1Char('"'); + + QString::fromLocal8Bit(stdOut) + u'"'; return result; } const QJsonArray array = data.array(); diff --git a/src/tools/windeployqt/utils.cpp b/src/tools/windeployqt/utils.cpp index bc52de924e..9dfff9dbd0 100644 --- a/src/tools/windeployqt/utils.cpp +++ b/src/tools/windeployqt/utils.cpp @@ -112,9 +112,9 @@ QStringList findSharedLibraries(const QDir &directory, Platform platform, { QString nameFilter = prefix; if (nameFilter.isEmpty()) - nameFilter += QLatin1Char('*'); + nameFilter += u'*'; if (debugMatchMode == MatchDebug && platformHasDebugSuffix(platform)) - nameFilter += QLatin1Char('d'); + nameFilter += u'd'; nameFilter += sharedLibrarySuffix(platform); QStringList result; QString errorMessage; @@ -172,7 +172,7 @@ QString normalizeFileName(const QString &name) // Find a tool binary in the Windows SDK 8 QString findSdkTool(const QString &tool) { - QStringList paths = QString::fromLocal8Bit(qgetenv("PATH")).split(QLatin1Char(';')); + QStringList paths = QString::fromLocal8Bit(qgetenv("PATH")).split(u';'); const QByteArray sdkDir = qgetenv("WindowsSdkDir"); if (!sdkDir.isEmpty()) paths.prepend(QDir::cleanPath(QString::fromLocal8Bit(sdkDir)) + QLatin1String("/Tools/x64")); @@ -212,14 +212,14 @@ static inline void readTemporaryProcessFile(HANDLE handle, QByteArray *result) static inline void appendToCommandLine(const QString &argument, QString *commandLine) { - const bool needsQuote = argument.contains(QLatin1Char(' ')); + const bool needsQuote = argument.contains(u' '); if (!commandLine->isEmpty()) - commandLine->append(QLatin1Char(' ')); + commandLine->append(u' '); if (needsQuote) - commandLine->append(QLatin1Char('"')); + commandLine->append(u'"'); commandLine->append(argument); if (needsQuote) - commandLine->append(QLatin1Char('"')); + commandLine->append(u'"'); } // runProcess: Run a command line process (replacement for QProcess which @@ -244,7 +244,7 @@ bool runProcess(const QString &binary, const QStringList &args, PROCESS_INFORMATION pi; ZeroMemory(&pi, sizeof(PROCESS_INFORMATION)); - const QChar backSlash = QLatin1Char('\\'); + const QChar backSlash = u'\\'; QString nativeWorkingDir = QDir::toNativeSeparators(workingDirectory.isEmpty() ? QDir::currentPath() : workingDirectory); if (!nativeWorkingDir.endsWith(backSlash)) nativeWorkingDir += backSlash; @@ -317,8 +317,8 @@ static inline char *encodeFileName(const QString &f) static inline char *tempFilePattern() { QString path = QDir::tempPath(); - if (!path.endsWith(QLatin1Char('/'))) - path += QLatin1Char('/'); + if (!path.endsWith(u'/')) + path += u'/'; path += QStringLiteral("tmpXXXXXX"); return encodeFileName(path); } @@ -468,14 +468,14 @@ QMap<QString, QString> queryQtPaths(const QString &qtpathsBinary, QString *error + QStringLiteral(": ") + QString::fromLocal8Bit(stdErr); return QMap<QString, QString>(); } - const QString output = QString::fromLocal8Bit(stdOut).trimmed().remove(QLatin1Char('\r')); + const QString output = QString::fromLocal8Bit(stdOut).trimmed().remove(u'\r'); QMap<QString, QString> result; - const int size = output.size(); - for (int pos = 0; pos < size; ) { - const int colonPos = output.indexOf(QLatin1Char(':'), pos); + const qsizetype size = output.size(); + for (qsizetype pos = 0; pos < size; ) { + const qsizetype colonPos = output.indexOf(u':', pos); if (colonPos < 0) break; - int endPos = output.indexOf(QLatin1Char('\n'), colonPos + 1); + qsizetype endPos = output.indexOf(u'\n', colonPos + 1); if (endPos < 0) endPos = size; const QString key = output.mid(pos, colonPos - pos); @@ -511,7 +511,7 @@ bool updateFile(const QString &sourceFileName, const QStringList &nameFilters, const QString &targetDirectory, unsigned flags, JsonOutput *json, QString *errorMessage) { const QFileInfo sourceFileInfo(sourceFileName); - const QString targetFileName = targetDirectory + QLatin1Char('/') + sourceFileInfo.fileName(); + const QString targetFileName = targetDirectory + u'/' + sourceFileInfo.fileName(); if (optVerboseLevel > 1) std::wcout << "Checking " << sourceFileName << ", " << targetFileName<< '\n'; @@ -736,21 +736,19 @@ enum MsvcDebugRuntimeResult { MsvcDebugRuntime, MsvcReleaseRuntime, NoMsvcRuntim static inline MsvcDebugRuntimeResult checkMsvcDebugRuntime(const QStringList &dependentLibraries) { for (const QString &lib : dependentLibraries) { - int pos = 0; + qsizetype pos = 0; if (lib.startsWith(QLatin1String("MSVCR"), Qt::CaseInsensitive) || lib.startsWith(QLatin1String("MSVCP"), Qt::CaseInsensitive) || lib.startsWith(QLatin1String("VCRUNTIME"), Qt::CaseInsensitive)) { - int lastDotPos = lib.lastIndexOf(QLatin1Char('.')); + qsizetype lastDotPos = lib.lastIndexOf(u'.'); pos = -1 == lastDotPos ? 0 : lastDotPos - 1; } if (pos > 0 && lib.contains(QLatin1String("_app"), Qt::CaseInsensitive)) pos -= 4; - if (pos) { - return lib.at(pos).toLower() == QLatin1Char('d') - ? MsvcDebugRuntime : MsvcReleaseRuntime; - } + if (pos) + return lib.at(pos).toLower() == u'd' ? MsvcDebugRuntime : MsvcReleaseRuntime; } return NoMsvcRuntime; } @@ -846,7 +844,7 @@ bool readPeExecutable(const QString &peExecutableFileName, QString *errorMessage if (dependentLibrariesIn) { std::wcout << ", dependent libraries: "; if (optVerboseLevel > 2) - std::wcout << dependentLibrariesIn->join(QLatin1Char(' ')); + std::wcout << dependentLibrariesIn->join(u' '); else std::wcout << dependentLibrariesIn->size(); } @@ -883,7 +881,7 @@ QString findD3dCompiler(Platform platform, const QString &qtBinDir, unsigned wor } QDir redistDir(redistDirPath); if (redistDir.exists()) { - const QFileInfoList files = redistDir.entryInfoList(QStringList(prefix + QLatin1Char('*') + suffix), QDir::Files); + const QFileInfoList files = redistDir.entryInfoList(QStringList(prefix + u'*' + suffix), QDir::Files); if (!files.isEmpty()) return files.front().absoluteFilePath(); } @@ -894,7 +892,7 @@ QString findD3dCompiler(Platform platform, const QString &qtBinDir, unsigned wor // Check the bin directory of the Qt SDK (in case it is shadowed by the // Windows system directory in PATH). for (const QString &candidate : qAsConst(candidateVersions)) { - const QFileInfo fi(qtBinDir + QLatin1Char('/') + candidate); + const QFileInfo fi(qtBinDir + u'/' + candidate); if (fi.isFile()) return fi.absoluteFilePath(); } diff --git a/src/tools/windeployqt/utils.h b/src/tools/windeployqt/utils.h index 0fe3a6948f..94c0093455 100644 --- a/src/tools/windeployqt/utils.h +++ b/src/tools/windeployqt/utils.h @@ -249,7 +249,7 @@ bool updateFile(const QString &sourceFileName, QString *errorMessage) { const QFileInfo sourceFileInfo(sourceFileName); - const QString targetFileName = targetDirectory + QLatin1Char('/') + sourceFileInfo.fileName(); + const QString targetFileName = targetDirectory + u'/' + sourceFileInfo.fileName(); if (optVerboseLevel > 1) std::wcout << "Checking " << sourceFileName << ", " << targetFileName << '\n'; @@ -263,7 +263,7 @@ bool updateFile(const QString &sourceFileName, if (sourceFileInfo.isSymLink()) { const QString sourcePath = sourceFileInfo.symLinkTarget(); const QString relativeSource = QDir(sourceFileInfo.absolutePath()).relativeFilePath(sourcePath); - if (relativeSource.contains(QLatin1Char('/'))) { + if (relativeSource.contains(u'/')) { *errorMessage = QString::fromLatin1("Symbolic links across directories are not supported (%1).") .arg(QDir::toNativeSeparators(sourceFileName)); return false; @@ -289,7 +289,7 @@ bool updateFile(const QString &sourceFileName, return false; } } // target symbolic link exists - return createSymbolicLink(QFileInfo(targetDirectory + QLatin1Char('/') + relativeSource), sourceFileInfo.fileName(), errorMessage); + return createSymbolicLink(QFileInfo(targetDirectory + u'/' + relativeSource), sourceFileInfo.fileName(), errorMessage); } // Source is symbolic link if (sourceFileInfo.isDir()) { @@ -323,7 +323,7 @@ bool updateFile(const QString &sourceFileName, const QStringList allEntries = directoryFileEntryFunction(dir) + dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot); for (const QString &entry : allEntries) - if (!updateFile(sourceFileName + QLatin1Char('/') + entry, directoryFileEntryFunction, targetFileName, flags, json, errorMessage)) + if (!updateFile(sourceFileName + u'/' + entry, directoryFileEntryFunction, targetFileName, flags, json, errorMessage)) return false; // Remove empty directories, for example QML import folders for which the filter did not match. if (created && (flags & RemoveEmptyQmlDirectories)) { |