forked from qt-creator/qt-creator
Fix various warnings
Change-Id: Iea85f4b890ce7700e8b3632de4656cf848729a36 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -227,8 +227,8 @@ public:
|
||||
virtual void setWorkingDirectory(const QString &dir) = 0;
|
||||
virtual void start(const QString &program, const QStringList &arguments,
|
||||
const QByteArray &writeData) = 0;
|
||||
virtual void customStart(const CommandLine &command, const FilePath &workingDirectory,
|
||||
const Environment &environment) { QTC_CHECK(false); }
|
||||
virtual void customStart(const CommandLine &, const FilePath &workingDirectory,
|
||||
const Environment &) { Q_UNUSED(workingDirectory); QTC_CHECK(false); }
|
||||
virtual bool isCustomStart() const { return false; }
|
||||
virtual void terminate() = 0;
|
||||
virtual void kill() = 0;
|
||||
@@ -316,9 +316,9 @@ public:
|
||||
QByteArray readAllStandardOutput() override { QTC_CHECK(false); return {}; }
|
||||
QByteArray readAllStandardError() override { QTC_CHECK(false); return {}; }
|
||||
|
||||
void setProcessEnvironment(const QProcessEnvironment &environment) override { QTC_CHECK(false); }
|
||||
void setWorkingDirectory(const QString &dir) override { QTC_CHECK(false); }
|
||||
void start(const QString &program, const QStringList &arguments, const QByteArray &writeData) override
|
||||
void setProcessEnvironment(const QProcessEnvironment &) override { QTC_CHECK(false); }
|
||||
void setWorkingDirectory(const QString &) override { QTC_CHECK(false); }
|
||||
void start(const QString &, const QStringList &, const QByteArray &) override
|
||||
{ QTC_CHECK(false); }
|
||||
void customStart(const CommandLine &command, const FilePath &workingDirectory,
|
||||
const Environment &environment) override
|
||||
@@ -334,7 +334,7 @@ public:
|
||||
void terminate() override { m_terminal.stopProcess(); }
|
||||
void kill() override { m_terminal.stopProcess(); }
|
||||
void close() override { m_terminal.stopProcess(); }
|
||||
qint64 write(const QByteArray &data) override { QTC_CHECK(false); return -1; }
|
||||
qint64 write(const QByteArray &) override { QTC_CHECK(false); return -1; }
|
||||
|
||||
void setStandardInputFile(const QString &fileName) override { Q_UNUSED(fileName) QTC_CHECK(false); }
|
||||
// intentionally no-op without an assert
|
||||
@@ -347,13 +347,13 @@ public:
|
||||
int exitCode() const override { return m_terminal.exitCode(); }
|
||||
QProcess::ExitStatus exitStatus() const override { return m_terminal.exitStatus(); }
|
||||
QString errorString() const override { return m_terminal.errorString(); }
|
||||
void setErrorString(const QString &str) override { QTC_CHECK(false); }
|
||||
void setErrorString(const QString &) override { QTC_CHECK(false); }
|
||||
|
||||
// intentionally no-op without an assert
|
||||
bool waitForStarted(int msecs) override { return false; }
|
||||
bool waitForReadyRead(int msecs) override { QTC_CHECK(false); return false; }
|
||||
bool waitForStarted(int) override { return false; }
|
||||
bool waitForReadyRead(int) override { QTC_CHECK(false); return false; }
|
||||
// intentionally no-op without an assert
|
||||
bool waitForFinished(int msecs) override { return false; }
|
||||
bool waitForFinished(int) override { return false; }
|
||||
|
||||
void kickoffProcess() override { m_terminal.kickoffProcess(); }
|
||||
void interruptProcess() override { m_terminal.interruptProcess(); }
|
||||
|
@@ -186,63 +186,6 @@ const CommandLine &TerminalProcess::commandLine() const
|
||||
return d->m_commandLine;
|
||||
}
|
||||
|
||||
static QString quoteWinCommand(const QString &program)
|
||||
{
|
||||
const QChar doubleQuote = QLatin1Char('"');
|
||||
|
||||
// add the program as the first arg ... it works better
|
||||
QString programName = program;
|
||||
programName.replace(QLatin1Char('/'), QLatin1Char('\\'));
|
||||
if (!programName.startsWith(doubleQuote) && !programName.endsWith(doubleQuote)
|
||||
&& programName.contains(QLatin1Char(' '))) {
|
||||
programName.prepend(doubleQuote);
|
||||
programName.append(doubleQuote);
|
||||
}
|
||||
return programName;
|
||||
}
|
||||
|
||||
static QString quoteWinArgument(const QString &arg)
|
||||
{
|
||||
if (arg.isEmpty())
|
||||
return QString::fromLatin1("\"\"");
|
||||
|
||||
QString ret(arg);
|
||||
// Quotes are escaped and their preceding backslashes are doubled.
|
||||
ret.replace(QRegularExpression("(\\\\*)\""), "\\1\\1\\\"");
|
||||
if (ret.contains(QRegularExpression("\\s"))) {
|
||||
// The argument must not end with a \ since this would be interpreted
|
||||
// as escaping the quote -- rather put the \ behind the quote: e.g.
|
||||
// rather use "foo"\ than "foo\"
|
||||
int i = ret.length();
|
||||
while (i > 0 && ret.at(i - 1) == QLatin1Char('\\'))
|
||||
--i;
|
||||
ret.insert(i, QLatin1Char('"'));
|
||||
ret.prepend(QLatin1Char('"'));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Quote a Windows command line correctly for the "CreateProcess" API
|
||||
static QString createWinCommandline(const QString &program, const QStringList &args)
|
||||
{
|
||||
QString programName = quoteWinCommand(program);
|
||||
for (const QString &arg : args) {
|
||||
programName += QLatin1Char(' ');
|
||||
programName += quoteWinArgument(arg);
|
||||
}
|
||||
return programName;
|
||||
}
|
||||
|
||||
static QString createWinCommandline(const QString &program, const QString &args)
|
||||
{
|
||||
QString programName = quoteWinCommand(program);
|
||||
if (!args.isEmpty()) {
|
||||
programName += QLatin1Char(' ');
|
||||
programName += args;
|
||||
}
|
||||
return programName;
|
||||
}
|
||||
|
||||
void TerminalProcess::setAbortOnMetaChars(bool abort)
|
||||
{
|
||||
d->m_abortOnMetaChars = abort;
|
||||
@@ -334,15 +277,66 @@ void TerminalProcess::start()
|
||||
if (!workDir.isEmpty() && !workDir.endsWith(QLatin1Char('\\')))
|
||||
workDir.append(QLatin1Char('\\'));
|
||||
|
||||
// Quote a Windows command line correctly for the "CreateProcess" API
|
||||
static const auto quoteWinCommand = [](const QString &program) {
|
||||
const QChar doubleQuote = QLatin1Char('"');
|
||||
|
||||
// add the program as the first arg ... it works better
|
||||
QString programName = program;
|
||||
programName.replace(QLatin1Char('/'), QLatin1Char('\\'));
|
||||
if (!programName.startsWith(doubleQuote) && !programName.endsWith(doubleQuote)
|
||||
&& programName.contains(QLatin1Char(' '))) {
|
||||
programName.prepend(doubleQuote);
|
||||
programName.append(doubleQuote);
|
||||
}
|
||||
return programName;
|
||||
};
|
||||
static const auto quoteWinArgument = [](const QString &arg) {
|
||||
if (arg.isEmpty())
|
||||
return QString::fromLatin1("\"\"");
|
||||
|
||||
QString ret(arg);
|
||||
// Quotes are escaped and their preceding backslashes are doubled.
|
||||
ret.replace(QRegularExpression("(\\\\*)\""), "\\1\\1\\\"");
|
||||
if (ret.contains(QRegularExpression("\\s"))) {
|
||||
// The argument must not end with a \ since this would be interpreted
|
||||
// as escaping the quote -- rather put the \ behind the quote: e.g.
|
||||
// rather use "foo"\ than "foo\"
|
||||
int i = ret.length();
|
||||
while (i > 0 && ret.at(i - 1) == QLatin1Char('\\'))
|
||||
--i;
|
||||
ret.insert(i, QLatin1Char('"'));
|
||||
ret.prepend(QLatin1Char('"'));
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
static const auto createWinCommandlineMultiArgs = [](const QString &program, const QStringList &args) {
|
||||
QString programName = quoteWinCommand(program);
|
||||
for (const QString &arg : args) {
|
||||
programName += QLatin1Char(' ');
|
||||
programName += quoteWinArgument(arg);
|
||||
}
|
||||
return programName;
|
||||
};
|
||||
static const auto createWinCommandlineSingleArg = [](const QString &program, const QString &args)
|
||||
{
|
||||
QString programName = quoteWinCommand(program);
|
||||
if (!args.isEmpty()) {
|
||||
programName += QLatin1Char(' ');
|
||||
programName += args;
|
||||
}
|
||||
return programName;
|
||||
};
|
||||
|
||||
QStringList stubArgs;
|
||||
stubArgs << modeOption(d->m_terminalMode)
|
||||
<< d->m_stubServer.fullServerName()
|
||||
<< workDir
|
||||
<< (d->m_tempFile ? d->m_tempFile->fileName() : QString())
|
||||
<< createWinCommandline(pcmd, pargs)
|
||||
<< createWinCommandlineSingleArg(pcmd, pargs)
|
||||
<< msgPromptToClose();
|
||||
|
||||
const QString cmdLine = createWinCommandline(
|
||||
const QString cmdLine = createWinCommandlineMultiArgs(
|
||||
QCoreApplication::applicationDirPath() + QLatin1String("/qtcreator_process_stub.exe"), stubArgs);
|
||||
|
||||
bool success = CreateProcessW(0, (WCHAR*)cmdLine.utf16(),
|
||||
|
@@ -137,21 +137,6 @@ void FileUtils::showInFileSystemView(const FilePath &path)
|
||||
navWidget->syncWithFilePath(path);
|
||||
}
|
||||
|
||||
static QString quoteWinCommand(const QString &program)
|
||||
{
|
||||
const QChar doubleQuote = QLatin1Char('"');
|
||||
|
||||
// add the program as the first arg ... it works better
|
||||
QString programName = program;
|
||||
programName.replace(QLatin1Char('/'), QLatin1Char('\\'));
|
||||
if (!programName.startsWith(doubleQuote) && !programName.endsWith(doubleQuote)
|
||||
&& programName.contains(QLatin1Char(' '))) {
|
||||
programName.prepend(doubleQuote);
|
||||
programName.append(doubleQuote);
|
||||
}
|
||||
return programName;
|
||||
}
|
||||
|
||||
static void startTerminalEmulator(const QString &workingDir, const Environment &env)
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
@@ -162,6 +147,19 @@ static void startTerminalEmulator(const QString &workingDir, const Environment &
|
||||
PROCESS_INFORMATION pinfo;
|
||||
ZeroMemory(&pinfo, sizeof(pinfo));
|
||||
|
||||
static const auto quoteWinCommand = [](const QString &program) {
|
||||
const QChar doubleQuote = QLatin1Char('"');
|
||||
|
||||
// add the program as the first arg ... it works better
|
||||
QString programName = program;
|
||||
programName.replace(QLatin1Char('/'), QLatin1Char('\\'));
|
||||
if (!programName.startsWith(doubleQuote) && !programName.endsWith(doubleQuote)
|
||||
&& programName.contains(QLatin1Char(' '))) {
|
||||
programName.prepend(doubleQuote);
|
||||
programName.append(doubleQuote);
|
||||
}
|
||||
return programName;
|
||||
};
|
||||
const QString cmdLine = quoteWinCommand(QString::fromLocal8Bit(qgetenv("COMSPEC")));
|
||||
// cmdLine is assumed to be detached -
|
||||
// https://blogs.msdn.microsoft.com/oldnewthing/20090601-00/?p=18083
|
||||
|
@@ -112,7 +112,7 @@ void DeviceManager::replaceInstance()
|
||||
const QList<Id> newIds =
|
||||
Utils::transform(DeviceManagerPrivate::clonedInstance->d->devices, &IDevice::id);
|
||||
|
||||
for (const IDevice::ConstPtr &dev : qAsConst(m_instance->d->devices)) {
|
||||
for (const IDevice::Ptr &dev : qAsConst(m_instance->d->devices)) {
|
||||
if (!newIds.contains(dev->id()))
|
||||
dev->aboutToBeRemoved();
|
||||
}
|
||||
@@ -144,7 +144,7 @@ DeviceManager *DeviceManager::cloneInstance()
|
||||
void DeviceManager::copy(const DeviceManager *source, DeviceManager *target, bool deep)
|
||||
{
|
||||
if (deep) {
|
||||
for (const IDevice::ConstPtr &device : qAsConst(source->d->devices))
|
||||
for (const IDevice::Ptr &device : qAsConst(source->d->devices))
|
||||
target->d->devices << device->clone();
|
||||
} else {
|
||||
target->d->devices = source->d->devices;
|
||||
@@ -265,7 +265,7 @@ QVariantMap DeviceManager::toMap() const
|
||||
}
|
||||
map.insert(QLatin1String(DefaultDevicesKey), defaultDeviceMap);
|
||||
QVariantList deviceList;
|
||||
for (const IDevice::ConstPtr &device : qAsConst(d->devices))
|
||||
for (const IDevice::Ptr &device : qAsConst(d->devices))
|
||||
deviceList << device->toMap();
|
||||
map.insert(QLatin1String(DeviceListKey), deviceList);
|
||||
return map;
|
||||
@@ -276,7 +276,7 @@ void DeviceManager::addDevice(const IDevice::ConstPtr &_device)
|
||||
const IDevice::Ptr device = _device->clone();
|
||||
|
||||
QStringList names;
|
||||
for (const IDevice::ConstPtr &tmp : qAsConst(d->devices)) {
|
||||
for (const IDevice::Ptr &tmp : qAsConst(d->devices)) {
|
||||
if (tmp->id() != device->id())
|
||||
names << tmp->displayName();
|
||||
}
|
||||
@@ -366,7 +366,7 @@ bool DeviceManager::isLoaded() const
|
||||
IDevice::ConstPtr DeviceManager::deviceForPath(const FilePath &path)
|
||||
{
|
||||
const QList<IDevice::Ptr> devices = instance()->d->deviceList();
|
||||
for (const IDevice::ConstPtr &dev : devices) {
|
||||
for (const IDevice::Ptr &dev : devices) {
|
||||
// TODO: ensure handlesFile is thread safe
|
||||
if (dev->handlesFile(path))
|
||||
return dev;
|
||||
|
@@ -92,6 +92,8 @@ Edit3DWidget *Edit3DView::edit3DWidget() const
|
||||
|
||||
void Edit3DView::selectedNodesChanged(const QList<ModelNode> &selectedNodeList, const QList<ModelNode> &lastSelectedNodeList)
|
||||
{
|
||||
Q_UNUSED(selectedNodeList)
|
||||
Q_UNUSED(lastSelectedNodeList)
|
||||
SelectionContext selectionContext(this);
|
||||
selectionContext.setUpdateMode(SelectionContext::UpdateMode::Fast);
|
||||
if (m_alignCamerasAction)
|
||||
|
@@ -1348,7 +1348,7 @@ void TextToModelMerger::syncNode(ModelNode &modelNode,
|
||||
syncExpressionProperty(modelProperty, astValue, astType, differenceHandler);
|
||||
}
|
||||
modelPropertyNames.remove(astName.toUtf8());
|
||||
} else if (auto source = AST::cast<AST::UiSourceElement *>(member)) {
|
||||
} else if (AST::cast<AST::UiSourceElement *>(member)) {
|
||||
// function et al
|
||||
} else {
|
||||
qWarning() << "Found an unknown QML value.";
|
||||
|
@@ -201,7 +201,7 @@ public:
|
||||
{
|
||||
delete m_shell;
|
||||
m_shell = nullptr;
|
||||
DEBUG("Failed to connect to " << parameters.host());
|
||||
qCDebug(linuxDeviceLog) << "Failed to connect to" << parameters.host();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -440,7 +440,7 @@ bool LinuxDevice::handlesFile(const FilePath &filePath) const
|
||||
return filePath.scheme() == "ssh" && filePath.host() == userAtHost();
|
||||
}
|
||||
|
||||
void LinuxDevice::runProcess(QtcProcess &process) const
|
||||
void LinuxDevice::runProcess(QtcProcess &) const
|
||||
{
|
||||
QTC_CHECK(false); // FIXME: Implement
|
||||
}
|
||||
|
@@ -82,7 +82,7 @@ public:
|
||||
QByteArray fileContents(const Utils::FilePath &filePath, qint64 limit, qint64 offset) const override;
|
||||
bool writeFileContents(const Utils::FilePath &filePath, const QByteArray &data) const override;
|
||||
QDateTime lastModified(const Utils::FilePath &filePath) const override;
|
||||
void runProcess(Utils::QtcProcess &process) const override;
|
||||
void runProcess(Utils::QtcProcess &) const override;
|
||||
qint64 fileSize(const Utils::FilePath &filePath) const override;
|
||||
qint64 bytesAvailable(const Utils::FilePath &filePath) const override;
|
||||
QFileDevice::Permissions permissions(const Utils::FilePath &filePath) const override;
|
||||
|
Reference in New Issue
Block a user