Commit 666e5d79 authored by Max Kellermann's avatar Max Kellermann

input/CdioParanoia: use integer modulo to calculate "diff"

parent 3613407a
......@@ -296,6 +296,8 @@ CdioParanoiaInputStream::Read(std::unique_lock<Mutex> &,
const int16_t *rbuf;
const lsn_t lsn_relofs = offset / CDIO_CD_FRAMESIZE_RAW;
const std::size_t diff = offset % CDIO_CD_FRAMESIZE_RAW;
if (lsn_relofs != buffer_lsn) {
const ScopeUnlock unlock(mutex);
......@@ -320,11 +322,6 @@ CdioParanoiaInputStream::Read(std::unique_lock<Mutex> &,
rbuf = (const int16_t *)buffer;
}
//correct offset
const int diff = offset - lsn_relofs * CDIO_CD_FRAMESIZE_RAW;
assert(diff >= 0 && diff < CDIO_CD_FRAMESIZE_RAW);
const size_t maxwrite = CDIO_CD_FRAMESIZE_RAW - diff; //# of bytes pending in current buffer
const std::size_t nbytes = std::min(length, maxwrite);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment