commit 4cfa5a9d2a9dd340c0b0228eba4b877ff905d458
Author: Jean-Marc Lasgouttes <[email protected]>
Date: Thu Dec 14 11:22:05 2017 +0100
Avoid assignment in if() clause
The optimization they provide is not worth it IMO.
Fixes bugs #10898, #10899, #10940.
---
src/insets/InsetBibtex.cpp | 8 +++-----
src/insets/InsetCaption.cpp | 3 ++-
src/tex2lyx/Preamble.cpp | 3 +--
3 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/src/insets/InsetBibtex.cpp b/src/insets/InsetBibtex.cpp
index 4ecb522..0db4555 100644
--- a/src/insets/InsetBibtex.cpp
+++ b/src/insets/InsetBibtex.cpp
@@ -459,11 +459,9 @@ namespace {
return false;
// read value
- bool legalChar = true;
while (ifs && !isSpace(ch) &&
- delimChars.find(ch) ==
docstring::npos &&
- (legalChar =
(illegalChars.find(ch) == docstring::npos))
- )
+ delimChars.find(ch) == docstring::npos &&
+ illegalChars.find(ch) == docstring::npos)
{
if (chCase == makeLowerCase)
val += lowercase(ch);
@@ -472,7 +470,7 @@ namespace {
ifs.get(ch);
}
- if (!legalChar) {
+ if (illegalChars.find(ch) != docstring::npos) {
ifs.putback(ch);
return false;
}
diff --git a/src/insets/InsetCaption.cpp b/src/insets/InsetCaption.cpp
index 5f7978a..8778d78 100644
--- a/src/insets/InsetCaption.cpp
+++ b/src/insets/InsetCaption.cpp
@@ -388,7 +388,8 @@ void InsetCaption::updateBuffer(ParIterator const & it,
UpdateType utype)
else
name = master.B_(tclass.floats().getType(type).name());
docstring counter = from_utf8(type);
- if ((is_subfloat_ = cnts.isSubfloat())) {
+ is_subfloat_ = cnts.isSubfloat();
+ if (is_subfloat_) {
// only standard captions allowed in subfloats
type_ = "Standard";
counter = "sub-" + from_utf8(type);
diff --git a/src/tex2lyx/Preamble.cpp b/src/tex2lyx/Preamble.cpp
index ea315dd..2b5d706 100644
--- a/src/tex2lyx/Preamble.cpp
+++ b/src/tex2lyx/Preamble.cpp
@@ -689,7 +689,6 @@ void Preamble::handle_package(Parser &p, string const &
name,
{
vector<string> options = split_options(opts);
add_package(name, options);
- char const * const * where = 0;
if (is_known(name, known_xetex_packages)) {
xetex = true;
@@ -1016,7 +1015,7 @@ void Preamble::handle_package(Parser &p, string const &
name,
else if (name == "subfig")
; // ignore this FIXME: Use the package separator mechanism
instead
- else if ((where = is_known(name, known_languages)))
+ else if (char const * const * where = is_known(name, known_languages))
h_language = known_coded_languages[where - known_languages];
else if (name == "natbib") {