diff options
author | Niels Martin Hansen <nielsm@indvikleren.dk> | 2019-07-04 21:27:18 +0200 |
---|---|---|
committer | Niels Martin Hansen <nielsm@indvikleren.dk> | 2019-07-04 22:27:34 +0200 |
commit | 9d8a83bf8d6f1753ea7dc99faa94695c050d818c (patch) | |
tree | 8d440902614a30c8934ba478f92eb3bf1e09864b /src | |
parent | c74df8581d268c4d423bb32b0a46c0d1b4cb0e2a (diff) | |
download | openttd-9d8a83bf8d6f1753ea7dc99faa94695c050d818c.tar.xz |
Codechange: Add some const in preparation
Diffstat (limited to 'src')
-rw-r--r-- | src/music/dmusic.cpp | 12 | ||||
-rw-r--r-- | src/music/win32_m.cpp | 8 |
2 files changed, 10 insertions, 10 deletions
diff --git a/src/music/dmusic.cpp b/src/music/dmusic.cpp index 41ccd6102..f160b3f08 100644 --- a/src/music/dmusic.cpp +++ b/src/music/dmusic.cpp @@ -539,19 +539,19 @@ static void TransmitChannelMsg(IDirectMusicBuffer *buffer, REFERENCE_TIME rt, by } } -static void TransmitSysex(IDirectMusicBuffer *buffer, REFERENCE_TIME rt, byte *&msg_start, size_t &remaining) +static void TransmitSysex(IDirectMusicBuffer *buffer, REFERENCE_TIME rt, const byte *&msg_start, size_t &remaining) { /* Find end of message. */ - byte *msg_end = msg_start; + const byte *msg_end = msg_start; while (*msg_end != MIDIST_ENDSYSEX) msg_end++; msg_end++; // Also include SysEx end byte. - if (buffer->PackUnstructured(rt, 0, msg_end - msg_start, msg_start) == E_OUTOFMEMORY) { + if (buffer->PackUnstructured(rt, 0, msg_end - msg_start, const_cast<LPBYTE>(msg_start)) == E_OUTOFMEMORY) { /* Buffer is full, clear it and try again. */ _port->PlayBuffer(buffer); buffer->Flush(); - buffer->PackUnstructured(rt, 0, msg_end - msg_start, msg_start); + buffer->PackUnstructured(rt, 0, msg_end - msg_start, const_cast<LPBYTE>(msg_start)); } /* Update position in buffer. */ @@ -559,7 +559,7 @@ static void TransmitSysex(IDirectMusicBuffer *buffer, REFERENCE_TIME rt, byte *& msg_start = msg_end; } -static void TransmitSysexConst(IDirectMusicBuffer *buffer, REFERENCE_TIME rt, byte *msg_start, size_t length) +static void TransmitSysexConst(IDirectMusicBuffer *buffer, REFERENCE_TIME rt, const byte *msg_start, size_t length) { TransmitSysex(buffer, rt, msg_start, length); } @@ -752,7 +752,7 @@ static void MidiThreadProc() block_time = playback_start_time + block.realtime * MIDITIME_TO_REFTIME; DEBUG(driver, 9, "DMusic thread: Streaming block " PRINTF_SIZE " (cur=" OTTD_PRINTF64 ", block=" OTTD_PRINTF64 ")", current_block, (long long)(current_time / MS_TO_REFTIME), (long long)(block_time / MS_TO_REFTIME)); - byte *data = block.data.data(); + const byte *data = block.data.data(); size_t remaining = block.data.size(); byte last_status = 0; while (remaining > 0) { diff --git a/src/music/win32_m.cpp b/src/music/win32_m.cpp index 2abce64e2..7cdf72729 100644 --- a/src/music/win32_m.cpp +++ b/src/music/win32_m.cpp @@ -74,10 +74,10 @@ static void TransmitChannelMsg(byte status, byte p1, byte p2 = 0) midiOutShortMsg(_midi.midi_out, status | (p1 << 8) | (p2 << 16)); } -static void TransmitSysex(byte *&msg_start, size_t &remaining) +static void TransmitSysex(const byte *&msg_start, size_t &remaining) { /* find end of message */ - byte *msg_end = msg_start; + const byte *msg_end = msg_start; while (*msg_end != MIDIST_ENDSYSEX) msg_end++; msg_end++; /* also include sysex end byte */ @@ -98,7 +98,7 @@ static void TransmitSysex(byte *&msg_start, size_t &remaining) msg_start = msg_end; } -static void TransmitSysexConst(byte *msg_start, size_t length) +static void TransmitSysexConst(const byte *msg_start, size_t length) { TransmitSysex(msg_start, length); } @@ -226,7 +226,7 @@ void CALLBACK TimerCallback(UINT uTimerID, UINT, DWORD_PTR dwUser, DWORD_PTR, DW break; } - byte *data = block.data.data(); + const byte *data = block.data.data(); size_t remaining = block.data.size(); byte last_status = 0; while (remaining > 0) { |