musescore-0001: CWE-407 pastedHarmony dedup uses std::vector+std::find O(A*H) in Read400/Read410/Read460::pasteStaff; fix: unordered_set O(A). 100.5x op-count speedup at H=200 harmonies pasted. 1/1 PASS. musescore-0002: CWE-312 OAuth access+refresh tokens logged verbatim via LOGD() in AbstractCloudService::onUserAuthorized(); fix: redact values. 1/1 PASS. mixxx: all 5 MOADs CLEAN. Only std::find on a 6-item capped list; all cache lookups use QHash/QSet O(1); GlobalTrackCache properly mutex-locked; no thread_local misuse; no credential values in log calls.
72 lines
3.8 KiB
Diff
72 lines
3.8 KiB
Diff
--- a/src/engraving/rw/read400/read400.cpp
|
|
+++ b/src/engraving/rw/read400/read400.cpp
|
|
@@ -331,7 +331,7 @@ bool Read400::pasteStaff(XmlReader& e, Segment* dst, staff_idx_t dstStaff, Frac
|
|
Score* score = dst->score();
|
|
ReadContext ctx(score);
|
|
ctx.setPasteMode(true);
|
|
|
|
- std::vector<Harmony*> pastedHarmony;
|
|
+ std::unordered_set<Harmony*> pastedHarmony;
|
|
std::vector<Chord*> graceNotes;
|
|
|
|
@@ -625,7 +625,7 @@ bool Read400::pasteStaff(XmlReader& e, Segment* dst, staff_idx_t dstStaff, Frac
|
|
// remove pre-existing chords on this track
|
|
// but be sure not to remove any we just added
|
|
for (EngravingItem* el : seg->findAnnotations(ElementType::HARMONY, ctx.track(), ctx.track())) {
|
|
- if (std::find(pastedHarmony.begin(), pastedHarmony.end(), el) == pastedHarmony.end()) {
|
|
+ if (pastedHarmony.find(static_cast<Harmony*>(el)) == pastedHarmony.end()) {
|
|
score->undoRemoveElement(el);
|
|
}
|
|
}
|
|
harmony->setParent(seg);
|
|
score->undoAddElement(harmony);
|
|
- pastedHarmony.push_back(harmony);
|
|
+ pastedHarmony.insert(harmony);
|
|
--- a/src/engraving/rw/read410/read410.cpp
|
|
+++ b/src/engraving/rw/read410/read410.cpp
|
|
@@ -331,7 +331,7 @@ bool Read410::pasteStaff(XmlReader& e, Segment* dst, staff_idx_t dstStaff, Frac
|
|
Score* score = dst->score();
|
|
ReadContext ctx(score);
|
|
ctx.setPasteMode(true);
|
|
|
|
- std::vector<Harmony*> pastedHarmony;
|
|
+ std::unordered_set<Harmony*> pastedHarmony;
|
|
std::vector<Chord*> graceNotes;
|
|
|
|
@@ -636,7 +636,7 @@ bool Read410::pasteStaff(XmlReader& e, Segment* dst, staff_idx_t dstStaff, Frac
|
|
// remove pre-existing chords on this track
|
|
// but be sure not to remove any we just added
|
|
for (EngravingItem* el : seg->findAnnotations(ElementType::HARMONY, ctx.track(), ctx.track())) {
|
|
- if (std::find(pastedHarmony.begin(), pastedHarmony.end(), el) == pastedHarmony.end()) {
|
|
+ if (pastedHarmony.find(static_cast<Harmony*>(el)) == pastedHarmony.end()) {
|
|
score->undoRemoveElement(el);
|
|
}
|
|
}
|
|
harmony->setParent(seg);
|
|
score->undoAddElement(harmony);
|
|
- pastedHarmony.push_back(harmony);
|
|
+ pastedHarmony.insert(harmony);
|
|
--- a/src/engraving/rw/read460/read460.cpp
|
|
+++ b/src/engraving/rw/read460/read460.cpp
|
|
@@ -331,7 +331,7 @@ bool Read460::pasteStaff(XmlReader& e, Segment* dst, staff_idx_t dstStaff, Frac
|
|
Score* score = dst->score();
|
|
ReadContext ctx(score);
|
|
ctx.setPasteMode(true);
|
|
|
|
- std::vector<Harmony*> pastedHarmony;
|
|
+ std::unordered_set<Harmony*> pastedHarmony;
|
|
std::vector<Chord*> graceNotes;
|
|
|
|
@@ -641,7 +641,7 @@ bool Read460::pasteStaff(XmlReader& e, Segment* dst, staff_idx_t dstStaff, Frac
|
|
// remove pre-existing chords on this track
|
|
// but be sure not to remove any we just added
|
|
for (EngravingItem* el : seg->findAnnotations(ElementType::HARMONY, ctx.track(), ctx.track())) {
|
|
- if (std::find(pastedHarmony.begin(), pastedHarmony.end(), el) == pastedHarmony.end()) {
|
|
+ if (pastedHarmony.find(static_cast<Harmony*>(el)) == pastedHarmony.end()) {
|
|
score->undoRemoveElement(el);
|
|
}
|
|
}
|
|
harmony->setParent(seg);
|
|
score->undoAddElement(harmony);
|
|
- pastedHarmony.push_back(harmony);
|
|
+ pastedHarmony.insert(harmony);
|