forked from qt-creator/qt-creator
Cppcheck: Quote file paths
This patch fixes the most common issues with path quoting. Fixes: QTCREATORBUG-28586 Change-Id: Ia5f400d062a2459f49288fcd4bc316ced2b269e6 Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
@@ -113,16 +113,17 @@ void CppcheckRunner::checkQueued()
|
||||
if (m_queue.isEmpty() || !m_binary.isExecutableFile())
|
||||
return;
|
||||
|
||||
CommandLine commandLine{m_binary, m_arguments, CommandLine::Raw};
|
||||
FilePaths files = m_queue.begin().value();
|
||||
QString arguments = m_arguments + ' ' + m_queue.begin().key();
|
||||
commandLine.addArg(m_queue.begin().key());
|
||||
m_currentFiles.clear();
|
||||
int argumentsLength = arguments.length();
|
||||
int argumentsLength = commandLine.arguments().length();
|
||||
while (!files.isEmpty()) {
|
||||
argumentsLength += files.first().toString().size() + 1; // +1 for separator
|
||||
argumentsLength += files.first().toString().size() + 3; // +1 for separator +2 for quotes
|
||||
if (argumentsLength >= m_maxArgumentsLength)
|
||||
break;
|
||||
m_currentFiles.push_back(files.first());
|
||||
arguments += ' ' + files.first().toString();
|
||||
commandLine.addArg(files.first().toString());
|
||||
files.pop_front();
|
||||
}
|
||||
|
||||
@@ -131,7 +132,7 @@ void CppcheckRunner::checkQueued()
|
||||
else
|
||||
m_queue.begin().value() = files;
|
||||
|
||||
m_process.setCommand({m_binary, arguments, CommandLine::Raw});
|
||||
m_process.setCommand(commandLine);
|
||||
m_process.start();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user