From 0c5b986fc45f0aaa51aa2dd64d1bd24a82e3018b Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 7 Nov 2016 08:28:41 +0100 Subject: [PATCH] output/winmm: use range-based "for" --- src/output/plugins/WinmmOutputPlugin.cxx | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/output/plugins/WinmmOutputPlugin.cxx b/src/output/plugins/WinmmOutputPlugin.cxx index b979d4b68..7301cf369 100644 --- a/src/output/plugins/WinmmOutputPlugin.cxx +++ b/src/output/plugins/WinmmOutputPlugin.cxx @@ -193,8 +193,8 @@ WinmmOutput::Open(AudioFormat &audio_format, Error &) throw MakeWaveOutError(result, "waveOutOpen() failed"); } - for (unsigned i = 0; i < ARRAY_SIZE(buffers); ++i) - memset(&buffers[i].hdr, 0, sizeof(buffers[i].hdr)); + for (auto &i : buffers) + memset(&i.hdr, 0, sizeof(i.hdr)); next_buffer = 0; @@ -204,8 +204,8 @@ WinmmOutput::Open(AudioFormat &audio_format, Error &) void WinmmOutput::Close() { - for (unsigned i = 0; i < ARRAY_SIZE(buffers); ++i) - buffers[i].buffer.Clear(); + for (auto &i : buffers) + i.buffer.Clear(); waveOutClose(handle); @@ -295,11 +295,8 @@ WinmmOutput::Stop() { waveOutReset(handle); - for (unsigned i = 0; i < ARRAY_SIZE(buffers); ++i) { - WinmmBuffer *buffer = &buffers[i]; - waveOutUnprepareHeader(handle, &buffer->hdr, - sizeof(buffer->hdr)); - } + for (auto &i : buffers) + waveOutUnprepareHeader(handle, &i.hdr, sizeof(i.hdr)); } void