Skip to content
Permalink
Browse files

fix MSVC/MinGW compiler warnings

  • Loading branch information...
Jojo-Schmitz committed Jul 12, 2019
1 parent f893709 commit a18fb7a97310f4b29cddfb0d18c64d102d98f108
@@ -832,7 +832,7 @@ class Score : public QObject, public ScoreElement {
virtual const MStyle& style() const { return _style; }

void setStyle(const MStyle& s);
bool loadStyle(const QString&, bool ignore = false);
bool loadStyle(const QString&, bool ign = false);
bool saveStyle(const QString&);

QVariant styleV(Sid idx) const { return style().value(idx); }
@@ -655,12 +655,12 @@ bool Score::saveFile(QFileInfo& info)
// loadStyle
//---------------------------------------------------------

bool Score::loadStyle(const QString& fn, bool ignore)
bool Score::loadStyle(const QString& fn, bool ign)
{
QFile f(fn);
if (f.open(QIODevice::ReadOnly)) {
MStyle st = style();
if (st.load(&f, ignore)) {
if (st.load(&f, ign)) {
undo(new ChangeStyle(this, st));
return true;
}
@@ -2422,15 +2422,15 @@ bool MStyle::readTextStyleValCompat(XmlReader& e)
// load
//---------------------------------------------------------

bool MStyle::load(QFile* qf, bool ignore)
bool MStyle::load(QFile* qf, bool ign)
{
XmlReader e(qf);
while (e.readNextStartElement()) {
if (e.name() == "museScore") {
QString version = e.attribute("version");
QStringList sl = version.split('.');
int mscVersion = sl[0].toInt() * 100 + sl[1].toInt();
if (mscVersion != MSCVERSION && !ignore)
if (mscVersion != MSCVERSION && !ign)
return false;
while (e.readNextStartElement()) {
if (e.name() == "Style")
@@ -1167,7 +1167,7 @@ class MStyle {
void setCustomChordList(bool t) { _customChordList = t; }
void checkChordList();

bool load(QFile* qf, bool ignore = false);
bool load(QFile* qf, bool ign = false);
void load(XmlReader& e);
void save(XmlWriter& xml, bool optimize);
bool readProperties(XmlReader&);
@@ -186,27 +186,27 @@ QPainterPath Tremolo::basePath() const
qreal lw = _spatium * score()->styleS(Sid::tremoloStrokeWidth).val();
qreal td = _spatium * score()->styleS(Sid::tremoloDistance).val();

QPainterPath path;
QPainterPath ppath;
qreal ty = 0.0;

for (int i = 0; i < _lines; i++) {
path.addRect(-w2, ty, 2.0 * w2, lw);
ppath.addRect(-w2, ty, 2.0 * w2, lw);
ty += td;
}

if (!parent()) {
// just for the palette
QTransform shearTransform;
shearTransform.shear(0.0, -(lw / 2.0) / w2);
path = shearTransform.map(path);
ppath = shearTransform.map(ppath);
}
else if (!twoNotes()) {
QTransform shearTransform;
shearTransform.shear(0.0, -(lw / 2.0) / w2);
path = shearTransform.map(path);
ppath = shearTransform.map(ppath);
}

return path;
return ppath;
}

//---------------------------------------------------------
@@ -467,9 +467,9 @@ void ScoreView::fotoModeCopy(bool includeLink)
printer.save(&buffer, "PNG");
buffer.close();
QString html = "<a href=\"" + url.toString() + "\"><img src=\"data:image/png," + imageData.toPercentEncoding() + "\" /></a>";
QMimeData *data = new QMimeData;
data->setHtml(html);
QApplication::clipboard()->setMimeData(data);
QMimeData *mdata = new QMimeData;
mdata->setHtml(html);
QApplication::clipboard()->setMimeData(mdata);
// TODO: add both, with priority to html
//QApplication::clipboard()->setImage(printer);
}
@@ -74,10 +74,10 @@ void InspectorBarLine::setAsStaffDefault()

Score* score = ebl->score();
score->startCmd();
for (Element* e : *inspector->el()) {
if (!e || !e->isBarLine())
for (Element* el : *inspector->el()) {
if (!el || !el->isBarLine())
continue;
BarLine* bl = toBarLine(e);
BarLine* bl = toBarLine(el);
Staff* staff = bl->staff();
if (std::find(staffList.begin(), staffList.end(), staff) == staffList.end()) {
staff->undoChangeProperty(Pid::STAFF_BARLINE_SPAN, span);
@@ -49,7 +49,7 @@ Zerberus::Zerberus()
}

freeVoices.init(this);
for (int i = 0; i < MAX_CHANNEL; ++i)
for (int i = 0; i < MAX_CHANNELS; ++i)
_channel[i] = new Channel(this, i);
busy = true; // no sf loaded yet
}
@@ -178,9 +178,10 @@ void Zerberus::play(const Ms::PlayEvent& event)
{
if (busy)
return;
if (event.channel() >= MAX_CHANNEL)
return;
Channel* cp = _channel[int(event.channel())];
static_assert(MAX_CHANNELS - 1 >= std::numeric_limits<decltype(event.channel())>::max(), "need to add a check for a channel number range");
//if (event.channel() >= MAX_CHANNELS)
// return;
Channel* cp = _channel[event.channel()];
if (cp->instrument() == 0) {
// qDebug("Zerberus::play(): no instrument for channel %d", event.channel());
return;
@@ -363,12 +364,12 @@ bool Zerberus::removeSoundFont(const QString& s)
if (it == instruments.end())
return false;
instruments.erase(it);
for (int k = 0; k < MAX_CHANNEL; ++k) {
for (int k = 0; k < MAX_CHANNELS; ++k) {
if (_channel[k]->instrument() == i)
_channel[k]->setInstrument(0);
}
if (!instruments.empty()) {
for (int ii = 0; ii < MAX_CHANNEL; ++ii) {
for (int ii = 0; ii < MAX_CHANNELS; ++ii) {
if (_channel[ii]->instrument() == 0)
_channel[ii]->setInstrument(instruments.front());
}
@@ -454,7 +455,7 @@ bool Zerberus::loadInstrument(const QString& s)
instruments.push_back(instr);
instr->setRefCount(instr->refCount() + 1);
if (instruments.size() == 1) {
for (int i = 0; i < MAX_CHANNEL; ++i)
for (int i = 0; i < MAX_CHANNELS; ++i)
_channel[i]->setInstrument(instr);
}
busy = false;
@@ -482,7 +483,7 @@ bool Zerberus::loadInstrument(const QString& s)
// set default instrument for all channels:
//
if (instruments.size() == 1) {
for (int i = 0; i < MAX_CHANNEL; ++i)
for (int i = 0; i < MAX_CHANNELS; ++i)
_channel[i]->setInstrument(instr);
}
busy = false;
@@ -30,9 +30,9 @@ class Channel;
class ZInstrument;
enum class Trigger : char;

static const int MAX_VOICES = 512;
static const int MAX_CHANNEL = 256;
static const int MAX_TRIGGER = 512;
static const int MAX_VOICES = 512;
static const int MAX_CHANNELS = 256;
static const int MAX_TRIGGER = 512;

//---------------------------------------------------------
// VoiceFifo
@@ -81,7 +81,7 @@ class Zerberus : public Ms::Synthesizer {
std::atomic<bool> busy;

std::list<ZInstrument*> instruments;
Channel* _channel[MAX_CHANNEL];
Channel* _channel[MAX_CHANNELS];

int allocatedVoices = 0;
VoiceFifo freeVoices;

0 comments on commit a18fb7a

Please sign in to comment.
You can’t perform that action at this time.