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() ...@@ -61,7 +61,7 @@ void MaximaCompletionObject::fetchCompletions()
const QString prefix = command(); const QString prefix = command();
QStringList prefixCompletion; QStringList prefixCompletion;
for (const QString str : allCompletions) for (const QString& str : allCompletions)
if (str.startsWith(prefix)) if (str.startsWith(prefix))
prefixCompletion << str; prefixCompletion << str;
......
...@@ -175,7 +175,7 @@ string PythonServer::variables(bool parseValue) const ...@@ -175,7 +175,7 @@ string PythonServer::variables(bool parseValue) const
#elif PY_MAJOR_VERSION == 2 #elif PY_MAJOR_VERSION == 2
"except ImportError: \n" "except ImportError: \n"
#endif #endif
" pass \n", NULL " pass \n", nullptr
); );
PyRun_SimpleString("__tmp_globals__ = globals()"); PyRun_SimpleString("__tmp_globals__ = globals()");
...@@ -220,7 +220,7 @@ string PythonServer::variables(bool parseValue) const ...@@ -220,7 +220,7 @@ string PythonServer::variables(bool parseValue) const
#elif PY_MAJOR_VERSION == 2 #elif PY_MAJOR_VERSION == 2
"except ImportError: \n" "except ImportError: \n"
#endif #endif
" pass \n", NULL " pass \n", nullptr
); );
......
...@@ -86,7 +86,7 @@ void ScilabExpression::parseOutput(QString output) ...@@ -86,7 +86,7 @@ void ScilabExpression::parseOutput(QString output)
qDebug() << "output: " << output; qDebug() << "output: " << output;
const QStringList lines = output.split(QLatin1String("\n")); const QStringList lines = output.split(QLatin1String("\n"));
bool isPrefixLines = true; bool isPrefixLines = true;
for (const QString line : lines) for (const QString& line : lines)
{ {
if (isPrefixLines && line.isEmpty()) if (isPrefixLines && line.isEmpty())
continue; continue;
......
...@@ -201,7 +201,7 @@ void DefaultVariableModel::clearVariables() ...@@ -201,7 +201,7 @@ void DefaultVariableModel::clearVariables()
beginResetModel(); beginResetModel();
QStringList names; QStringList names;
for (const Variable var: d->variables) for (const Variable& var: d->variables)
names.append(var.name); names.append(var.name);
d->variables.clear(); d->variables.clear();
...@@ -251,7 +251,7 @@ void DefaultVariableModel::setVariables(const QList<DefaultVariableModel::Variab ...@@ -251,7 +251,7 @@ void DefaultVariableModel::setVariables(const QList<DefaultVariableModel::Variab
// Handle added vars // Handle added vars
const int size = d->variables.size(); const int size = d->variables.size();
for (const Variable newvar : newVars) for (const Variable& newvar : newVars)
{ {
bool found = false; bool found = false;
for (int i = 0; i < size; i++) for (int i = 0; i < size; i++)
...@@ -337,7 +337,7 @@ QStringList DefaultVariableModel::variableNames() const ...@@ -337,7 +337,7 @@ QStringList DefaultVariableModel::variableNames() const
{ {
Q_D(const DefaultVariableModel); Q_D(const DefaultVariableModel);
QStringList names; QStringList names;
for (const Variable var: d->variables) for (const Variable& var: d->variables)
names << var.name; names << var.name;
return names; 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