From cef07785d70f91decb58135df6314149e0c4f455 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Thu, 24 Apr 2014 18:51:21 -0700 Subject: [PATCH] Remove a pointless ++ and make stuff const --- src/audio_provider_ram.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/audio_provider_ram.cpp b/src/audio_provider_ram.cpp index d460c010e..edddf2173 100644 --- a/src/audio_provider_ram.cpp +++ b/src/audio_provider_ram.cpp @@ -91,18 +91,18 @@ public: }; void RAMAudioProvider::FillBuffer(void *buf, int64_t start, int64_t count) const { - char *charbuf = static_cast(buf); + auto charbuf = static_cast(buf); for (int64_t bytes_remaining = count * bytes_per_sample; bytes_remaining; ) { if (start >= decoded_samples) { memset(charbuf, 0, bytes_remaining); break; } - int i = (start * bytes_per_sample) >> CacheBits; - int start_offset = (start * bytes_per_sample) & (CacheBlockSize-1); - int read_size = std::min(bytes_remaining, CacheBlockSize - start_offset); + const int i = (start * bytes_per_sample) >> CacheBits; + const int start_offset = (start * bytes_per_sample) & (CacheBlockSize-1); + const int read_size = std::min(bytes_remaining, CacheBlockSize - start_offset); - memcpy(charbuf, &blockcache[i++][start_offset], read_size); + memcpy(charbuf, &blockcache[i][start_offset], read_size); charbuf += read_size; bytes_remaining -= read_size;