input/{async,rewind}, decoder/dsdiff: use std::cmp_*() for safer integer comparisons
This commit is contained in:
@@ -109,7 +109,7 @@ AsyncInputStream::Seek(std::unique_lock<Mutex> &lock,
|
||||
break;
|
||||
|
||||
const size_t nbytes =
|
||||
new_offset - offset < (offset_type)r.size()
|
||||
std::cmp_less(new_offset - offset, r.size())
|
||||
? new_offset - offset
|
||||
: r.size();
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ RewindInputStream::Read(std::unique_lock<Mutex> &lock,
|
||||
|
||||
size_t nbytes = input->Read(lock, ptr, read_size);
|
||||
|
||||
if (input->GetOffset() > (offset_type)sizeof(buffer))
|
||||
if (std::cmp_greater(input->GetOffset(), sizeof(buffer)))
|
||||
/* disable buffering */
|
||||
tail = 0;
|
||||
else if (tail == (size_t)offset) {
|
||||
|
||||
Reference in New Issue
Block a user