]> git.lyx.org Git - features.git/commitdiff
Use const references
authorYuriy Skalko <yuriy.skalko@gmail.com>
Sat, 31 Oct 2020 13:09:46 +0000 (15:09 +0200)
committerYuriy Skalko <yuriy.skalko@gmail.com>
Sun, 1 Nov 2020 20:23:26 +0000 (22:23 +0200)
50 files changed:
src/Buffer.cpp
src/BufferView.cpp
src/Compare.cpp
src/LaTeX.cpp
src/Language.cpp
src/Layout.cpp
src/ParagraphParameters.cpp
src/ParagraphParameters.h
src/Text3.cpp
src/TextClass.cpp
src/Thesaurus.cpp
src/factory.cpp
src/frontends/qt/GuiApplication.cpp
src/frontends/qt/GuiApplication.h
src/frontends/qt/GuiCitation.cpp
src/frontends/qt/GuiCitation.h
src/frontends/qt/GuiClipboard.cpp
src/frontends/qt/GuiCompare.cpp
src/frontends/qt/GuiCompare.h
src/frontends/qt/GuiDelimiter.cpp
src/frontends/qt/GuiDocument.cpp
src/frontends/qt/GuiLyXFiles.cpp
src/frontends/qt/GuiPainter.cpp
src/frontends/qt/GuiPrefs.cpp
src/frontends/qt/GuiPrefs.h
src/frontends/qt/GuiRef.cpp
src/frontends/qt/GuiTabularCreate.cpp
src/frontends/qt/GuiWorkArea.cpp
src/frontends/qt/GuiWorkArea.h
src/frontends/qt/Menus.cpp
src/frontends/qt/TocWidget.cpp
src/insets/InsetBibtex.cpp
src/insets/InsetCommand.cpp
src/insets/InsetRef.cpp
src/insets/InsetTabular.cpp
src/insets/InsetText.cpp
src/insets/InsetText.h
src/mathed/InsetMathGrid.cpp
src/mathed/InsetMathGrid.h
src/mathed/InsetMathRoot.cpp
src/mathed/MathParser.cpp
src/support/debug.h
src/support/docstream.cpp
src/support/docstream.h
src/support/filetools.cpp
src/support/filetools.h
src/tex2lyx/Parser.cpp
src/tex2lyx/Parser.h
src/tex2lyx/tex2lyx.cpp
src/tex2lyx/text.cpp

index 940f30cd1cf4a10a46e9455bb733b026beff56c3..64a3daa4aa4635a89f560e878b843c2f8bdc65e8 100644 (file)
@@ -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;
index fbfe41c6dbeb465a7135216a6284b4ae5f0fa4be..05630cba0bfdf68c9a7356c0e302661f41c2e2bb 100644 (file)
@@ -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;
index 51a28f16ec88a41c6a0762f4a0ff0651f3a6905d..1b46e6827d1674d6b454fb431d2332c6db3122a2 100644 (file)
@@ -103,7 +103,7 @@ public:
        DocPair()
        {}
 
-       DocPair(DocIterator o_, DocIterator n_)
+       DocPair(DocIterator const & o_, DocIterator const & n_)
                : o(o_), n(n_)
        {}
 
index e9544705ab74fbc393b3e7d40f0ecd92a1d1a917..25dffb77a4ddf619a76a243c2c490608c8297e46 100644 (file)
@@ -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;
index 9ad7a9c217e7b7633899b9023945e9b125b64254..dad933f0c6cd392fcd5b4bd3b45e0ec1693d37ad 100644 (file)
@@ -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") {
index bfd6863397b493a186f57dce4c0747fc50e7a1ee..ac8fd5847c1aafd2e18763a4f2521a0299b08650 100644 (file)
@@ -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"));
 }
index 6ef9224f2d885962f912de4c4707712de2aafa5d..e6348797dd2f1e6d6a1f56d80ef60c61430cee86 100644 (file)
@@ -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;
index 36eec30c481b39f21f11471763fe2bd77bdeeb88..07601e9e33faf415d75a3498f57a2239298315eb 100644 (file)
@@ -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);
index cf2d701e7fb1af73d0e3a4fd03087bd9699d83c4..74f86b26f384280abbe73913550ac6eb059dc2ed 100644 (file)
@@ -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
index e162fc6091c4587aa3eb4a0a489e96e240aceb6c..04b339f13e47a0955d4cc0cc4c5e196285d011df 100644 (file)
@@ -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);
 
index ace03d79e9b4014db7ec26c4938a4242f114365a..1c1adc03b0e22cb91154ac21e396957b05997bb3 100644 (file)
@@ -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));
                }
index dd72fe33d15359487ad22be478ebd9292331463d..6f17797ada95b88c45961f23f7a6b9ca5cf212ad 100644 (file)
@@ -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));
                        }
 
index 2c87ad10a2aecb6210b105bb8e1c7df58de1b3c0..3c007befc8ecc1916da6070189da4d2ec9988ef0 100644 (file)
@@ -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,
index d1294e679846624ff86940e2bf10d95b3aad138c..095976248c5111e651cf1b073d81369e43e9d7e0 100644 (file)
@@ -242,7 +242,7 @@ private:
                FormatMismatch
        };
        ///
-       ReturnValues readUIFile(support::FileName);
+       ReturnValues readUIFile(support::FileName const & ui_path);
        ///
        void setGuiLanguage();
        ///
index 195b0d349bda67d8f599f9314f6c4f2cba8024ce..c66a6d372ce686a1166fe470c248d5e6f13448de 100644 (file)
@@ -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;
index 13a808763cfb6c6d72bb1dd71725dc2137fe3ff7..6859b7337e29aa8714ea3999f9f99af1ed8e7d14 100644 (file)
@@ -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
                ); //
index 422315a03eb21a08ea800d807f1a77d47d38d85d..59e59005b772c25302dea9dbdedbfb0577ef9e95 100644 (file)
@@ -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,
index d282df95263ae6c568d7e05ef026113ed7f65928..d1da5b337f151608d8b07967d516ebb45c3bcedf 100644 (file)
@@ -244,7 +244,7 @@ void GuiCompare::progressMax(int max) const
 }
 
 
-void GuiCompare::setStatusMessage(QString msg)
+void GuiCompare::setStatusMessage(QString const & msg)
 {
        statusBar->showMessage(msg);
 }
index 6d608876d3b617c480263a4fc78eea3b3a6a3b86..649ba5c1553693513511c13d4d9de3836cdd5e0f 100644 (file)
@@ -57,7 +57,7 @@ private Q_SLOTS:
        ///
        void progressMax(int) const;
        ///
-       void setStatusMessage(QString);
+       void setStatusMessage(QString const &);
 
 private:
        ///
index 8dc97ffe17bdf186d1aeb3214a8b975032546fdf..4e2eff7d0dddc2cdc261b1c346a57a024f8591f5 100644 (file)
@@ -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));
index 0244bfdfe88236cf2539814085a8d8e79c715458..ca874f6078be5ed97f511f8f4bf68f6a3cf8cbee 100644 (file)
@@ -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();
index 5616ac0c2d556eb09bc3e6e0b0a9e12a2c7a8bd7..9e1caf929506c205755102be8120812dbcb6a883 100644 (file)
@@ -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());
index d9074cb427c0f3a6050374bc1bcf26b4a1a90f4c..79bbf5603e85fc9ec31e435c6618a25d61fa5b7a 100644 (file)
@@ -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
index faf88039bbd53a32f1ee5c7c63a608255ee948f1..79064dfd87551b48fc341b715a2694657318b419 100644 (file)
@@ -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();
 }
index 11a511db2eafeb961d080d6d00652e9491743035..3bc368ac6224f3a6c2df2f5ff1b10e5c7efa8420 100644 (file)
@@ -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:
index 83be3477377991b332d6715907dcd4e9c218e1b6..5884ac4009106ddc53cdb719579117761d682da5 100644 (file)
@@ -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(":")))) {
index 1f5e36ec4d25779c8c98405cf8ef0a6305676f8b..e0e93afad97c1de4093f363260493c7eb6be86a5 100644 (file)
@@ -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();
index 5937ae9707d7b2a0f62b66fd3283fc2ec875995c..c1f74f8c3697c90d225b4dad77214dabad2378e8 100644 (file)
@@ -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()));
index 8e1790a2bb503629ded824a6c7f676c839737f2d..6f24ff313c579b6aa4d81003772d670e6cacbe4e 100644 (file)
@@ -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();
index a138091c4ed4761b123b718e4b134c01a9b07870..b6a0a424eed22bb73d6451f6170152aabe5cf815 100644 (file)
@@ -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;
 
index 45cc6112d2226ab2e64966baf7bec827615d72fd..de2b07a1ee3ffa57cfd25fa113ad3d39fe8788d2 100644 (file)
@@ -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());
 }
index f606444ede5483c91539106d2526ce6850b63ccc..bb578117e2de311b035499f9940787be8c10befe 100644 (file)
@@ -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")
index 6d15c6886abf65e5f7b2b7a6176e687ce0e58208..c3fd15fed5a700825e164f6b92569af9e420dc6d 100644 (file)
@@ -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;
 
index d30f2efc68231df60a84f7ca2b5167c17341c5b9..063691b154af0aaaf6ad05c5a6fb3b91e8bbdc0c 100644 (file)
@@ -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") {
index 00d9bc1fbba84dae5c13d3ca925b444129a2fe90..e6c98920257144da46704d8198822e4a83b99440 100644 (file)
@@ -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;
 }
index 6f7a1a40e5a705c246989deb4123fa935de52b80..f72b9a639658ae0c1585ea441d46f76ee152cd62 100644 (file)
@@ -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;
index 6ce6b5af072074d6c8b32dffa6cf0c7e42d1d573..bccaaccf78019db078c0a79aef79805a476fbeee 100644 (file)
@@ -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;
 
        ///
index fef88a99439a10fcd18b03633b004a63945225f0..783e374f624492c6c8e5e9bd51b49117c2abea97 100644 (file)
@@ -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) {
index 87f781aa7adb1e71936b8ccf03d9c73dad304e2c..df834491916fef5d0796915fb952818a692aada3 100644 (file)
@@ -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;
        ///
index de4253e808d5f7f05b34bc5184a8089429f50ed6..b677c391903c0eba87d07981aa90d8a33e329651 100644 (file)
@@ -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);
        }
index f07b2e6409dd1a52fa2a38909b1a72c3f45bef29..332d2a1454cfb1e55c75cea5e75b667081b34270 100644 (file)
@@ -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")
index 112b66a43bc9848cedb5f7b34988b7d50f83e392..da10cd11883d428a1f2c2143edd1878f8686fe76 100644 (file)
@@ -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; }
index 98324d1b253201e8d096541e0c069db335f26e28..92855022a7b43282133032088f3737aca37c4c15 100644 (file)
@@ -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
index 52cc04ae6b696240ccf1459282dc2022f8821f80..700601c42815fd87414da9f89e59b6d5609e4ef7 100644 (file)
@@ -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
 
index 6d6674dce915773081eac0e445a050d12b808699..0233c419080c54fb29c6d7e23c7c2346cb8c5e68 100644 (file)
@@ -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);
 }
index e66af9972f7e0b4cb17ba9fa0c35b09b8006ce1c..24adf30ee6ce3c0b07e9cc86dc06824a66aa82e9 100644 (file)
@@ -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);
 
index 57253650f741060f215624dadd4de28bf7f10f8d..795628bddf5a55f21ec431ef2a27b96999ce261a 100644 (file)
@@ -129,7 +129,7 @@ void iparserdocstream::putback(char_type c)
 }
 
 
-void iparserdocstream::putback(docstring s)
+void iparserdocstream::putback(docstring const & s)
 {
        s_ = s + s_;
 }
index 41384599c25bd5da1d5abf7760aceab7e8e2ffe6..9f174c8a0bbeadf9a22e6afd98a68727dd83d815 100644 (file)
@@ -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);
index 55a64af28a94ffb63c74aa2df91bbf751d191bcc..8ecfa6837489d1162d363d798cb62d796878ad9c 100644 (file)
@@ -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) {
index e431f3665a46cff1256530f5c9e38391e3f570e6..e06ba2dd27ab240388c821fee996d6093a683a8a 100644 (file)
@@ -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;