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;