diff options
author | Chris Robinson <[email protected]> | 2019-03-12 09:56:02 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2019-03-12 09:56:02 -0700 |
commit | 24ae12f58ee42440d15a9d44a0e4c9607758de68 (patch) | |
tree | e3f5ddaa32723e9f754be40d3b0154a1a0717045 /Alc/mixvoice.cpp | |
parent | 098c7ca6ea99cbe01f411ffd87c11a37d86cb24c (diff) |
Check a value where its used
Diffstat (limited to 'Alc/mixvoice.cpp')
-rw-r--r-- | Alc/mixvoice.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Alc/mixvoice.cpp b/Alc/mixvoice.cpp index 9f32db0e..3823963b 100644 --- a/Alc/mixvoice.cpp +++ b/Alc/mixvoice.cpp @@ -335,6 +335,8 @@ ALsizei LoadBufferStatic(ALbufferlistitem *BufferListItem, ALbufferlistitem *&Bu ); return CompLen; }; + /* It's impossible to have a buffer list item with no entries. */ + ASSUME(BufferListItem->num_buffers > 0); auto buffers_end = BufferListItem->buffers + BufferListItem->num_buffers; FilledAmt += std::accumulate(BufferListItem->buffers, buffers_end, ALsizei{0}, load_buffer); @@ -359,6 +361,7 @@ ALsizei LoadBufferStatic(ALbufferlistitem *BufferListItem, ALbufferlistitem *&Bu ); return CompLen; }; + ASSUME(BufferListItem->num_buffers > 0); auto buffers_end = BufferListItem->buffers + BufferListItem->num_buffers; FilledAmt += std::accumulate(BufferListItem->buffers, buffers_end, ALsizei{0}, load_buffer); @@ -423,6 +426,7 @@ ALsizei LoadBufferQueue(ALbufferlistitem *BufferListItem, ALbufferlistitem *Buff buffer->mFmtType, DataSize); return CompLen; }; + ASSUME(BufferListItem->num_buffers > 0); auto buffers_end = BufferListItem->buffers + BufferListItem->num_buffers; FilledAmt += std::accumulate(BufferListItem->buffers, buffers_end, ALsizei{0}, load_buffer); @@ -545,9 +549,6 @@ void MixVoice(ALvoice *voice, ALvoice::State vstate, const ALuint SourceID, ALCc DstBufferSize &= ~3; } - /* It's impossible to have a buffer list item with no entries. */ - assert(!BufferListItem || BufferListItem->num_buffers > 0); - for(ALsizei chan{0};chan < NumChannels;chan++) { auto &SrcData = Device->SourceData; |