Skip to content

Commit

Permalink
Merge pull request #4221 from Jojo-Schmitz/warnings
Browse files Browse the repository at this point in the history
fix compiler warnings, seen in MinGW and MSVC
  • Loading branch information
anatoly-os committed Dec 12, 2018
2 parents 3b91bfd + 88d3736 commit 266e19c
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 26 deletions.
6 changes: 3 additions & 3 deletions libmscore/hairpin.cpp
Expand Up @@ -83,15 +83,15 @@ 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();
if (isSingleType() || isBeginType()) {
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();
Expand All @@ -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()
Expand Down
14 changes: 7 additions & 7 deletions libmscore/layout.cpp
Expand Up @@ -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 {
Expand All @@ -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));
}
}
}
Expand Down Expand Up @@ -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();
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions libmscore/layoutlinear.cpp
Expand Up @@ -47,6 +47,7 @@ extern void layoutDrumsetChord(Chord* c, const Drumset* drumset, const StaffType
// processLines
//---------------------------------------------------------

#if 0
static void processLines(System* system, std::vector<Spanner*> lines, bool align)
{
std::vector<SpannerSegment*> segments;
Expand All @@ -64,6 +65,7 @@ static void processLines(System* system, std::vector<Spanner*> lines, bool align
ss->ryoffset() = y;
}
}
#endif

//---------------------------------------------------------
// resetSystems
Expand Down
2 changes: 1 addition & 1 deletion libmscore/line.cpp
Expand Up @@ -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(); });
Expand Down
2 changes: 1 addition & 1 deletion libmscore/spanner.cpp
Expand Up @@ -1057,7 +1057,7 @@ int Spanner::reuseSegments(int number)

void Spanner::fixupSegments(unsigned int targetNumber, std::function<SpannerSegment*()> createSegment)
{
const int diff = targetNumber - segments.size();
const int diff = targetNumber - int(nsegments());
if (diff == 0)
return;
if (diff > 0) {
Expand Down
2 changes: 1 addition & 1 deletion libmscore/spanner.h
Expand Up @@ -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();

Expand Down
2 changes: 1 addition & 1 deletion libmscore/style.cpp
Expand Up @@ -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;
}
}
Expand Down
14 changes: 7 additions & 7 deletions libmscore/textbase.cpp
Expand Up @@ -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;
Expand All @@ -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();
Expand Down Expand Up @@ -2763,9 +2763,9 @@ QString TextBase::stripText(bool removeStyle, bool removeSize, bool removeFace)
}

if (!removeSize && (format.fontSize() != fmt.fontSize()))
_text += QString("<font size=\"%1\"/>").arg(format.fontSize());
_txt += QString("<font size=\"%1\"/>").arg(format.fontSize());
if (!removeFace && (format.fontFamily() != fmt.fontFamily()))
_text += QString("<font face=\"%1\"/>").arg(TextBase::escape(format.fontFamily()));
_txt += QString("<font face=\"%1\"/>").arg(TextBase::escape(format.fontFamily()));

VerticalAlignment va = format.valign();
VerticalAlignment cva = fmt.valign();
Expand All @@ -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;
}

//---------------------------------------------------------
Expand Down
6 changes: 3 additions & 3 deletions mscore/musescore.cpp
Expand Up @@ -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;
}
}
Expand Down
4 changes: 2 additions & 2 deletions mscore/scoreview.cpp
Expand Up @@ -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);
}
}
Expand Down

0 comments on commit 266e19c

Please sign in to comment.