Skip to content

Commit

Permalink
fix compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Jojo-Schmitz committed Oct 30, 2018
1 parent 77a8687 commit 3eab271
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 14 deletions.
1 change: 0 additions & 1 deletion all.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,6 @@
// Undefined problematic #def'd macros in Microsoft headers
#undef STRING_NONE
#undef small
#undef DELETE
#endif

#endif // __cplusplus
Expand Down
16 changes: 10 additions & 6 deletions libmscore/scorediff.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,13 +207,16 @@ int MscxModeDiff::adjustSemanticsMscxOneDiff(std::vector<TextDiff>& 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;
}
Expand Down Expand Up @@ -379,6 +382,7 @@ int MscxModeDiff::performShiftDiff(std::vector<TextDiff>& 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;
Expand Down Expand Up @@ -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]);
Expand Down
2 changes: 1 addition & 1 deletion libmscore/scorediff.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ enum class ItemType {
//---------------------------------------------------------
// DiffType
//---------------------------------------------------------

#undef DELETE
enum class DiffType {
EQUAL,
INSERT,
Expand Down
2 changes: 1 addition & 1 deletion mscore/scorecmp/scorecmp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions mscore/scorecmp/scorediffmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ int RawScoreDiffModel::rowCount(const QModelIndex& parent) const
{
if (parent.isValid())
return 0;
return _textDiffs.size();
return int(_textDiffs.size());
}

//---------------------------------------------------------
Expand Down Expand Up @@ -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());
}

//---------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion mscore/scorecmp/scorediffmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

namespace Ms {

class BaseDiff;
struct BaseDiff;
class ScoreDiff;
struct TextDiff;

Expand Down
2 changes: 1 addition & 1 deletion mscore/scorecmp/scorelistmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ int ScoreVersionListModel::rowCount(const QModelIndex& parent) const
{
if (parent.isValid())
return 0;
return _versions.size();
return int(_versions.size());
}

//---------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion mscore/scoretab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ void ScoreTab::removeTab(int idx, bool noCurrentChangedSignal)
}
}

bool blocked;
bool blocked = false;
if (noCurrentChangedSignal)
blocked = blockSignals(true);

Expand Down

0 comments on commit 3eab271

Please sign in to comment.