From 88d37365a6f741b9f94f0b62acc2ffc70c519cc2 Mon Sep 17 00:00:00 2001 From: Joachim Schmitz Date: Mon, 10 Dec 2018 16:33:09 +0100 Subject: [PATCH] fix compiler warnings, seen in MinGW and MSVC --- libmscore/hairpin.cpp | 6 +++--- libmscore/layout.cpp | 14 +++++++------- libmscore/layoutlinear.cpp | 2 ++ libmscore/line.cpp | 2 +- libmscore/spanner.cpp | 2 +- libmscore/spanner.h | 2 +- libmscore/style.cpp | 2 +- libmscore/textbase.cpp | 14 +++++++------- mscore/musescore.cpp | 6 +++--- mscore/scoreview.cpp | 4 ++-- 10 files changed, 28 insertions(+), 26 deletions(-) diff --git a/libmscore/hairpin.cpp b/libmscore/hairpin.cpp index fc7165d24e..5023a07f56 100644 --- a/libmscore/hairpin.cpp +++ b/libmscore/hairpin.cpp @@ -83,7 +83,7 @@ Element* HairpinSegment::drop(EditData& data) void HairpinSegment::layout() { const qreal _spatium = spatium(); - const int _track = track(); + const int _trck = track(); if (autoplace() && !score()->isPalette()) { // Try to fit between adjacent dynamics const System* sys = system(); @@ -91,7 +91,7 @@ void HairpinSegment::layout() Segment* start = hairpin()->startSegment(); Dynamic* sd = nullptr; if (start && start->system() == sys) - sd = toDynamic(start->findAnnotation(ElementType::DYNAMIC, _track, _track)); + sd = toDynamic(start->findAnnotation(ElementType::DYNAMIC, _trck, _trck)); if (sd && sd->visible() && sd->autoplace()) { const qreal sdRight = sd->bbox().right() + sd->pos().x() + sd->segment()->pos().x() + sd->measure()->pos().x(); @@ -106,7 +106,7 @@ void HairpinSegment::layout() if (end && end->tick() < sys->endTick()) { // checking ticks rather than systems since latter // systems may be unknown at layout stage. - ed = toDynamic(end->findAnnotation(ElementType::DYNAMIC, _track, _track)); + ed = toDynamic(end->findAnnotation(ElementType::DYNAMIC, _trck, _trck)); } if (ed && ed->visible() && ed->autoplace()) { const qreal edLeft = ed->bbox().left() + ed->pos().x() diff --git a/libmscore/layout.cpp b/libmscore/layout.cpp index 800ae322d1..ea6b439365 100644 --- a/libmscore/layout.cpp +++ b/libmscore/layout.cpp @@ -3281,12 +3281,12 @@ void Score::layoutSystemElements(System* system, LayoutContext& lc) for (Segment& s : m->segments()) { if (!s.enabled() || s.isTimeSigType()) // hack: ignore time signatures continue; - QPointF pos(s.pos() + m->pos()); + QPointF p(s.pos() + m->pos()); if (s.segmentType() & (SegmentType::BarLine | SegmentType::EndBarLine | SegmentType::StartRepeatBarLine | SegmentType::BeginBarLine)) { BarLine* bl = toBarLine(s.element(0)); if (bl) { qreal w = BarLine::layoutWidth(score(), bl->barLineType()); - skyline.add(QRectF(0.0, 0.0, w, spatium() * 4.0).translated(bl->pos() + pos)); + skyline.add(QRectF(0.0, 0.0, w, spatium() * 4.0).translated(bl->pos() + p)); } } else { @@ -3297,10 +3297,10 @@ void Score::layoutSystemElements(System* system, LayoutContext& lc) continue; int effectiveTrack = e->vStaffIdx() * VOICES + e->voice(); if (effectiveTrack >= strack && effectiveTrack < etrack) - skyline.add(e->shape().translated(e->pos() + pos)); + skyline.add(e->shape().translated(e->pos() + p)); if (e->isChord() && toChord(e)->tremolo()) { Tremolo* t = toChord(e)->tremolo(); - skyline.add(t->shape().translated(t->pos() + pos)); + skyline.add(t->shape().translated(t->pos() + p)); } } } @@ -3331,9 +3331,9 @@ void Score::layoutSystemElements(System* system, LayoutContext& lc) if (e->isChord()) { Chord* c = toChord(e); for (Note* note : c->notes()) { - for (Element* e : note->el()) { - if (e->isFingering()) - e->layout(); + for (Element* el : note->el()) { + if (el->isFingering()) + el->layout(); } } } diff --git a/libmscore/layoutlinear.cpp b/libmscore/layoutlinear.cpp index 6f01672674..ff55a48074 100644 --- a/libmscore/layoutlinear.cpp +++ b/libmscore/layoutlinear.cpp @@ -47,6 +47,7 @@ extern void layoutDrumsetChord(Chord* c, const Drumset* drumset, const StaffType // processLines //--------------------------------------------------------- +#if 0 static void processLines(System* system, std::vector lines, bool align) { std::vector segments; @@ -64,6 +65,7 @@ static void processLines(System* system, std::vector lines, bool align ss->ryoffset() = y; } } +#endif //--------------------------------------------------------- // resetSystems diff --git a/libmscore/line.cpp b/libmscore/line.cpp index 9a6c0cd239..89dbe38c41 100644 --- a/libmscore/line.cpp +++ b/libmscore/line.cpp @@ -863,7 +863,7 @@ void SLine::layout() ++segmentsNeeded; } - int segCount = spannerSegments().size(); + int segCount = int(spannerSegments().size()); if (segmentsNeeded != segCount) { fixupSegments(segmentsNeeded, [this]() { return createLineSegment(); }); diff --git a/libmscore/spanner.cpp b/libmscore/spanner.cpp index 4f71650163..dd59790102 100644 --- a/libmscore/spanner.cpp +++ b/libmscore/spanner.cpp @@ -1057,7 +1057,7 @@ int Spanner::reuseSegments(int number) void Spanner::fixupSegments(unsigned int targetNumber, std::function createSegment) { - const int diff = targetNumber - segments.size(); + const int diff = targetNumber - int(nsegments()); if (diff == 0) return; if (diff > 0) { diff --git a/libmscore/spanner.h b/libmscore/spanner.h index b7dd5075fd..e0cd17010b 100644 --- a/libmscore/spanner.h +++ b/libmscore/spanner.h @@ -203,7 +203,7 @@ class Spanner : public Element { const SpannerSegment* backSegment() const { return segments.back(); } SpannerSegment* segmentAt(int n) { return segments[n]; } const SpannerSegment* segmentAt(int n) const { return segments[n]; } - int nsegments() const { return segments.size(); } + size_t nsegments() const { return segments.size(); } bool segmentsEmpty() const { return segments.empty(); } void eraseSpannerSegments(); diff --git a/libmscore/style.cpp b/libmscore/style.cpp index 54ca6ae501..0e49c12cbc 100644 --- a/libmscore/style.cpp +++ b/libmscore/style.cpp @@ -2156,7 +2156,7 @@ bool MStyle::readTextStyleValCompat(XmlReader& e) for (auto& fontStyle : styleNamesEndings) { if (tag.endsWith(fontStyle.first)) { readFontStyle = fontStyle.second; - typeName = tag.mid(0, tag.length() - strlen(fontStyle.first)); + typeName = tag.mid(0, tag.length() - int(strlen(fontStyle.first))); break; } } diff --git a/libmscore/textbase.cpp b/libmscore/textbase.cpp index c0f3127853..15e27b87a2 100644 --- a/libmscore/textbase.cpp +++ b/libmscore/textbase.cpp @@ -2704,7 +2704,7 @@ bool TextBase::hasCustomFormatting() const QString TextBase::stripText(bool removeStyle, bool removeSize, bool removeFace) const { - QString _text; + QString _txt; bool bold_ = false; bool italic_ = false; bool underline_ = false; @@ -2726,7 +2726,7 @@ QString TextBase::stripText(bool removeStyle, bool removeSize, bool removeFace) fmt.setPreedit(false); fmt.setValign(VerticalAlignment::AlignNormal); - XmlNesting xmlNesting(&_text); + XmlNesting xmlNesting(&_txt); if (!removeStyle) { if (bold_) xmlNesting.pushB(); @@ -2763,9 +2763,9 @@ QString TextBase::stripText(bool removeStyle, bool removeSize, bool removeFace) } if (!removeSize && (format.fontSize() != fmt.fontSize())) - _text += QString("").arg(format.fontSize()); + _txt += QString("").arg(format.fontSize()); if (!removeFace && (format.fontFamily() != fmt.fontFamily())) - _text += QString("").arg(TextBase::escape(format.fontFamily())); + _txt += QString("").arg(TextBase::escape(format.fontFamily())); VerticalAlignment va = format.valign(); VerticalAlignment cva = fmt.valign(); @@ -2782,15 +2782,15 @@ QString TextBase::stripText(bool removeStyle, bool removeSize, bool removeFace) break; } } - _text += XmlWriter::xmlString(f.text); + _txt += XmlWriter::xmlString(f.text); fmt = format; } if (block.eol()) - _text += QChar::LineFeed; + _txt += QChar::LineFeed; } while (!xmlNesting.empty()) xmlNesting.popToken(); - return _text; + return _txt; } //--------------------------------------------------------- diff --git a/mscore/musescore.cpp b/mscore/musescore.cpp index 81bd2464f6..e14436fbb0 100644 --- a/mscore/musescore.cpp +++ b/mscore/musescore.cpp @@ -4350,9 +4350,9 @@ void MuseScore::play(Element* e, int pitch) const Note* masterNote = note; if (note->linkList().size() > 1) { - for (ScoreElement* se : note->linkList()) { - if (se->score() == note->masterScore() && se->isNote()) { - masterNote = toNote(se); + for (ScoreElement* se_ : note->linkList()) { + if (se_->score() == note->masterScore() && se_->isNote()) { + masterNote = toNote(se_); break; } } diff --git a/mscore/scoreview.cpp b/mscore/scoreview.cpp index 59f191cee7..05f8ea886e 100644 --- a/mscore/scoreview.cpp +++ b/mscore/scoreview.cpp @@ -1132,8 +1132,8 @@ void ScoreView::paint(const QRect& r, QPainter& p) QPointF pt(system->ipos()); qreal h = system->minBottom() + system->minTop(); p.translate(pt); - QRectF r(0.0, -system->minTop(), system->width(), h); - p.drawRect(r); + QRectF rect(0.0, -system->minTop(), system->width(), h); + p.drawRect(rect); p.translate(-pt); } }