From a663b370f94e458e19813693561458740aba99f5 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Tue, 28 Apr 2020 13:27:50 +0200 Subject: [PATCH] Do not for copies in range-based for loops. Spotted by clang++ 10. --- src/HunspellChecker.cpp | 4 ++-- src/LaTeX.cpp | 2 +- src/tex2lyx/Preamble.cpp | 5 ++--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/HunspellChecker.cpp b/src/HunspellChecker.cpp index 593a123bf9..c211b47c85 100644 --- a/src/HunspellChecker.cpp +++ b/src/HunspellChecker.cpp @@ -424,7 +424,7 @@ void HunspellChecker::suggest(WordLangTuple const & wl, string const word_to_check = to_iconv_encoding(wl.word(), encoding); #ifdef HAVE_HUNSPELL_CXXABI vector wlst = h->suggest(word_to_check); - for (auto const s : wlst) + for (auto const & s : wlst) suggestions.push_back(remap_result(from_iconv_encoding(s, encoding))); #else char ** suggestion_list; @@ -449,7 +449,7 @@ void HunspellChecker::stem(WordLangTuple const & wl, string const word_to_check = to_iconv_encoding(wl.word(), encoding); #ifdef HAVE_HUNSPELL_CXXABI vector wlst = h->stem(word_to_check); - for (auto const s : wlst) + for (auto const & s : wlst) suggestions.push_back(from_iconv_encoding(s, encoding)); #else char ** suggestion_list; diff --git a/src/LaTeX.cpp b/src/LaTeX.cpp index be94654954..a34db97de1 100644 --- a/src/LaTeX.cpp +++ b/src/LaTeX.cpp @@ -238,7 +238,7 @@ int LaTeX::run(TeXErrors & terr) // Also remove all children which are included Buffer const * buf = theBufferList().getBufferFromTmp(file.absFileName()); if (buf && buf->params().maintain_unincluded_children == BufferParams::CM_Mostly) { - for (auto const incfile : buf->params().getIncludedChildren()) { + for (auto const & incfile : buf->params().getIncludedChildren()) { string const incm = DocFileName(changeExtension(makeAbsPath(incfile, path) .absFileName(), ".tex")).mangledFileName(); diff --git a/src/tex2lyx/Preamble.cpp b/src/tex2lyx/Preamble.cpp index 5b93f98498..6f757521fe 100644 --- a/src/tex2lyx/Preamble.cpp +++ b/src/tex2lyx/Preamble.cpp @@ -2572,10 +2572,9 @@ void Preamble::parse(Parser & p, string const & forceclass, if (i != string::npos) h_paperfontsize.erase(i); // Now those known specifically to the class - string fsize; vector class_fsizes = getVectorFromString(tc.opt_fontsize(), "|"); string const fsize_format = tc.fontsizeformat(); - for (auto const fsize : class_fsizes) { + for (auto const & fsize : class_fsizes) { string latexsize = subst(fsize_format, "$$s", fsize); vector::iterator it = find(opts.begin(), opts.end(), latexsize); if (it != opts.end()) { @@ -2642,7 +2641,7 @@ void Preamble::parse(Parser & p, string const & forceclass, string paper; vector class_psizes = getVectorFromString(tc.opt_pagesize(), "|"); string const psize_format = tc.pagesizeformat(); - for (auto const psize : class_psizes) { + for (auto const & psize : class_psizes) { string latexsize = subst(psize_format, "$$s", psize); vector::iterator it = find(opts.begin(), opts.end(), latexsize); if (it != opts.end()) { -- 2.39.5