Skip to content

Commit 3396ec9

Browse files
committed
fixed some warnings when compiling with -Wconversion and -Wsign-conversion
1 parent 3a31a36 commit 3396ec9

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/MIDI.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ template<class SerialPort, class Settings>
375375
void MidiInterface<SerialPort, Settings>::sendTimeCodeQuarterFrame(DataByte inTypeNibble,
376376
DataByte inValuesNibble)
377377
{
378-
const byte data = (((inTypeNibble & 0x07) << 4) | (inValuesNibble & 0x0f));
378+
const byte data = byte((((inTypeNibble & 0x07) << 4) | (inValuesNibble & 0x0f)));
379379
sendTimeCodeQuarterFrame(data);
380380
}
381381

@@ -620,7 +620,7 @@ template<class SerialPort, class Settings>
620620
StatusByte MidiInterface<SerialPort, Settings>::getStatus(MidiType inType,
621621
Channel inChannel) const
622622
{
623-
return ((byte)inType | ((inChannel - 1) & 0x0f));
623+
return StatusByte(((byte)inType | ((inChannel - 1) & 0x0f)));
624624
}
625625

626626
// -----------------------------------------------------------------------------
@@ -856,7 +856,7 @@ bool MidiInterface<SerialPort, Settings>::parse()
856856

857857
// Get length
858858
mMessage.data1 = mPendingMessageIndex & 0xff; // LSB
859-
mMessage.data2 = mPendingMessageIndex >> 8; // MSB
859+
mMessage.data2 = byte(mPendingMessageIndex >> 8); // MSB
860860
mMessage.channel = 0;
861861
mMessage.valid = true;
862862

@@ -1116,7 +1116,7 @@ MidiType MidiInterface<SerialPort, Settings>::getTypeFromStatusByte(byte inStatu
11161116
template<class SerialPort, class Settings>
11171117
inline Channel MidiInterface<SerialPort, Settings>::getChannelFromStatusByte(byte inStatus)
11181118
{
1119-
return (inStatus & 0x0f) + 1;
1119+
return Channel((inStatus & 0x0f) + 1);
11201120
}
11211121

11221122
template<class SerialPort, class Settings>
@@ -1221,7 +1221,7 @@ void MidiInterface<SerialPort, Settings>::launchCallback()
12211221

12221222
// Occasional messages
12231223
case TimeCodeQuarterFrame: if (mTimeCodeQuarterFrameCallback != 0) mTimeCodeQuarterFrameCallback(mMessage.data1); break;
1224-
case SongPosition: if (mSongPositionCallback != 0) mSongPositionCallback((mMessage.data1 & 0x7f) | ((mMessage.data2 & 0x7f) << 7)); break;
1224+
case SongPosition: if (mSongPositionCallback != 0) mSongPositionCallback(unsigned((mMessage.data1 & 0x7f) | ((mMessage.data2 & 0x7f) << 7))); break;
12251225
case SongSelect: if (mSongSelectCallback != 0) mSongSelectCallback(mMessage.data1); break;
12261226
case TuneRequest: if (mTuneRequestCallback != 0) mTuneRequestCallback(); break;
12271227

0 commit comments

Comments
 (0)