From 3eab271def608974bf5e8d55cded0afdc77f4307 Mon Sep 17 00:00:00 2001 From: Joachim Schmitz Date: Tue, 30 Oct 2018 15:57:33 +0100 Subject: [PATCH] fix compiler warnings --- all.h | 1 - libmscore/scorediff.cpp | 16 ++++++++++------ libmscore/scorediff.h | 2 +- mscore/scorecmp/scorecmp.cpp | 2 +- mscore/scorecmp/scorediffmodel.cpp | 4 ++-- mscore/scorecmp/scorediffmodel.h | 2 +- mscore/scorecmp/scorelistmodel.cpp | 2 +- mscore/scoretab.cpp | 2 +- 8 files changed, 17 insertions(+), 14 deletions(-) diff --git a/all.h b/all.h index 15665f571e27f..ee046d8f96fff 100644 --- a/all.h +++ b/all.h @@ -218,7 +218,6 @@ // Undefined problematic #def'd macros in Microsoft headers #undef STRING_NONE #undef small - #undef DELETE #endif #endif // __cplusplus diff --git a/libmscore/scorediff.cpp b/libmscore/scorediff.cpp index e087877813f09..d17eb8e8d834f 100644 --- a/libmscore/scorediff.cpp +++ b/libmscore/scorediff.cpp @@ -207,13 +207,16 @@ int MscxModeDiff::adjustSemanticsMscxOneDiff(std::vector& diffs, int i int iScore; switch(diff->type) { case DiffType::EQUAL: - case DiffType::REPLACE: + /* FALLTROUGH */ + case DiffType::REPLACE: // TODO: split a REPLACE diff, though they should not be here return index; case DiffType::INSERT: iScore = 1; break; case DiffType::DELETE: + /* FALLTROUGH */ + default: iScore = 0; break; } @@ -379,6 +382,7 @@ int MscxModeDiff::performShiftDiff(std::vector& diffs, int index, int const int inc = down ? 1 : -1; for (int i = index; i != nextDiffIdx; i += inc) { TextDiff& d = diffs[i]; + Q_UNUSED(d); Q_ASSERT(d.type != DiffType::EQUAL); // nextDiff should be the first EQUAL diff in that direction diff.start[0] += lines; diff.end[0] += lines; @@ -1206,21 +1210,21 @@ static QString addLinePrefix(const QString& str, const QString& prefix) // only deleted chunk for REPLACE diff item. //--------------------------------------------------------- -QString TextDiff::toString(DiffType type, bool prefixLines) const +QString TextDiff::toString(DiffType dt, bool prefixLines) const { - if (type == DiffType::REPLACE) { + if (dt == DiffType::REPLACE) { QStringList l; l.push_back(toString(DiffType::DELETE, prefixLines)); l.push_back(toString(DiffType::INSERT, prefixLines)); return l.join('\n'); } - int idx = (type == DiffType::INSERT) ? 1 : 0; - const char* prefix = (type == DiffType::INSERT) ? ">" : "<"; + int idx = (dt == DiffType::INSERT) ? 1 : 0; + const char* prefix = (dt == DiffType::INSERT) ? ">" : "<"; QString lines[2]; for (int i = 0; i < 2; ++i) { - if ((i != idx && type != DiffType::EQUAL) + if ((i != idx && dt != DiffType::EQUAL) || end[i] <= start[i] ) { lines[i] = QString::number(start[i]); diff --git a/libmscore/scorediff.h b/libmscore/scorediff.h index cea7a1106ca60..8c5c0fbca7d89 100644 --- a/libmscore/scorediff.h +++ b/libmscore/scorediff.h @@ -36,7 +36,7 @@ enum class ItemType { //--------------------------------------------------------- // DiffType //--------------------------------------------------------- - +#undef DELETE enum class DiffType { EQUAL, INSERT, diff --git a/mscore/scorecmp/scorecmp.cpp b/mscore/scorecmp/scorecmp.cpp index 85ec728efb1f2..1c2a1991db5db 100644 --- a/mscore/scorecmp/scorecmp.cpp +++ b/mscore/scorecmp/scorecmp.cpp @@ -240,7 +240,7 @@ void ScoreComparisonTool::updateDiff() Score* ScoreComparisonTool::openScoreVersion(const ScoreVersion& ver) { - Score* s; + Score* s = 0; if (ver.recent) { s = ver.score; if (!s) diff --git a/mscore/scorecmp/scorediffmodel.cpp b/mscore/scorecmp/scorediffmodel.cpp index 4c0d30f3810c5..7161bf198426d 100644 --- a/mscore/scorecmp/scorediffmodel.cpp +++ b/mscore/scorecmp/scorediffmodel.cpp @@ -54,7 +54,7 @@ int RawScoreDiffModel::rowCount(const QModelIndex& parent) const { if (parent.isValid()) return 0; - return _textDiffs.size(); + return int(_textDiffs.size()); } //--------------------------------------------------------- @@ -97,7 +97,7 @@ int ScoreDiffModel::rowCount(const QModelIndex& parent) const { if (parent.isValid()) return 0; - return _diff->diffs().size(); + return int(_diff->diffs().size()); } //--------------------------------------------------------- diff --git a/mscore/scorecmp/scorediffmodel.h b/mscore/scorecmp/scorediffmodel.h index 3c87a4cb3cb1e..25ba777e09ed0 100644 --- a/mscore/scorecmp/scorediffmodel.h +++ b/mscore/scorecmp/scorediffmodel.h @@ -15,7 +15,7 @@ namespace Ms { -class BaseDiff; +struct BaseDiff; class ScoreDiff; struct TextDiff; diff --git a/mscore/scorecmp/scorelistmodel.cpp b/mscore/scorecmp/scorelistmodel.cpp index f3cb44e59cdca..2570f1ce91b79 100644 --- a/mscore/scorecmp/scorelistmodel.cpp +++ b/mscore/scorecmp/scorelistmodel.cpp @@ -161,7 +161,7 @@ int ScoreVersionListModel::rowCount(const QModelIndex& parent) const { if (parent.isValid()) return 0; - return _versions.size(); + return int(_versions.size()); } //--------------------------------------------------------- diff --git a/mscore/scoretab.cpp b/mscore/scoretab.cpp index 5180dec053282..00d7ab54530dc 100644 --- a/mscore/scoretab.cpp +++ b/mscore/scoretab.cpp @@ -447,7 +447,7 @@ void ScoreTab::removeTab(int idx, bool noCurrentChangedSignal) } } - bool blocked; + bool blocked = false; if (noCurrentChangedSignal) blocked = blockSignals(true);