Commit 59de1b1d authored by Stephan Seitz's avatar Stephan Seitz Committed by Alexander Semke
Browse files

Fix warnings about creating a copy in range loops [-Wrange-loop-construct]

```
./src/backends/scilab/scilabexpression.cpp:89:24: warning: loop variable 'line' creates a copy from type 'const QString' [-Wrange-loop-construct]
    for (const QString line : lines)
                       ^
../src/backends/scilab/scilabexpression.cpp:89:10: note: use reference type 'const QString &' to prevent copying
    for (const QString line : lines)
         ^~~~~~~~~~~~~~~~~~~~
                       &
1 warning generated.
```
parent d700f7be
......@@ -61,7 +61,7 @@ void MaximaCompletionObject::fetchCompletions()
const QString prefix = command();
QStringList prefixCompletion;
for (const QString str : allCompletions)
for (const QString& str : allCompletions)
if (str.startsWith(prefix))
prefixCompletion << str;
......
......@@ -175,7 +175,7 @@ string PythonServer::variables(bool parseValue) const
#elif PY_MAJOR_VERSION == 2
"except ImportError: \n"
#endif
" pass \n", NULL
" pass \n", nullptr
);
PyRun_SimpleString("__tmp_globals__ = globals()");
......@@ -220,7 +220,7 @@ string PythonServer::variables(bool parseValue) const
#elif PY_MAJOR_VERSION == 2
"except ImportError: \n"
#endif
" pass \n", NULL
" pass \n", nullptr
);
......
......@@ -86,7 +86,7 @@ void ScilabExpression::parseOutput(QString output)
qDebug() << "output: " << output;
const QStringList lines = output.split(QLatin1String("\n"));
bool isPrefixLines = true;
for (const QString line : lines)
for (const QString& line : lines)
{
if (isPrefixLines && line.isEmpty())
continue;
......
......@@ -201,7 +201,7 @@ void DefaultVariableModel::clearVariables()
beginResetModel();
QStringList names;
for (const Variable var: d->variables)
for (const Variable& var: d->variables)
names.append(var.name);
d->variables.clear();
......@@ -251,7 +251,7 @@ void DefaultVariableModel::setVariables(const QList<DefaultVariableModel::Variab
// Handle added vars
const int size = d->variables.size();
for (const Variable newvar : newVars)
for (const Variable& newvar : newVars)
{
bool found = false;
for (int i = 0; i < size; i++)
......@@ -337,7 +337,7 @@ QStringList DefaultVariableModel::variableNames() const
{
Q_D(const DefaultVariableModel);
QStringList names;
for (const Variable var: d->variables)
for (const Variable& var: d->variables)
names << var.name;
return names;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment