diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp index d25dd05bac..74270bba5c 100644 --- a/src/BufferParams.cpp +++ b/src/BufferParams.cpp @@ -1979,6 +1979,8 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features, if (!features.runparams().includeall && !included_children_.empty()) { os << "\\includeonly{"; bool first = true; + // we do not use "auto const &" here, because incfile is modified later + // coverity[auto_causes_copy] for (auto incfile : included_children_) { FileName inc = makeAbsPath(incfile, filepath.absFileName()); string mangled = DocFileName(changeExtension(inc.absFileName(), ".tex")). diff --git a/src/frontends/qt/GuiApplication.cpp b/src/frontends/qt/GuiApplication.cpp index 127a847944..ff33065fe3 100644 --- a/src/frontends/qt/GuiApplication.cpp +++ b/src/frontends/qt/GuiApplication.cpp @@ -556,7 +556,7 @@ QString getAlias(QString name) { has_aliases = true; } // check for the following aliases - for (auto alias : aliases) { + for (auto const & alias : aliases) { if (name.contains(alias.first)) name.replace(alias.first, alias.second); } diff --git a/src/insets/InsetInfo.cpp b/src/insets/InsetInfo.cpp index 67aca81fe7..ed2566eadb 100644 --- a/src/insets/InsetInfo.cpp +++ b/src/insets/InsetInfo.cpp @@ -159,6 +159,8 @@ set getTexFileList(string const & filename) getVectorFromString(file.fileContents("UTF-8"), from_ascii("\n")); // Normalise paths like /foo//bar ==> /foo/bar + // No "auto const &" because doc is modified later + // coverity[auto_causes_copy] for (auto doc : doclist) { doc = subst(doc, from_ascii("\r"), docstring()); while (contains(doc, from_ascii("//"))) diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp index bce889b773..c8fc40947e 100644 --- a/src/lyxfind.cpp +++ b/src/lyxfind.cpp @@ -2424,7 +2424,7 @@ void LatexInfo::buildEntries(bool isPatternString) } // Ignore language if there is math somewhere in pattern-string if (isPatternString) { - for (auto s: usedText) { + for (auto const & s: usedText) { // Remove entries created in previous search runs keys.erase(s); } diff --git a/src/support/os.cpp b/src/support/os.cpp index 6561fbca38..407e1de4fc 100644 --- a/src/support/os.cpp +++ b/src/support/os.cpp @@ -111,13 +111,13 @@ static string const find_python_binary() // but we are trying hard to find a valid python binary vector const path = getEnvPath("PATH"); lyxerr << "Looking for python 3.x ...\n"; - for (auto bin : path) { + for (auto const & bin : path) { QString const dir = toqstr(bin); string const localdir = dir.toLocal8Bit().constData(); QDir qdir(dir); qdir.setFilter(QDir::Files | QDir::Executable); QStringList list = qdir.entryList(QStringList("python3*")); - for (auto bin2 : list) { + for (auto const & bin2 : list) { string const binary = "\"" + addName(localdir, bin2.toLocal8Bit().constData()) + "\""; command = python23_call(binary, true); @@ -155,13 +155,13 @@ static string const find_python_binary() QString const exeName = "python2*"; #endif // _WIN32 - for (auto bin : path) { + for (auto const & bin : path) { QString const dir = toqstr(bin); string const localdir = dir.toLocal8Bit().constData(); QDir qdir(dir); qdir.setFilter(QDir::Files | QDir::Executable); QStringList list = qdir.entryList(QStringList(exeName)); - for (auto bin2 : list) { + for (auto const & bin2 : list) { string const binary = "\"" + addName(localdir, bin2.toLocal8Bit().constData()) + "\""; command = python23_call(binary, true);