identical expression
Type
Functional
Frequency
Once
Severity
S4 - Minor
Reproducibility
Always
Status
closed
Regression
No
Workaround
No
Project
/src/importexport/internal/midiimport/importmidi_simplify.cpp line 44
Code:
ReducedFraction sum(0, 1);
for (const auto& d: durations) {
sum += ReducedFraction(d.second.fraction()) / d.first;
}
return desiredLen == desiredLen; // <-- identical expression
Comments
Same code in 3.x.
I guess (!) is rather should be
return sum == desiredlen;
, but I'm not really sure.That function/method is used in some
Q_ASSERT_X()
.So that code is used only in DEBUG mode, never in any released version of MuseScore
See https://github.com/musescore/MuseScore/pull/7179 (for 3.x)
And https://github.com/musescore/MuseScore/pull/7180 (for master)
BTW: it might be helpful if you'd report all these in one go rather than little by little ;-)
only one more found:
[D:/Data/OpenSource/MuseScore-master/src/libmscore/textbase.cpp line 1983
Code:
if (r->height() == 0) {
r = &_layout[i - i].boundingRect(); // <- - same index
}
Hmm,
r = &_layout[i-i].boundingRect();
is the same asr = &_layout[0].boundingRect();
, but I wonder whether it is actually meant to ber = &_layout[i-1].boundingRect();
and whether that code just works by accident?In 3.x too, but at libmscore/textbase.cpp, line1796
Came in via 10ebbb9080
Edit: no, that commit just moved it from text.cpp to textbase.cpp
weird -- with [i - 1] the index is below zero with i = 0
Yes, guess that would need to get prevented too
Or https://github.com/musescore/MuseScore/pull/7627 (closed meanwhile too) or https://github.com/musescore/MuseScore/pull/8762
That fix though causes mtests to fail, at least in the 3.x branch
Removing that code entirely, it seems useless and wrong and only get used in Debug mode.
Fixed in branch 3.x, commit 08346483b0
_Fix #314899: Identical expression
by removing the entire thing, it seems useless, esp. that
return desiredLen == desiredLen;
and even harmful andwrong anyway._
Fixed in branch 3.x, commit 3ca622a447
_Merge pull request #7179 from Jojo-Schmitz/importmidi-simplify
[MU3] Fix #314899: Identical expression_
reopening for master
see https://github.com/musescore/MuseScore/pull/8849
Fixed in branch master, commit c265a67655
_Fix #314899: Identical expression
counterpart to #7179, but for master_
Fixed in branch master, commit c9a65fcc8c
_Merge pull request #8849 from Jojo-Schmitz/importmidi-simplify
[MU4] Fix #314899: Identical expression_
Automatically closed -- issue fixed for 2 weeks with no activity.