From 0a4ff764e9e7589d5dcf379900062747ce5106e0 Mon Sep 17 00:00:00 2001 From: Chris Hennes Date: Mon, 8 Feb 2021 09:42:37 -0600 Subject: [PATCH] LGTM: Move seq->next out of loop control LGTM points out that the construct use in the loop here "does nothing" -- that is, it is a conditional whose result is never used. It is apparently being used simply to ensure that the next() function is called on each loop iteration, but because sequence may be null, it is shoehorned into a trinary :? operator. To clarify the intent and ensure that later readers (including LGTM) do not misunderstand it, this code is broken out into a more standard conditional construct at the end of each loop iteration. --- src/App/Document.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/App/Document.cpp b/src/App/Document.cpp index c7ddf9dde3..3c9cfc041b 100644 --- a/src/App/Document.cpp +++ b/src/App/Document.cpp @@ -3484,7 +3484,7 @@ int Document::recompute(const std::vector &objs, bool forc if(canAbort) seq.reset(new Base::SequencerLauncher("Recompute...", topoSortedObjects.size())); FC_LOG("Recompute pass " << passes); - for (;idxnext(true):true),++idx) { + for (; idx < topoSortedObjects.size(); ++idx) { auto obj = topoSortedObjects[idx]; if(!obj->getNameInDocument() || filter.find(obj)!=filter.end()) continue; @@ -3515,6 +3515,8 @@ int Document::recompute(const std::vector &objs, bool forc for (auto inObjIt : obj->getInList()) inObjIt->enforceRecompute(); } + if (seq) + seq->next(true); } // check if all objects are recomputed but still thouched for (size_t i=0;i