Skip to content

Commit

Permalink
Fix MSVC compiler warnings
Browse files Browse the repository at this point in the history
reg. 'argument': conversion from 'size_t' to 'int', possible loss of data (C4267)
  • Loading branch information
Jojo-Schmitz committed Nov 8, 2024
1 parent b5220df commit f2bceb0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/engraving/dom/segment.h
Original file line number Diff line number Diff line change
Expand Up @@ -297,9 +297,9 @@ class Segment final : public EngravingItem

bool hasAccidentals() const;

EngravingItem* preAppendedItem(int track) { return m_preAppendedItems[track]; }
void preAppend(EngravingItem* item, int track) { m_preAppendedItems[track] = item; }
void clearPreAppended(int track) { m_preAppendedItems[track] = nullptr; }
EngravingItem* preAppendedItem(track_idx_t track) { return m_preAppendedItems[track]; }
void preAppend(EngravingItem* item, track_idx_t track) { m_preAppendedItems[track] = item; }
void clearPreAppended(track_idx_t track) { m_preAppendedItems[track] = nullptr; }
void addPreAppendedToShape();

bool goesBefore(const Segment* nextSegment) const;
Expand Down
10 changes: 5 additions & 5 deletions src/engraving/rendering/score/chordlayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2675,13 +2675,13 @@ void ChordLayout::appendGraceNotes(Chord* chord)
if (!gnb.empty()) {
// If this segment already contains grace notes in the same voice (could happen if a
// previous chord has appended grace-notes-after here) put them in the same vector.
EngravingItem* item = segment->preAppendedItem(static_cast<int>(track));
EngravingItem* item = segment->preAppendedItem(track);
if (item && item->isGraceNotesGroup()) {
GraceNotesGroup* gng = toGraceNotesGroup(item);
gng->insert(gng->end(), gnb.begin(), gnb.end());
} else {
gnb.setAppendedSegment(segment);
segment->preAppend(&gnb, static_cast<int>(track));
segment->preAppend(&gnb, track);
}
}

Expand All @@ -2695,7 +2695,7 @@ void ChordLayout::appendGraceNotes(Chord* chord)
}
if (followingSeg) {
gna.setAppendedSegment(followingSeg);
followingSeg->preAppend(&gna, static_cast<int>(track));
followingSeg->preAppend(&gna, track);
}
}
}
Expand All @@ -2705,8 +2705,8 @@ void ChordLayout::appendGraceNotes(Chord* chord)
* is needed and must be called AFTER horizontal spacing is calculated. */
void ChordLayout::repositionGraceNotesAfter(Segment* segment, size_t tracks)
{
for (size_t track = 0; track < tracks; track++) {
EngravingItem* item = segment->preAppendedItem(static_cast<int>(track));
for (track_idx_t track = 0; track < tracks; track++) {
EngravingItem* item = segment->preAppendedItem(track);
if (!item || !item->isGraceNotesGroup()) {
continue;
}
Expand Down
4 changes: 2 additions & 2 deletions src/engraving/rendering/score/measurelayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1005,7 +1005,7 @@ void MeasureLayout::updateGraceNotes(Measure* measure, LayoutContext& ctx)
{
// Clean everything
for (Segment& s : measure->segments()) {
for (unsigned track = 0; track < ctx.dom().ntracks(); ++track) {
for (track_idx_t track = 0; track < ctx.dom().ntracks(); ++track) {
EngravingItem* e = s.preAppendedItem(track);
if (e && e->isGraceNotesGroup()) {
s.clearPreAppended(track);
Expand Down Expand Up @@ -1035,7 +1035,7 @@ void MeasureLayout::updateGraceNotes(Measure* measure, LayoutContext& ctx)

// Layout grace note groups
for (Segment& s : measure->segments()) {
for (unsigned track = 0; track < ctx.dom().ntracks(); ++track) {
for (track_idx_t track = 0; track < ctx.dom().ntracks(); ++track) {
EngravingItem* e = s.preAppendedItem(track);
if (e && e->isGraceNotesGroup()) {
GraceNotesGroup* gng = toGraceNotesGroup(e);
Expand Down

0 comments on commit f2bceb0

Please sign in to comment.