Commit 1080c917 authored by Max Kellermann's avatar Max Kellermann

input/CdioParanoia: use std::min()

parent 8eb31648
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include "Log.hxx" #include "Log.hxx"
#include "config/Block.hxx" #include "config/Block.hxx"
#include <algorithm>
#include <cassert> #include <cassert>
#include <cstdint> #include <cstdint>
...@@ -328,7 +329,7 @@ CdioParanoiaInputStream::Read(std::unique_lock<Mutex> &, ...@@ -328,7 +329,7 @@ CdioParanoiaInputStream::Read(std::unique_lock<Mutex> &,
assert(diff >= 0 && diff < 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 size_t maxwrite = CDIO_CD_FRAMESIZE_RAW - diff; //# of bytes pending in current buffer
const size_t len = (length < maxwrite? length : maxwrite); const size_t len = std::min(length, maxwrite);
//skip diff bytes from this lsn //skip diff bytes from this lsn
memcpy(wptr, ((const char *)rbuf) + diff, len); memcpy(wptr, ((const char *)rbuf) + diff, len);
......
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