commit 5061db891c2b7b9ca96ca40a3ee90bd9b2c76392
Author: Yuriy Skalko <yuriy.ska...@gmail.com>
Date:   Sat Oct 31 15:09:46 2020 +0200

    Use const references
---
 src/Buffer.cpp                        |   11 +++++------
 src/BufferView.cpp                    |    2 +-
 src/Compare.cpp                       |    2 +-
 src/LaTeX.cpp                         |    6 ++----
 src/Language.cpp                      |    2 +-
 src/Layout.cpp                        |    2 +-
 src/ParagraphParameters.cpp           |    2 +-
 src/ParagraphParameters.h             |    2 +-
 src/Text3.cpp                         |    2 +-
 src/TextClass.cpp                     |    1 +
 src/Thesaurus.cpp                     |    3 ++-
 src/factory.cpp                       |    4 ++--
 src/frontends/qt/GuiApplication.cpp   |    2 +-
 src/frontends/qt/GuiApplication.h     |    2 +-
 src/frontends/qt/GuiCitation.cpp      |    4 ++--
 src/frontends/qt/GuiCitation.h        |    4 ++--
 src/frontends/qt/GuiClipboard.cpp     |    2 +-
 src/frontends/qt/GuiCompare.cpp       |    2 +-
 src/frontends/qt/GuiCompare.h         |    2 +-
 src/frontends/qt/GuiDelimiter.cpp     |    4 ++--
 src/frontends/qt/GuiDocument.cpp      |    2 +-
 src/frontends/qt/GuiLyXFiles.cpp      |    4 ++--
 src/frontends/qt/GuiPainter.cpp       |    2 +-
 src/frontends/qt/GuiPrefs.cpp         |    6 +++---
 src/frontends/qt/GuiPrefs.h           |    6 +++---
 src/frontends/qt/GuiRef.cpp           |    4 ++--
 src/frontends/qt/GuiTabularCreate.cpp |    2 +-
 src/frontends/qt/GuiWorkArea.cpp      |    2 +-
 src/frontends/qt/GuiWorkArea.h        |    2 +-
 src/frontends/qt/Menus.cpp            |    4 ++--
 src/frontends/qt/TocWidget.cpp        |    2 +-
 src/insets/InsetBibtex.cpp            |    3 ++-
 src/insets/InsetCommand.cpp           |    2 +-
 src/insets/InsetRef.cpp               |    2 +-
 src/insets/InsetTabular.cpp           |    2 +-
 src/insets/InsetText.cpp              |    4 ++--
 src/insets/InsetText.h                |    2 +-
 src/mathed/InsetMathGrid.cpp          |    2 +-
 src/mathed/InsetMathGrid.h            |    2 +-
 src/mathed/InsetMathRoot.cpp          |    4 ++--
 src/mathed/MathParser.cpp             |    2 +-
 src/support/debug.h                   |    2 +-
 src/support/docstream.cpp             |    4 ++--
 src/support/docstream.h               |    4 ++--
 src/support/filetools.cpp             |    2 +-
 src/support/filetools.h               |    2 +-
 src/tex2lyx/Parser.cpp                |    2 +-
 src/tex2lyx/Parser.h                  |    2 +-
 src/tex2lyx/tex2lyx.cpp               |    2 +-
 src/tex2lyx/text.cpp                  |   16 ++++++++--------
 50 files changed, 79 insertions(+), 79 deletions(-)

diff --git a/src/Buffer.cpp b/src/Buffer.cpp
index 940f30c..64a3daa 100644
--- a/src/Buffer.cpp
+++ b/src/Buffer.cpp
@@ -1183,9 +1183,8 @@ bool Buffer::readString(string const & s)
 
 Buffer::ReadStatus Buffer::readFile(FileName const & fn)
 {
-       FileName fname(fn);
        Lexer lex;
-       if (!lex.setFile(fname)) {
+       if (!lex.setFile(fn)) {
                Alert::error(_("File Not Found"),
                        bformat(_("Unable to open file `%1$s'."),
                                from_utf8(fn.absFileName())));
@@ -2702,7 +2701,7 @@ bool Buffer::getStatus(FuncRequest const & cmd, 
FuncStatus & flag)
                break;
 
        case LFUN_BUFFER_EXPORT: {
-               docstring const arg = cmd.argument();
+               docstring const & arg = cmd.argument();
                if (arg == "custom") {
                        enable = true;
                        break;
@@ -2731,7 +2730,7 @@ bool Buffer::getStatus(FuncRequest const & cmd, 
FuncStatus & flag)
                                     || cmd.action() == 
LFUN_BRANCH_MASTER_DEACTIVATE);
                BranchList const & branchList = master ? 
masterBuffer()->params().branchlist()
                        : params().branchlist();
-               docstring const branchName = cmd.argument();
+               docstring const & branchName = cmd.argument();
                flag.setEnabled(!branchName.empty() && 
branchList.find(branchName));
                break;
        }
@@ -2893,7 +2892,7 @@ void Buffer::dispatch(FuncRequest const & func, 
DispatchResult & dr)
                Buffer * buf = master ? const_cast<Buffer *>(masterBuffer())
                                      : this;
 
-               docstring const branch_name = func.argument();
+               docstring const & branch_name = func.argument();
                // the case without a branch name is handled elsewhere
                if (branch_name.empty()) {
                        dispatched = false;
@@ -2921,7 +2920,7 @@ void Buffer::dispatch(FuncRequest const & func, 
DispatchResult & dr)
        }
 
        case LFUN_BRANCH_ADD: {
-               docstring branchnames = func.argument();
+               docstring const & branchnames = func.argument();
                if (branchnames.empty()) {
                        dispatched = false;
                        break;
diff --git a/src/BufferView.cpp b/src/BufferView.cpp
index fbfe41c..05630cb 100644
--- a/src/BufferView.cpp
+++ b/src/BufferView.cpp
@@ -1122,7 +1122,7 @@ bool BufferView::getStatus(FuncRequest const & cmd, 
FuncStatus & flag)
                break;
        case LFUN_FILE_INSERT_PLAINTEXT_PARA:
        case LFUN_FILE_INSERT_PLAINTEXT: {
-               docstring const fname = cmd.argument();
+               docstring const & fname = cmd.argument();
                if (!FileName::isAbsolute(to_utf8(fname))) {
                        flag.message(_("Absolute filename expected."));
                        return false;
diff --git a/src/Compare.cpp b/src/Compare.cpp
index 51a28f1..1b46e68 100644
--- a/src/Compare.cpp
+++ b/src/Compare.cpp
@@ -103,7 +103,7 @@ public:
        DocPair()
        {}
 
-       DocPair(DocIterator o_, DocIterator n_)
+       DocPair(DocIterator const & o_, DocIterator const & n_)
                : o(o_), n(n_)
        {}
 
diff --git a/src/LaTeX.cpp b/src/LaTeX.cpp
index e954470..25dffb7 100644
--- a/src/LaTeX.cpp
+++ b/src/LaTeX.cpp
@@ -1627,10 +1627,9 @@ int LaTeX::scanBlgFile(DepTable & dep, TeXErrors & terr)
                } else if (regex_match(token, sub, biberError)) {
                        retval |= BIBTEX_ERROR;
                        string errstr = N_("Biber error: ") + sub.str(2);
-                       string msg = token;
                        terr.insertError(0,
                                         from_local8bit(errstr),
-                                        from_local8bit(msg));
+                                        from_local8bit(token));
                }
                prevtoken = token;
        }
@@ -1664,10 +1663,9 @@ int LaTeX::scanIlgFile(TeXErrors & terr)
                } else if (prefixIs(token, "ERROR: ")) {
                        retval |= BIBTEX_ERROR;
                        string errstr = N_("Xindy error: ") + token.substr(6);
-                       string msg = token;
                        terr.insertError(0,
                                         from_local8bit(errstr),
-                                        from_local8bit(msg));
+                                        from_local8bit(token));
                }
        }
        return retval;
diff --git a/src/Language.cpp b/src/Language.cpp
index 9ad7a9c..dad933f 100644
--- a/src/Language.cpp
+++ b/src/Language.cpp
@@ -89,7 +89,7 @@ string Language::fontenc(BufferParams const & params) const
        // We check whether the used rm font supports an encoding our language 
supports
        LaTeXFont const & lf =
                theLaTeXFonts().getLaTeXFont(from_ascii(params.fontsRoman()));
-       vector<string> const lfe = lf.fontencs();
+       vector<string> const & lfe = lf.fontencs();
        for (auto & fe : fontenc_) {
                // ASCII means: support all T* encodings plus OT1
                if (fe == "ASCII") {
diff --git a/src/Layout.cpp b/src/Layout.cpp
index bfd6863..ac8fd58 100644
--- a/src/Layout.cpp
+++ b/src/Layout.cpp
@@ -1885,7 +1885,7 @@ string const & Layout::docbookattr() const
 }
 
 
-bool isValidTagType(std::string type)
+bool isValidTagType(std::string const & type)
 {
        return !(type.empty() || (type != "block" && type != "paragraph" && 
type != "inline"));
 }
diff --git a/src/ParagraphParameters.cpp b/src/ParagraphParameters.cpp
index 6ef9224..e634879 100644
--- a/src/ParagraphParameters.cpp
+++ b/src/ParagraphParameters.cpp
@@ -168,7 +168,7 @@ void ParagraphParameters::leftIndent(Length const & li)
 }
 
 
-void ParagraphParameters::read(string str, bool merge)
+void ParagraphParameters::read(string const & str, bool merge)
 {
        istringstream is(str);
        Lexer lex;
diff --git a/src/ParagraphParameters.h b/src/ParagraphParameters.h
index 36eec30..07601e9 100644
--- a/src/ParagraphParameters.h
+++ b/src/ParagraphParameters.h
@@ -76,7 +76,7 @@ public:
        void leftIndent(Length const &);
 
        /// read the parameters from a string
-       void read (std::string str, bool merge = true);
+       void read (std::string const & str, bool merge = true);
 
        /// read the parameters from a lex
        void read(Lexer & lex, bool merge = true);
diff --git a/src/Text3.cpp b/src/Text3.cpp
index cf2d701..74f86b2 100644
--- a/src/Text3.cpp
+++ b/src/Text3.cpp
@@ -1108,7 +1108,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
 
        case LFUN_NEWLINE_INSERT: {
                InsetNewlineParams inp;
-               docstring arg = cmd.argument();
+               docstring const & arg = cmd.argument();
                if (arg == "linebreak")
                        inp.kind = InsetNewlineParams::LINEBREAK;
                else
diff --git a/src/TextClass.cpp b/src/TextClass.cpp
index e162fc6..04b339f 100644
--- a/src/TextClass.cpp
+++ b/src/TextClass.cpp
@@ -2045,6 +2045,7 @@ vector<string> const DocumentClass::citeCommands(
 {
        vector<CitationStyle> const styles = citeStyles(type);
        vector<string> cmds;
+       cmds.reserve(styles.size());
        for (auto const & cs : styles)
                cmds.push_back(cs.name);
 
diff --git a/src/Thesaurus.cpp b/src/Thesaurus.cpp
index ace03d7..1c1adc0 100644
--- a/src/Thesaurus.cpp
+++ b/src/Thesaurus.cpp
@@ -217,7 +217,7 @@ Thesaurus::Meanings Thesaurus::lookup(WordLangTuple const & 
wl)
        MyThes * mythes = nullptr;
 
        docstring const lang_code = from_ascii(wl.lang()->code());
-       docstring const t = wl.word();
+       docstring const & t = wl.word();
 
        if (!d->addThesaurus(lang_code))
                return meanings;
@@ -266,6 +266,7 @@ Thesaurus::Meanings Thesaurus::lookup(WordLangTuple const & 
wl)
                // remove silly item
                if (support::prefixIs(meaning, '-'))
                        meaning = support::ltrim(meaning, "- ");
+               ret.reserve(pm->count);
                for (int j = 0; j < pm->count; j++) {
                        ret.push_back(from_iconv_encoding(string(pm->psyns[j]), 
encoding));
                }
diff --git a/src/factory.cpp b/src/factory.cpp
index dd72fe3..6f17797 100644
--- a/src/factory.cpp
+++ b/src/factory.cpp
@@ -215,7 +215,7 @@ Inset * createInsetHelper(Buffer * buf, FuncRequest const & 
cmd)
                }
 
                case LFUN_INDEX_INSERT: {
-                       docstring arg = cmd.argument();
+                       docstring const & arg = cmd.argument();
                        return new InsetIndex(buf, InsetIndexParams(arg));
                }
 
@@ -341,7 +341,7 @@ Inset * createInsetHelper(Buffer * buf, FuncRequest const & 
cmd)
                        }
 
                        case INDEX_CODE: {
-                               docstring arg = cmd.argument();
+                               docstring const & arg = cmd.argument();
                                return new InsetIndex(buf, 
InsetIndexParams(arg));
                        }
 
diff --git a/src/frontends/qt/GuiApplication.cpp 
b/src/frontends/qt/GuiApplication.cpp
index 2c87ad1..3c007be 100644
--- a/src/frontends/qt/GuiApplication.cpp
+++ b/src/frontends/qt/GuiApplication.cpp
@@ -3002,7 +3002,7 @@ static QStringList uifiles;
 static QStringList toolbar_uifiles;
 
 
-GuiApplication::ReturnValues GuiApplication::readUIFile(FileName ui_path)
+GuiApplication::ReturnValues GuiApplication::readUIFile(FileName const & 
ui_path)
 {
        enum {
                ui_menuset = 1,
diff --git a/src/frontends/qt/GuiApplication.h 
b/src/frontends/qt/GuiApplication.h
index d1294e6..0959762 100644
--- a/src/frontends/qt/GuiApplication.h
+++ b/src/frontends/qt/GuiApplication.h
@@ -242,7 +242,7 @@ private:
                FormatMismatch
        };
        ///
-       ReturnValues readUIFile(support::FileName);
+       ReturnValues readUIFile(support::FileName const & ui_path);
        ///
        void setGuiLanguage();
        ///
diff --git a/src/frontends/qt/GuiCitation.cpp b/src/frontends/qt/GuiCitation.cpp
index 195b0d3..c66a6d3 100644
--- a/src/frontends/qt/GuiCitation.cpp
+++ b/src/frontends/qt/GuiCitation.cpp
@@ -957,7 +957,7 @@ void GuiCitation::clearParams()
 
 
 void GuiCitation::filterByEntryType(BiblioInfo const & bi,
-       vector<docstring> & keyVector, docstring entry_type)
+       vector<docstring> & keyVector, docstring const & entry_type)
 {
        if (entry_type.empty())
                return;
@@ -1009,7 +1009,7 @@ static docstring escape_special_chars(docstring const & 
expr)
 
 vector<docstring> GuiCitation::searchKeys(BiblioInfo const & bi,
        vector<docstring> const & keys_to_search, bool only_keys,
-       docstring const & search_expression, docstring field,
+       docstring const & search_expression, docstring const & field,
        bool case_sensitive, bool regex)
 {
        vector<docstring> foundKeys;
diff --git a/src/frontends/qt/GuiCitation.h b/src/frontends/qt/GuiCitation.h
index 13a8087..6859b73 100644
--- a/src/frontends/qt/GuiCitation.h
+++ b/src/frontends/qt/GuiCitation.h
@@ -150,7 +150,7 @@ private:
 
        ///
        void filterByEntryType(BiblioInfo const & bi,
-               std::vector<docstring> & keyVector, docstring entryType);
+               std::vector<docstring> & keyVector, docstring const & 
entryType);
 
        /// Search a given string within the passed keys.
        /// \return the vector of matched keys.
@@ -159,7 +159,7 @@ private:
                std::vector<docstring> const & keys_to_search, //< Keys to 
search.
                bool only_keys, //< whether to search only the keys
                docstring const & search_expression, //< Search expression 
(regex possible)
-               docstring field, //< field to search, empty for all fields
+               docstring const & field, //< field to search, empty for all 
fields
                bool case_sensitive = false, //< set to true is the search 
should be case sensitive
                bool regex = false //< \set to true if \c search_expression is 
a regex
                ); //
diff --git a/src/frontends/qt/GuiClipboard.cpp 
b/src/frontends/qt/GuiClipboard.cpp
index 422315a..59e5900 100644
--- a/src/frontends/qt/GuiClipboard.cpp
+++ b/src/frontends/qt/GuiClipboard.cpp
@@ -345,7 +345,7 @@ namespace {
  * Since we are going to write a HTML file for external converters we need
  * to ensure that it is a well formed HTML file, including all the mentioned 
tags.
  */
-QString tidyHtml(QString input)
+QString tidyHtml(QString const & input)
 {
        // Misuse QTextDocument to cleanup the HTML.
        // As a side effect, all visual markup like <tt> is converted to CSS,
diff --git a/src/frontends/qt/GuiCompare.cpp b/src/frontends/qt/GuiCompare.cpp
index d282df9..d1da5b3 100644
--- a/src/frontends/qt/GuiCompare.cpp
+++ b/src/frontends/qt/GuiCompare.cpp
@@ -244,7 +244,7 @@ void GuiCompare::progressMax(int max) const
 }
 
 
-void GuiCompare::setStatusMessage(QString msg)
+void GuiCompare::setStatusMessage(QString const & msg)
 {
        statusBar->showMessage(msg);
 }
diff --git a/src/frontends/qt/GuiCompare.h b/src/frontends/qt/GuiCompare.h
index 6d60887..649ba5c 100644
--- a/src/frontends/qt/GuiCompare.h
+++ b/src/frontends/qt/GuiCompare.h
@@ -57,7 +57,7 @@ private Q_SLOTS:
        ///
        void progressMax(int) const;
        ///
-       void setStatusMessage(QString);
+       void setStatusMessage(QString const &);
 
 private:
        ///
diff --git a/src/frontends/qt/GuiDelimiter.cpp 
b/src/frontends/qt/GuiDelimiter.cpp
index 8dc97ff..4e2eff7 100644
--- a/src/frontends/qt/GuiDelimiter.cpp
+++ b/src/frontends/qt/GuiDelimiter.cpp
@@ -139,7 +139,7 @@ void initMathSymbols()
 }
 
 /// \return the math unicode symbol associated to a TeX name.
-MathSymbol const & mathSymbol(string tex_name)
+MathSymbol const & mathSymbol(string const & tex_name)
 {
        map<string, MathSymbol>::const_iterator it =
                math_symbols_.find(tex_name);
@@ -216,7 +216,7 @@ GuiDelimiter::GuiDelimiter(GuiView & lv)
                        QChar(ms.fontcode) : toqstr(docstring(1, ms.unicode)));
                QListWidgetItem * lwi = new QListWidgetItem(symbol);
                lyxfont.setFamily(ms.fontfamily);
-               QFont font = frontend::getFont(lyxfont);
+               QFont const & font = frontend::getFont(lyxfont);
                lwi->setFont(font);
                setDelimiterName(lwi, delim);
                lwi->setToolTip(toqstr(delim));
diff --git a/src/frontends/qt/GuiDocument.cpp b/src/frontends/qt/GuiDocument.cpp
index 0244bfd..ca874f6 100644
--- a/src/frontends/qt/GuiDocument.cpp
+++ b/src/frontends/qt/GuiDocument.cpp
@@ -3309,7 +3309,7 @@ void GuiDocument::getTableStyles()
             << toqstr(system);
 
        for (int i = 0; i < dirs.size(); ++i) {
-               QString const dir = dirs.at(i);
+               QString const & dir = dirs.at(i);
                QDirIterator it(dir, QDir::Files, QDirIterator::Subdirectories);
                while (it.hasNext()) {
                        QString fn = QFileInfo(it.next()).fileName();
diff --git a/src/frontends/qt/GuiLyXFiles.cpp b/src/frontends/qt/GuiLyXFiles.cpp
index 5616ac0..9e1caf9 100644
--- a/src/frontends/qt/GuiLyXFiles.cpp
+++ b/src/frontends/qt/GuiLyXFiles.cpp
@@ -37,7 +37,7 @@ namespace frontend {
 
 namespace {
 
-QString const guiString(QString in)
+QString const guiString(QString const & in)
 {
        // recode specially encoded chars in file names (URL encoding and 
underbar)
        return 
QString::fromUtf8(QByteArray::fromPercentEncoding(in.toUtf8())).replace('_', ' 
');
@@ -76,7 +76,7 @@ QMap<QString, QString> GuiLyXFiles::getFiles()
                     << toqstr(system);
 
        for (int i = 0; i < dirs.size(); ++i) {
-               QString const dir = dirs.at(i);
+               QString const & dir = dirs.at(i);
                QDirIterator it(dir, QDir::Files, QDirIterator::Subdirectories);
                while (it.hasNext()) {
                        QString fn(QFile(it.next()).fileName());
diff --git a/src/frontends/qt/GuiPainter.cpp b/src/frontends/qt/GuiPainter.cpp
index d9074cb..79bbf56 100644
--- a/src/frontends/qt/GuiPainter.cpp
+++ b/src/frontends/qt/GuiPainter.cpp
@@ -240,7 +240,7 @@ void GuiPainter::image(int x, int y, int w, int h, 
graphics::Image const & i)
 
        fillRectangle(x, y, w, h, Color_graphicsbg);
 
-       QImage const image = qlimage.image();
+       QImage const & image = qlimage.image();
        QRectF const drect = QRectF(x, y, w, h);
        QRectF const srect = QRectF(0, 0, image.width(), image.height());
        // Bilinear filtering is needed on a rare occasion for instant previews 
when
diff --git a/src/frontends/qt/GuiPrefs.cpp b/src/frontends/qt/GuiPrefs.cpp
index faf8803..79064df 100644
--- a/src/frontends/qt/GuiPrefs.cpp
+++ b/src/frontends/qt/GuiPrefs.cpp
@@ -1206,8 +1206,8 @@ void PrefColors::resetAllColor()
 }
 
 
-bool PrefColors::setColor(int const row, QColor const new_color,
-                         QString const old_color)
+bool PrefColors::setColor(int const row, QColor const & new_color,
+                         QString const & old_color)
 {
        if (new_color.isValid() && new_color.name() != old_color) {
                newcolors_[size_t(row)] = new_color.name();
@@ -1244,7 +1244,7 @@ void PrefColors::setDisabledResets()
 }
 
 
-bool PrefColors::isDefaultColor(int const row, QString const color)
+bool PrefColors::isDefaultColor(int const row, QString const & color)
 {
        return color == getDefaultColorByRow(row).name();
 }
diff --git a/src/frontends/qt/GuiPrefs.h b/src/frontends/qt/GuiPrefs.h
index 11a511d..3bc368a 100644
--- a/src/frontends/qt/GuiPrefs.h
+++ b/src/frontends/qt/GuiPrefs.h
@@ -255,9 +255,9 @@ private Q_SLOTS:
        void resetAllColor();
        void changeSysColor();
        void changeLyxObjectsSelection();
-       bool setColor(int const row, QColor const new_color,
-                     QString const old_color);
-       bool isDefaultColor(int const row, QString const color);
+       bool setColor(int const row, QColor const & new_color,
+                     QString const & old_color);
+       bool isDefaultColor(int const row, QString const & color);
        void setDisabledResets();
 
 private:
diff --git a/src/frontends/qt/GuiRef.cpp b/src/frontends/qt/GuiRef.cpp
index 83be347..5884ac4 100644
--- a/src/frontends/qt/GuiRef.cpp
+++ b/src/frontends/qt/GuiRef.cpp
@@ -483,11 +483,11 @@ void GuiRef::redoRefs()
        if (groupCB->isChecked()) {
                QList<QTreeWidgetItem *> refsCats;
                for (int i = 0; i < refsCategories.size(); ++i) {
-                       QString const cat = refsCategories.at(i);
+                       QString const & cat = refsCategories.at(i);
                        QTreeWidgetItem * item = new QTreeWidgetItem(refsTW);
                        item->setText(0, cat);
                        for (int j = 0; j < refsStrings.size(); ++j) {
-                               QString const ref = refsStrings.at(j);
+                               QString const & ref = refsStrings.at(j);
                                if ((ref.startsWith(cat + QString(":")))
                                    || (cat == qt_("<No prefix>")
                                       && (!ref.mid(1).contains(":") || 
ref.left(1).contains(":")))) {
diff --git a/src/frontends/qt/GuiTabularCreate.cpp 
b/src/frontends/qt/GuiTabularCreate.cpp
index 1f5e36e..e0e93af 100644
--- a/src/frontends/qt/GuiTabularCreate.cpp
+++ b/src/frontends/qt/GuiTabularCreate.cpp
@@ -54,7 +54,7 @@ void GuiTabularCreate::getFiles()
             << toqstr(system);
 
        for (int i = 0; i < dirs.size(); ++i) {
-               QString const dir = dirs.at(i);
+               QString const & dir = dirs.at(i);
                QDirIterator it(dir, QDir::Files, QDirIterator::Subdirectories);
                while (it.hasNext()) {
                        QString fn = QFileInfo(it.next()).fileName();
diff --git a/src/frontends/qt/GuiWorkArea.cpp b/src/frontends/qt/GuiWorkArea.cpp
index 5937ae9..c1f74f8 100644
--- a/src/frontends/qt/GuiWorkArea.cpp
+++ b/src/frontends/qt/GuiWorkArea.cpp
@@ -2193,7 +2193,7 @@ void GuiWorkAreaContainer::updateDisplay()
 }
 
 
-void GuiWorkAreaContainer::dispatch(FuncRequest f) const
+void GuiWorkAreaContainer::dispatch(FuncRequest const & f) const
 {
        lyx::dispatch(FuncRequest(LFUN_BUFFER_SWITCH,
                                  wa_->bufferView().buffer().absFileName()));
diff --git a/src/frontends/qt/GuiWorkArea.h b/src/frontends/qt/GuiWorkArea.h
index 8e1790a..6f24ff3 100644
--- a/src/frontends/qt/GuiWorkArea.h
+++ b/src/frontends/qt/GuiWorkArea.h
@@ -280,7 +280,7 @@ class GuiWorkAreaContainer : public QWidget, public 
Ui::WorkAreaUi
        Q_OBJECT
        // non-null
        GuiWorkArea * const wa_;
-       void dispatch(FuncRequest f) const;
+       void dispatch(FuncRequest const & f) const;
 
 private Q_SLOTS:
        void updateDisplay();
diff --git a/src/frontends/qt/Menus.cpp b/src/frontends/qt/Menus.cpp
index a138091..b6a0a42 100644
--- a/src/frontends/qt/Menus.cpp
+++ b/src/frontends/qt/Menus.cpp
@@ -358,7 +358,7 @@ public:
        void expandFloatInsert(Buffer const * buf);
        void expandFlexInsert(Buffer const * buf, InsetLayout::InsetLyXType 
type);
        void expandTocSubmenu(std::string const & type, Toc const & toc_list);
-       void expandToc2(Toc const & toc_list, size_t from, size_t to, int 
depth, string toc_type);
+       void expandToc2(Toc const & toc_list, size_t from, size_t to, int 
depth, const string &toc_type);
        void expandToc(Buffer const * buf);
        void expandPasteRecent(Buffer const * buf);
        void expandToolbars();
@@ -1258,7 +1258,7 @@ size_t const menu_size_limit = 80;
 
 void MenuDefinition::expandToc2(Toc const & toc_list,
                                 size_t from, size_t to, int depth,
-                                string toc_type)
+                                string const & toc_type)
 {
        int shortcut_count = 0;
 
diff --git a/src/frontends/qt/TocWidget.cpp b/src/frontends/qt/TocWidget.cpp
index 45cc611..de2b07a 100644
--- a/src/frontends/qt/TocWidget.cpp
+++ b/src/frontends/qt/TocWidget.cpp
@@ -365,7 +365,7 @@ void TocWidget::sendDispatch(FuncRequest fr)
 {
 
        fr.setViewOrigin(&gui_view_);
-       DispatchResult dr=dispatch(fr);
+       DispatchResult const & dr = dispatch(fr);
        if (dr.error())
                gui_view_.message(dr.message());
 }
diff --git a/src/insets/InsetBibtex.cpp b/src/insets/InsetBibtex.cpp
index f606444..bb57811 100644
--- a/src/insets/InsetBibtex.cpp
+++ b/src/insets/InsetBibtex.cpp
@@ -310,7 +310,8 @@ void InsetBibtex::latex(otexstream & os, OutputParams const 
& runparams) const
                vector<pair<docstring, string>> const dbs =
                        buffer().prepareBibFilePaths(runparams, getBibFiles(), 
false);
                vector<docstring> db_out;
-               for (pair<docstring, string> const & db : dbs)
+               db_out.reserve(dbs.size());
+        for (pair<docstring, string> const & db : dbs)
                        db_out.push_back(db.first);
                // Style options
                if (style == "default")
diff --git a/src/insets/InsetCommand.cpp b/src/insets/InsetCommand.cpp
index 6d15c68..c3fd15f 100644
--- a/src/insets/InsetCommand.cpp
+++ b/src/insets/InsetCommand.cpp
@@ -190,7 +190,7 @@ void InsetCommand::validate(LaTeXFeatures & features) const
 
 void InsetCommand::changeCmdName(string const & new_name)
 {
-       string const old_name = getCmdName();
+       string const & old_name = getCmdName();
        if (old_name == new_name)
                return;
 
diff --git a/src/insets/InsetRef.cpp b/src/insets/InsetRef.cpp
index d30f2ef..063691b 100644
--- a/src/insets/InsetRef.cpp
+++ b/src/insets/InsetRef.cpp
@@ -536,7 +536,7 @@ void InsetRef::addToToc(DocIterator const & cpit, bool 
output_active,
 
 void InsetRef::validate(LaTeXFeatures & features) const
 {
-       string const cmd = getCmdName();
+       string const & cmd = getCmdName();
        if (cmd == "vref" || cmd == "vpageref")
                features.require("varioref");
        else if (cmd == "formatted") {
diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp
index 00d9bc1..e6c9892 100644
--- a/src/insets/InsetTabular.cpp
+++ b/src/insets/InsetTabular.cpp
@@ -7331,7 +7331,7 @@ ParagraphList InsetTabular::asParList(idx_type stidx, 
idx_type enidx)
        row_type const row2 = tabular.cellRow(enidx);
        for (col_type col = col1; col <= col2; col++)
                for (row_type row = row1; row <= row2; row++)
-                       for (auto par : tabular.cellInset(row, 
col)->paragraphs())
+                       for (auto const & par : tabular.cellInset(row, 
col)->paragraphs())
                                retval.push_back(par);
        return retval;
 }
diff --git a/src/insets/InsetText.cpp b/src/insets/InsetText.cpp
index 6f7a1a4..f72b9a6 100644
--- a/src/insets/InsetText.cpp
+++ b/src/insets/InsetText.cpp
@@ -1011,7 +1011,7 @@ pit_type InsetText::openAddToTocForParagraph(pit_type pit,
 {
        Paragraph const & par = paragraphs()[pit];
        TocBuilder & b = backend.builder(par.layout().tocType());
-       docstring const label = par.labelString();
+       docstring const & label = par.labelString();
        b.pushItem(dit, label + (label.empty() ? "" : " "), output_active);
        return text().lastInSequence(pit);
 }
@@ -1130,7 +1130,7 @@ string InsetText::contextMenuName() const
 }
 
 
-docstring InsetText::toolTipText(docstring prefix, size_t const len) const
+docstring InsetText::toolTipText(docstring const & prefix, size_t const len) 
const
 {
        OutputParams rp(&buffer().params().encoding());
        rp.for_tooltip = true;
diff --git a/src/insets/InsetText.h b/src/insets/InsetText.h
index 6ce6b5a..bccaacc 100644
--- a/src/insets/InsetText.h
+++ b/src/insets/InsetText.h
@@ -215,7 +215,7 @@ public:
        /// of that sort. (Note: unnecessary internal copies have been removed
        /// since the previous note. The efficiency would have to be assessed
        /// again by profiling.)
-       docstring toolTipText(docstring prefix = empty_docstring(),
+       docstring toolTipText(docstring const & prefix = empty_docstring(),
                              size_t len = 400) const;
 
        ///
diff --git a/src/mathed/InsetMathGrid.cpp b/src/mathed/InsetMathGrid.cpp
index fef88a9..783e374 100644
--- a/src/mathed/InsetMathGrid.cpp
+++ b/src/mathed/InsetMathGrid.cpp
@@ -1215,7 +1215,7 @@ void InsetMathGrid::mathmlize(MathStream & ms) const
 
 // FIXME XHTML
 // We need to do something about alignment here.
-void InsetMathGrid::htmlize(HtmlStream & os, string attrib) const
+void InsetMathGrid::htmlize(HtmlStream & os, string const & attrib) const
 {
        bool const havetable = nrows() > 1 || ncols() > 1;
        if (!havetable) {
diff --git a/src/mathed/InsetMathGrid.h b/src/mathed/InsetMathGrid.h
index 87f781a..df83449 100644
--- a/src/mathed/InsetMathGrid.h
+++ b/src/mathed/InsetMathGrid.h
@@ -231,7 +231,7 @@ public:
        ///
        void htmlize(HtmlStream &) const override;
        ///
-       void htmlize(HtmlStream &, std::string attrib) const;
+       void htmlize(HtmlStream &, std::string const & attrib) const;
        ///
        void validate(LaTeXFeatures & features) const override;
        ///
diff --git a/src/mathed/InsetMathRoot.cpp b/src/mathed/InsetMathRoot.cpp
index de4253e..b677c39 100644
--- a/src/mathed/InsetMathRoot.cpp
+++ b/src/mathed/InsetMathRoot.cpp
@@ -100,13 +100,13 @@ void mathed_draw_root(PainterInfo & pi, int x, int y, 
MathData const & nucleus,
        int const a = dim.ascent();
        int const d = dim.descent();
        int const t = pi.base.solidLineThickness();
-       Dimension const dimn = nucleus.dimension(*pi.base.bv);
+       Dimension const & dimn = nucleus.dimension(*pi.base.bv);
        // the width of the left part of the root
        int const wl = dim.width() - dimn.width();
        // the "exponent"
        if (root) {
                Changer script = pi.base.font.changeStyle(SCRIPTSCRIPT_STYLE);
-               Dimension const dimr = root->dimension(*pi.base.bv);
+               Dimension const & dimr = root->dimension(*pi.base.bv);
                int const root_offset = wl - 3 * w / 8 - dimr.width();
                root->draw(pi, x + root_offset, y + (d - a)/2);
        }
diff --git a/src/mathed/MathParser.cpp b/src/mathed/MathParser.cpp
index f07b2e6..332d2a1 100644
--- a/src/mathed/MathParser.cpp
+++ b/src/mathed/MathParser.cpp
@@ -1881,7 +1881,7 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
                        bool const prot =  nextToken().character() == '*';
                        if (prot)
                                getToken();
-                       docstring const name = t.cs();
+                       docstring const & name = t.cs();
                        docstring const arg = parse_verbatim_item();
                        Length length;
                        if (prot && arg == "\\fill")
diff --git a/src/support/debug.h b/src/support/debug.h
index 112b66a..da10cd1 100644
--- a/src/support/debug.h
+++ b/src/support/debug.h
@@ -168,7 +168,7 @@ public:
        void setSecondStream(std::ostream * os)
                { second_enabled_ = (second_stream_ = os); }
        /// Is the second stream is enabled?
-       bool secondEnabled() { return second_enabled_; }
+       bool secondEnabled() const { return second_enabled_; }
 
        /// Sets the debug level
        void setLevel(Debug::Type t) { dt_ = t; }
diff --git a/src/support/docstream.cpp b/src/support/docstream.cpp
index 98324d1..9285502 100644
--- a/src/support/docstream.cpp
+++ b/src/support/docstream.cpp
@@ -383,7 +383,7 @@ SetEnc setEncoding(string const & encoding)
 }
 
 
-odocstream & operator<<(odocstream & os, SetEnc e)
+odocstream & operator<<(odocstream & os, SetEnc const & e)
 {
        if (has_facet<iconv_codecvt_facet>(os.rdbuf()->getloc())) {
                // This stream must be a file stream, since we never imbue
@@ -413,7 +413,7 @@ odocstream & operator<<(odocstream & os, SetEnc e)
 }
 
 
-idocstream & operator<<(idocstream & is, SetEnc e)
+idocstream & operator<<(idocstream & is, SetEnc const & e)
 {
        if (has_facet<iconv_codecvt_facet>(is.rdbuf()->getloc())) {
                // This stream must be a file stream, since we never imbue
diff --git a/src/support/docstream.h b/src/support/docstream.h
index 52cc04a..700601c 100644
--- a/src/support/docstream.h
+++ b/src/support/docstream.h
@@ -111,8 +111,8 @@ SetEnc setEncoding(std::string const & encoding);
     os << setEncoding("ISO-8859-1");
     \endcode
  */
-odocstream & operator<<(odocstream & os, SetEnc e);
-idocstream & operator<<(idocstream & os, SetEnc e);
+odocstream & operator<<(odocstream & os, SetEnc const & e);
+idocstream & operator<<(idocstream & os, SetEnc const & e);
 
 } // namespace lyx
 
diff --git a/src/support/filetools.cpp b/src/support/filetools.cpp
index 6d6674d..0233c41 100644
--- a/src/support/filetools.cpp
+++ b/src/support/filetools.cpp
@@ -442,7 +442,7 @@ string const commandPrep(string const & command_in)
 }
 
 
-FileName const tempFileName(FileName tempdir, string const & mask, bool const 
dir)
+FileName const tempFileName(FileName const & tempdir, string const & mask, 
bool const dir)
 {
        return tempFileName(TempFile(tempdir, mask).name(), dir);
 }
diff --git a/src/support/filetools.h b/src/support/filetools.h
index e66af99..24adf30 100644
--- a/src/support/filetools.h
+++ b/src/support/filetools.h
@@ -42,7 +42,7 @@ static std::set<std::string> tmp_names_;
 */
 FileName const tempFileName(FileName, bool const dir = false);
 /// Get temporary file name with custom path
-FileName const tempFileName(FileName, std::string const &, bool const dir = 
false);
+FileName const tempFileName(FileName const &, std::string const &, bool const 
dir = false);
 /// Get temporary file name with default path
 FileName const tempFileName(std::string const &, bool const dir = false);
 
diff --git a/src/tex2lyx/Parser.cpp b/src/tex2lyx/Parser.cpp
index 5725365..795628b 100644
--- a/src/tex2lyx/Parser.cpp
+++ b/src/tex2lyx/Parser.cpp
@@ -129,7 +129,7 @@ void iparserdocstream::putback(char_type c)
 }
 
 
-void iparserdocstream::putback(docstring s)
+void iparserdocstream::putback(docstring const & s)
 {
        s_ = s + s_;
 }
diff --git a/src/tex2lyx/Parser.h b/src/tex2lyx/Parser.h
index 4138459..9f174c8 100644
--- a/src/tex2lyx/Parser.h
+++ b/src/tex2lyx/Parser.h
@@ -139,7 +139,7 @@ public:
 
        // add to the list of characters to read before actually reading
        // the stream
-       void putback(docstring s);
+       void putback(const docstring &s);
 
        /// Like std::istream::get()
        iparserdocstream & get(char_type &c);
diff --git a/src/tex2lyx/tex2lyx.cpp b/src/tex2lyx/tex2lyx.cpp
index 55a64af..8ecfa68 100644
--- a/src/tex2lyx/tex2lyx.cpp
+++ b/src/tex2lyx/tex2lyx.cpp
@@ -371,7 +371,7 @@ bool checkModule(string const & name, bool command)
                if (layout) {
                        found_style = true;
                        dpre = layout->preamble();
-                       std::set<std::string> lreqs = layout->required();
+                       std::set<std::string> const & lreqs = 
layout->required();
                        if (!lreqs.empty())
                                cmd_reqs.insert(lreqs.begin(), lreqs.end());
                } else if (insetlayout) {
diff --git a/src/tex2lyx/text.cpp b/src/tex2lyx/text.cpp
index e431f36..e06ba2d 100644
--- a/src/tex2lyx/text.cpp
+++ b/src/tex2lyx/text.cpp
@@ -47,7 +47,7 @@ namespace lyx {
 
 namespace {
 
-void output_arguments(ostream &, Parser &, bool, bool, string, Context &,
+void output_arguments(ostream &, Parser &, bool, bool, const string &, Context 
&,
                       Layout::LaTeXArgMap const &);
 
 }
@@ -459,7 +459,7 @@ bool translate_len(string const & length, string & 
valstring, string & unit)
 
 /// If we have ambiguous quotation marks, make a smart guess
 /// based on main quote style
-string guessQuoteStyle(string in, bool const opening)
+string guessQuoteStyle(string const & in, bool const opening)
 {
        string res = in;
        if (prefixIs(in, "qr")) {// straight quote
@@ -528,7 +528,7 @@ string guessQuoteStyle(string in, bool const opening)
 }
 
 
-string const fromPolyglossiaEnvironment(string const s)
+string const fromPolyglossiaEnvironment(string const & s)
 {
        // Since \arabic is taken by the LaTeX kernel,
        // the Arabic polyglossia environment is upcased
@@ -539,7 +539,7 @@ string const fromPolyglossiaEnvironment(string const s)
 }
 
 
-string uncapitalize(string const s)
+string uncapitalize(string const & s)
 {
        docstring in = from_ascii(s);
        char_type t = lowercase(s[0]);
@@ -548,7 +548,7 @@ string uncapitalize(string const s)
 }
 
 
-bool isCapitalized(string const s)
+bool isCapitalized(string const & s)
 {
        docstring in = from_ascii(s);
        char_type t = uppercase(s[0]);
@@ -686,7 +686,7 @@ pair<bool, string> convert_latexed_command_inset_arg(string 
s)
 
 /// try to convert \p s to a valid InsetCommand argument
 /// without trying to recode macros.
-string convert_literate_command_inset_arg(string s)
+string convert_literate_command_inset_arg(string const & s)
 {
        // LyX cannot handle newlines in a latex command
        return subst(s, "\n", " ");
@@ -789,7 +789,7 @@ void skip_spaces_braces(Parser & p, bool keepws = false)
 }
 
 
-void output_arguments(ostream & os, Parser & p, bool outer, bool need_layout, 
string const prefix,
+void output_arguments(ostream & os, Parser & p, bool outer, bool need_layout, 
string const & prefix,
                       Context & context, Layout::LaTeXArgMap const & latexargs)
 {
        if (context.layout->latextype != LATEX_ITEM_ENVIRONMENT || 
!prefix.empty()) {
@@ -2536,7 +2536,7 @@ void get_cite_arguments(Parser & p, bool natbibOrder,
 }
 
 
-void copy_file(FileName const & src, string dstname)
+void copy_file(FileName const & src, string const & dstname)
 {
        if (!copyFiles())
                return;
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to