Fix (MSVC) compiler warnings

reg. `size_t` vs. `int`
This commit is contained in:
Joachim Schmitz 2022-04-13 15:52:28 +02:00 committed by Igor Korsukov
parent f989fd3cfb
commit 9930191adb
8 changed files with 24 additions and 24 deletions

View file

@ -91,7 +91,7 @@ bool MidiFile::write(QIODevice* out)
write("MThd", 4);
writeLong(6); // header len
writeShort(_format); // format
writeShort(_tracks.size());
writeShort(static_cast<int>(_tracks.size()));
writeShort(_division);
for (const auto& t: _tracks) {
if (writeTrack(t)) {
@ -928,14 +928,14 @@ void MidiFile::separateChannel()
}
}
mt.setOutChannel(channel.empty() ? 0 : channel[0]);
int nn = channel.size();
size_t nn = channel.size();
if (nn <= 1) {
continue;
}
std::sort(channel.begin(), channel.end());
// -- split --
// insert additional tracks, assign to them found channels
for (int ii = 1; ii < nn; ++ii) {
for (size_t ii = 1; ii < nn; ++ii) {
MidiTrack t;
t.setOutChannel(channel[ii]);
_tracks.insert(_tracks.begin() + i + ii, t);

View file

@ -117,7 +117,7 @@ void LayoutPage::collectPage(const LayoutOptions& options, LayoutContext& ctx)
// re-calculate positions for systems before current
// (they may have been filled on previous layout)
int pSystems = ctx.page->systems().size();
size_t pSystems = ctx.page->systems().size();
if (pSystems > 0) {
ctx.page->system(0)->restoreLayout2();
y = ctx.page->system(0)->y() + ctx.page->system(0)->height();
@ -342,7 +342,7 @@ void LayoutPage::layoutPage(const LayoutContext& ctx, Page* page, qreal restHeig
}
Score* score = ctx.score();
int gaps = page->systems().size() - 1;
int gaps = static_cast<int>(page->systems().size()) - 1;
std::vector<System*> sList;

View file

@ -498,7 +498,7 @@ void BagpipeEmbellishment::layout()
SymId flagsym = SymId::flag32ndUp;
noteList nl = getNoteList();
BEDrawingDataX dx(headsym, flagsym, magS(), score()->spatium(), nl.size());
BEDrawingDataX dx(headsym, flagsym, magS(), score()->spatium(), static_cast<int>(nl.size()));
setbbox(RectF());
/*
@ -612,7 +612,7 @@ void BagpipeEmbellishment::draw(mu::draw::Painter* painter) const
SymId flagsym = SymId::flag32ndUp;
noteList nl = getNoteList();
BEDrawingDataX dx(headsym, flagsym, magS(), score()->spatium(), nl.size());
BEDrawingDataX dx(headsym, flagsym, magS(), score()->spatium(), static_cast<int>(nl.size()));
Pen pen(curColor(), dx.lw, PenStyle::SolidLine, PenCapStyle::FlatCap);
painter->setPen(pen);

View file

@ -1879,7 +1879,7 @@ EngravingItem* Note::drop(EditData& data)
noteList nl = b->getNoteList();
// add grace notes in reverse order, as setGraceNote adds a grace note
// before the current note
for (int i = nl.size() - 1; i >= 0; --i) {
for (int i = static_cast<int>(nl.size()) - 1; i >= 0; --i) {
int p = BagpipeEmbellishment::BagpipeNoteInfoList[nl.at(i)].pitch;
score()->setGraceNote(ch, p, NoteType::GRACE32, Constant::division / 8);
}

View file

@ -1118,11 +1118,11 @@ QList<System*> Score::searchSystem(const PointF& pos, const System* preferredSys
qreal y = pos.y() - page->pos().y(); // transform to page relative
const std::vector<System*>* sl = &page->systems();
qreal y2;
int n = sl->size();
for (int i = 0; i < n; ++i) {
size_t n = sl->size();
for (size_t i = 0; i < n; ++i) {
System* s = sl->at(i);
System* ns = 0; // next system row
int ii = i + 1;
size_t ii = i + 1;
for (; ii < n; ++ii) {
ns = sl->at(ii);
if (ns->y() != s->y()) {
@ -1145,7 +1145,7 @@ QList<System*> Score::searchSystem(const PointF& pos, const System* preferredSys
}
if (y < y2) {
systems.append(s);
for (int iii = i + 1; ii < n; ++iii) {
for (size_t iii = i + 1; ii < n; ++iii) {
if (sl->at(iii)->y() != s->y()) {
break;
}

View file

@ -100,7 +100,7 @@ EngravingObject* Page::scanChild(int idx) const
int Page::scanChildCount() const
{
return systems().size();
return static_cast<int>(systems().size());
}
//---------------------------------------------------------

View file

@ -579,7 +579,7 @@ Fraction BBFile::processPendingNotes(Score* score, QList<MNote*>* notes, const F
//
// look for len of shortest note
//
foreach (const MNote* n, * notes) {
for (const MNote* n : *notes) {
if (n->mc.duration() < len.ticks()) {
len = Fraction::fromTicks(n->mc.duration());
}
@ -607,7 +607,7 @@ Fraction BBFile::processPendingNotes(Score* score, QList<MNote*>* notes, const F
chord->setTicks(d.fraction());
s->add(chord);
foreach (MNote* n, * notes) {
for (MNote* n : *notes) {
std::vector<Event>& nl = n->mc.notes();
for (size_t i = 0; i < nl.size(); ++i) {
const Event& mn = nl[i];
@ -623,10 +623,10 @@ Fraction BBFile::processPendingNotes(Score* score, QList<MNote*>* notes, const F
chord->setStemDirection(drumset->stemDirection(mn.pitch()));
}
}
if (n->ties[i]) {
n->ties[i]->setEndNote(note);
n->ties[i]->setTrack(note->track());
note->setTieBack(n->ties[i]);
if (n->ties[static_cast<int>(i)]) {
n->ties[static_cast<int>(i)]->setEndNote(note);
n->ties[static_cast<int>(i)]->setTrack(note->track());
note->setTieBack(n->ties[static_cast<int>(i)]);
}
}
if (n->mc.duration() <= len.ticks()) {
@ -636,9 +636,9 @@ Fraction BBFile::processPendingNotes(Score* score, QList<MNote*>* notes, const F
for (size_t i = 0; i < nl.size(); ++i) {
const Event& mn = nl[i];
Note* note = chord->findNote(mn.pitch());
n->ties[i] = Factory::createTie(score->dummy());
n->ties[i]->setStartNote(note);
note->setTieFor(n->ties[i]);
n->ties[static_cast<int>(i)] = Factory::createTie(score->dummy());
n->ties[static_cast<int>(i)]->setStartNote(note);
note->setTieFor(n->ties[static_cast<int>(i)]);
}
n->mc.setOntime(n->mc.ontime() + len.ticks());
n->mc.setLen(n->mc.duration() - len.ticks());
@ -962,7 +962,7 @@ void BBTrack::cleanup()
void BBTrack::findChords()
{
EventList dl;
int n = _events.size();
size_t n = _events.size();
Drumset* drumset;
if (_drumTrack) {

View file

@ -6755,7 +6755,7 @@ bool MeasureNumberStateHandler::isFirstActualMeasure() const
static System* findLastSystemWithMeasures(const Page* const page)
{
for (int i = page->systems().size() - 1; i >= 0; --i) {
for (int i = static_cast<int>(page->systems().size()) - 1; i >= 0; --i) {
const auto s = page->systems().at(i);
const auto m = s->firstMeasure();
if (m) {