output/winmm: use range-based "for"

This commit is contained in:
Max Kellermann 2016-11-07 08:28:41 +01:00
parent 7b2cdd618e
commit 0c5b986fc4

View File

@ -193,8 +193,8 @@ WinmmOutput::Open(AudioFormat &audio_format, Error &)
throw MakeWaveOutError(result, "waveOutOpen() failed"); throw MakeWaveOutError(result, "waveOutOpen() failed");
} }
for (unsigned i = 0; i < ARRAY_SIZE(buffers); ++i) for (auto &i : buffers)
memset(&buffers[i].hdr, 0, sizeof(buffers[i].hdr)); memset(&i.hdr, 0, sizeof(i.hdr));
next_buffer = 0; next_buffer = 0;
@ -204,8 +204,8 @@ WinmmOutput::Open(AudioFormat &audio_format, Error &)
void void
WinmmOutput::Close() WinmmOutput::Close()
{ {
for (unsigned i = 0; i < ARRAY_SIZE(buffers); ++i) for (auto &i : buffers)
buffers[i].buffer.Clear(); i.buffer.Clear();
waveOutClose(handle); waveOutClose(handle);
@ -295,11 +295,8 @@ WinmmOutput::Stop()
{ {
waveOutReset(handle); waveOutReset(handle);
for (unsigned i = 0; i < ARRAY_SIZE(buffers); ++i) { for (auto &i : buffers)
WinmmBuffer *buffer = &buffers[i]; waveOutUnprepareHeader(handle, &i.hdr, sizeof(i.hdr));
waveOutUnprepareHeader(handle, &buffer->hdr,
sizeof(buffer->hdr));
}
} }
void void