From: Jean-Marc Lasgouttes Date: Thu, 14 Dec 2017 10:22:05 +0000 (+0100) Subject: Avoid assignment in if() clause X-Git-Tag: lyx-2.4.0dev-acb2ca7b~4234 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=4cfa5a9d2a9dd340c0b0228eba4b877ff905d458;p=features.git Avoid assignment in if() clause The optimization they provide is not worth it IMO. Fixes bugs #10898, #10899, #10940. --- diff --git a/src/insets/InsetBibtex.cpp b/src/insets/InsetBibtex.cpp index 4ecb522737..0db4555ce0 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 5f7978ab32..8778d78730 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 ea315dd156..2b5d7062ab 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 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") {