[LyX/master] Remove redundant `const &` for primitive types

Yuriy Skalko yuriy.skalko at gmail.com
Mon Oct 19 09:22:02 UTC 2020


commit 65c88f0a0a3d74dcc0a0009bb60ee6e74eeedccc
Author: Yuriy Skalko <yuriy.skalko at gmail.com>
Date:   Fri Oct 16 10:19:34 2020 +0300

    Remove redundant `const &` for primitive types
---
 src/BufferView.cpp                  |    2 +-
 src/BufferView.h                    |    2 +-
 src/Encoding.cpp                    |    4 ++--
 src/Encoding.h                      |    4 ++--
 src/Font.cpp                        |    6 +++---
 src/Font.h                          |    6 +++---
 src/LaTeXFonts.cpp                  |    3 +--
 src/LaTeXFonts.h                    |    2 +-
 src/TextClass.h                     |    2 +-
 src/frontends/alert.h               |    2 +-
 src/frontends/qt/FloatPlacement.cpp |    2 +-
 src/frontends/qt/FloatPlacement.h   |    2 +-
 src/frontends/qt/GuiAlert.cpp       |    4 ++--
 src/frontends/qt/qt_helpers.cpp     |    2 +-
 src/frontends/qt/qt_helpers.h       |    2 +-
 src/tests/check_layout.cpp          |    2 +-
 src/tex2lyx/Parser.cpp              |    2 +-
 src/tex2lyx/Parser.h                |    2 +-
 src/tex2lyx/dummy_impl.cpp          |    3 +--
 19 files changed, 26 insertions(+), 28 deletions(-)

diff --git a/src/BufferView.cpp b/src/BufferView.cpp
index 576bc67..88fe8fa 100644
--- a/src/BufferView.cpp
+++ b/src/BufferView.cpp
@@ -3410,7 +3410,7 @@ docstring const & BufferView::inlineCompletion() const
 }
 
 
-size_t const & BufferView::inlineCompletionUniqueChars() const
+size_t BufferView::inlineCompletionUniqueChars() const
 {
 	return d->inlineCompletionUniqueChars_;
 }
diff --git a/src/BufferView.h b/src/BufferView.h
index 4a020eb..22f0d92 100644
--- a/src/BufferView.h
+++ b/src/BufferView.h
@@ -219,7 +219,7 @@ public:
 	/// return the inline completion postfix.
 	docstring const & inlineCompletion() const;
 	/// return the number of unique characters in the inline completion.
-	size_t const & inlineCompletionUniqueChars() const;
+	size_t inlineCompletionUniqueChars() const;
 	/// return the position in the buffer of the inline completion postfix.
 	DocIterator const & inlineCompletionPos() const;
 	/// make sure inline completion position is OK
diff --git a/src/Encoding.cpp b/src/Encoding.cpp
index 64bb3c0..4dcede4 100644
--- a/src/Encoding.cpp
+++ b/src/Encoding.cpp
@@ -643,7 +643,7 @@ Encodings::fromLyXName(string const & name, bool allowUnsafe) const
 
 
 Encoding const *
-Encodings::fromLaTeXName(string const & n, int const & p, bool allowUnsafe) const
+Encodings::fromLaTeXName(string const & n, int p, bool allowUnsafe) const
 {
 	string name = n;
 	// FIXME: if we have to test for too many of these synonyms,
@@ -666,7 +666,7 @@ Encodings::fromLaTeXName(string const & n, int const & p, bool allowUnsafe) cons
 
 
 Encoding const *
-Encodings::fromIconvName(string const & n, int const & p, bool allowUnsafe) const
+Encodings::fromIconvName(string const & n, int p, bool allowUnsafe) const
 {
 	EncodingList::const_iterator const end = encodinglist.end();
 	for (EncodingList::const_iterator it = encodinglist.begin(); it != end; ++it)
diff --git a/src/Encoding.h b/src/Encoding.h
index 76b022d..6a96843 100644
--- a/src/Encoding.h
+++ b/src/Encoding.h
@@ -255,10 +255,10 @@ public:
 	fromLyXName(std::string const & name, bool allowUnsafe = false) const;
 	/// Get encoding from LaTeX name \p name and package \p package
 	Encoding const * fromLaTeXName(std::string const & name,
-		int const & package = Encoding::any, bool allowUnsafe = false) const;
+		int package = Encoding::any, bool allowUnsafe = false) const;
 	/// Get encoding from iconv name \p name and package \p package
 	Encoding const * fromIconvName(std::string const & name,
-		int const & package = Encoding::any, bool allowUnsafe = false) const;
+		int package = Encoding::any, bool allowUnsafe = false) const;
 
 	///
 	const_iterator begin() const { return encodinglist.begin(); }
diff --git a/src/Font.cpp b/src/Font.cpp
index fda0854..aed8059 100644
--- a/src/Font.cpp
+++ b/src/Font.cpp
@@ -228,8 +228,8 @@ int Font::latexWriteStartChanges(otexstream & os, BufferParams const & bparams,
 				    OutputParams const & runparams,
 				    Font const & base,
 				    Font const & prev,
-				    bool const & non_inherit_inset,
-				    bool const & needs_cprotection) const
+				    bool non_inherit_inset,
+				    bool needs_cprotection) const
 {
 	int count = 0;
 
@@ -522,7 +522,7 @@ int Font::latexWriteEndChanges(otexstream & os, BufferParams const & bparams,
 				  Font const & base,
 				  Font const & next,
 				  bool & needPar,
-				  bool const & closeLanguage) const
+				  bool closeLanguage) const
 {
 	int count = 0;
 
diff --git a/src/Font.h b/src/Font.h
index 9b08c83..fdcdb7d 100644
--- a/src/Font.h
+++ b/src/Font.h
@@ -76,8 +76,8 @@ public:
 				   OutputParams const & runparams,
 				   Font const & base,
 				   Font const & prev,
-				   bool const & non_inherit_inset = false,
-				   bool const & needs_cprotection = false) const;
+				   bool non_inherit_inset = false,
+				   bool needs_cprotection = false) const;
 
 	/** Writes the tail of the LaTeX needed to change to this font.
 	    Returns number of chars written. Base is the font state we want
@@ -88,7 +88,7 @@ public:
 				 Font const & base,
 				 Font const & next,
 				 bool & needPar,
-				 bool const & closeLanguage = true) const;
+				 bool closeLanguage = true) const;
 
 
 	/// Build GUI description of font state
diff --git a/src/LaTeXFonts.cpp b/src/LaTeXFonts.cpp
index 16470cc..d28a7d2 100644
--- a/src/LaTeXFonts.cpp
+++ b/src/LaTeXFonts.cpp
@@ -292,8 +292,7 @@ string const LaTeXFont::getPackageOptions(bool ot1, bool complete, bool sc, bool
 
 
 string const LaTeXFont::getLaTeXCode(bool dryrun, bool ot1, bool complete, bool sc,
-				     bool osf, bool nomath, string const & extraopts,
-				     int const & scale)
+				     bool osf, bool nomath, string const & extraopts, int scale)
 {
 	ostringstream os;
 
diff --git a/src/LaTeXFonts.h b/src/LaTeXFonts.h
index 116ef08..1da7d06 100644
--- a/src/LaTeXFonts.h
+++ b/src/LaTeXFonts.h
@@ -90,7 +90,7 @@ public:
 	std::string const getLaTeXCode(bool dryrun, bool ot1, bool complete,
 				       bool sc, bool osf, bool nomath,
 				       std::string const & extraopts = std::string(),
-				       int const & scale = 100);
+				       int scale = 100);
 	/// Return the actually used font
 	docstring const getUsedFont(bool ot1, bool complete, bool nomath, bool osf);
 	/// Return the actually used package
diff --git a/src/TextClass.h b/src/TextClass.h
index 6ba185a..5314f39 100644
--- a/src/TextClass.h
+++ b/src/TextClass.h
@@ -490,7 +490,7 @@ public:
 	///
 	docstring const & htmlstyles() const { return htmlstyles_; }
 	///
-	bool const & docbookforceabstract() const { return docbookforceabstract_; }
+	bool docbookforceabstract() const { return docbookforceabstract_; }
 	///
 	std::string const & docbookroot() const { return docbookroot_; }
 	/// Looks for the layout of "highest level", other than Part (or other
diff --git a/src/frontends/alert.h b/src/frontends/alert.h
index c3b8065..20da436 100644
--- a/src/frontends/alert.h
+++ b/src/frontends/alert.h
@@ -45,7 +45,7 @@ int prompt(docstring const & title, docstring const & question,
  * The console output takes care of converting any Qt html to plain text.
  */
 void warning(docstring const & title, docstring const & message,
-	     bool const & askshowagain = false);
+	     bool askshowagain = false);
 
 /**
  * Display a warning to the user. Title should be a short (general) summary.
diff --git a/src/frontends/qt/FloatPlacement.cpp b/src/frontends/qt/FloatPlacement.cpp
index d114587..21d13e9 100644
--- a/src/frontends/qt/FloatPlacement.cpp
+++ b/src/frontends/qt/FloatPlacement.cpp
@@ -89,7 +89,7 @@ void FloatPlacement::useSideways()
 }
 
 
-bool FloatPlacement::possiblePlacement(char const & p) const
+bool FloatPlacement::possiblePlacement(char p) const
 {
 	return !spanCB->isVisible() || contains(allowed_placement_, p);
 }
diff --git a/src/frontends/qt/FloatPlacement.h b/src/frontends/qt/FloatPlacement.h
index ebcd8b6..96d45df 100644
--- a/src/frontends/qt/FloatPlacement.h
+++ b/src/frontends/qt/FloatPlacement.h
@@ -65,7 +65,7 @@ private:
 	///
 	void initFloatPlacementCO(bool const);
 	///
-	bool possiblePlacement(char const & p) const;
+	bool possiblePlacement(char p) const;
 
 	/// one of figure or table?
 	bool standardfloat_;
diff --git a/src/frontends/qt/GuiAlert.cpp b/src/frontends/qt/GuiAlert.cpp
index ce696cb..93b8e1d 100644
--- a/src/frontends/qt/GuiAlert.cpp
+++ b/src/frontends/qt/GuiAlert.cpp
@@ -150,7 +150,7 @@ int prompt(docstring const & title, docstring const & question,
 }
 
 void doWarning(docstring const & title, docstring const & message,
-	     bool const & askshowagain)
+	     bool askshowagain)
 {
 	lyxerr << "Warning: " << toPlainText(title) << '\n'
 	       << "----------------------------------------\n"
@@ -190,7 +190,7 @@ void doWarning(docstring const & title, docstring const & message,
 }
 
 void warning(docstring const & title, docstring const & message,
-	     bool const & askshowagain)
+	     bool askshowagain)
 {
 #ifdef EXPORT_in_THREAD
 	InGuiThread<void>().call(&doWarning,
diff --git a/src/frontends/qt/qt_helpers.cpp b/src/frontends/qt/qt_helpers.cpp
index fc1f961..2a35897 100644
--- a/src/frontends/qt/qt_helpers.cpp
+++ b/src/frontends/qt/qt_helpers.cpp
@@ -198,7 +198,7 @@ string widgetToDoubleStr(QLineEdit const * input)
 }
 
 
-void doubleToWidget(QLineEdit * input, double const & value, char f, int prec)
+void doubleToWidget(QLineEdit * input, double value, char f, int prec)
 {
 	QLocale loc;
 	loc.setNumberOptions(QLocale::OmitGroupSeparator);
diff --git a/src/frontends/qt/qt_helpers.h b/src/frontends/qt/qt_helpers.h
index aff144b..92c72f3 100644
--- a/src/frontends/qt/qt_helpers.h
+++ b/src/frontends/qt/qt_helpers.h
@@ -61,7 +61,7 @@ double widgetToDouble(QLineEdit const * input);
 /// method to get a double value from a localized widget (QLineEdit)
 std::string widgetToDoubleStr(QLineEdit const * input);
 /// method to set a (localized) double value in a widget (QLineEdit)
-void doubleToWidget(QLineEdit * input, double const & value,
+void doubleToWidget(QLineEdit * input, double value,
 	char f = 'g', int prec = 6);
 /// method to set a (localized) double value in a widget (QLineEdit)
 void doubleToWidget(QLineEdit * input, std::string const & value,
diff --git a/src/tests/check_layout.cpp b/src/tests/check_layout.cpp
index 2fa0fe1..039d51b 100644
--- a/src/tests/check_layout.cpp
+++ b/src/tests/check_layout.cpp
@@ -20,7 +20,7 @@ using namespace std;
 namespace lyx {
 namespace frontend {
 namespace Alert {
-void warning(docstring const & title, docstring const & message, bool const &)
+void warning(docstring const & title, docstring const & message, bool)
 {
 	LYXERR0(title);
 	LYXERR0(message);
diff --git a/src/tex2lyx/Parser.cpp b/src/tex2lyx/Parser.cpp
index e44aa3e..62cab06 100644
--- a/src/tex2lyx/Parser.cpp
+++ b/src/tex2lyx/Parser.cpp
@@ -196,7 +196,7 @@ void Parser::deparse()
 }
 
 
-bool Parser::setEncoding(std::string const & e, int const & p)
+bool Parser::setEncoding(std::string const & e, int p)
 {
 	// We may (and need to) use unsafe encodings here: Since the text is
 	// converted to unicode while reading from is_, we never see text in
diff --git a/src/tex2lyx/Parser.h b/src/tex2lyx/Parser.h
index e9afbd1..ada6b5f 100644
--- a/src/tex2lyx/Parser.h
+++ b/src/tex2lyx/Parser.h
@@ -187,7 +187,7 @@ public:
 
 	/// change the encoding of the input stream according to \p encoding
 	/// (latex name) and package \p package
-	bool setEncoding(std::string const & encoding, int const & package);
+	bool setEncoding(std::string const & encoding, int package);
 	/// change the encoding of the input stream to \p encoding (iconv name)
 	bool setEncoding(std::string const & encoding);
 	/// get the current iconv encoding of the input stream
diff --git a/src/tex2lyx/dummy_impl.cpp b/src/tex2lyx/dummy_impl.cpp
index fc5098d..961eb9a 100644
--- a/src/tex2lyx/dummy_impl.cpp
+++ b/src/tex2lyx/dummy_impl.cpp
@@ -38,8 +38,7 @@ namespace lyx {
 
 namespace frontend {
 namespace Alert {
-	void warning(docstring const & title, docstring const & message,
-				 bool const &)
+	void warning(docstring const & title, docstring const & message, bool)
 	{
 		cerr << to_utf8(title) << "\n" << to_utf8(message) << endl;
 	}


More information about the lyx-cvs mailing list