const_cast is a nicer statement

This commit is contained in:
Jack Andersen 2016-08-28 18:20:40 -10:00
parent e45c3feef6
commit ceedda9e1f
1 changed files with 4 additions and 4 deletions

View File

@ -551,8 +551,8 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine
size_t send(const void* buf, size_t len) const size_t send(const void* buf, size_t len) const
{ {
memcpy(((MIDIOut*)this)->m_buf, buf, std::min(len, size_t(512))); memcpy(const_cast<MIDIOut*>(this)->m_buf, buf, std::min(len, size_t(512)));
((MIDIOut*)this)->m_hdr.dwBytesRecorded = len; const_cast<MIDIOut*>(this)->m_hdr.dwBytesRecorded = len;
midiStreamOut(m_strm, LPMIDIHDR(&m_hdr), sizeof(m_hdr)); midiStreamOut(m_strm, LPMIDIHDR(&m_hdr), sizeof(m_hdr));
return len; return len;
} }
@ -609,8 +609,8 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine
size_t send(const void* buf, size_t len) const size_t send(const void* buf, size_t len) const
{ {
memcpy(((MIDIOut*)this)->m_buf, buf, std::min(len, size_t(512))); memcpy(const_cast<MIDIOut*>(this)->m_buf, buf, std::min(len, size_t(512)));
((MIDIOut*)this)->m_hdr.dwBytesRecorded = len; const_cast<MIDIOut*>(this)->m_hdr.dwBytesRecorded = len;
midiStreamOut(m_strm, LPMIDIHDR(&m_hdr), sizeof(m_hdr)); midiStreamOut(m_strm, LPMIDIHDR(&m_hdr), sizeof(m_hdr));
return len; return len;
} }