mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-17 02:51:27 +00:00
Use std::min and std::max
This commit is contained in:
@ -301,7 +301,7 @@ uint32_t plEncryptedStream::Read(uint32_t bytes, void* buffer)
|
||||
// Offset into the first buffer (0 if we are aligned on a chunk, which means no extra block read)
|
||||
uint32_t startChunkPos = startPos % kEncryptChunkSize;
|
||||
// Amount of data in the partial first chunk (0 if we're aligned)
|
||||
uint32_t startAmt = (startChunkPos != 0) ? hsMinimum(kEncryptChunkSize - startChunkPos, bytes) : 0;
|
||||
uint32_t startAmt = (startChunkPos != 0) ? std::min(kEncryptChunkSize - startChunkPos, bytes) : 0;
|
||||
|
||||
uint32_t totalNumRead = IRead(bytes, buffer);
|
||||
|
||||
|
@ -434,7 +434,7 @@ uint32_t plSecureStream::Read(uint32_t bytes, void* buffer)
|
||||
// Offset into the first buffer (0 if we are aligned on a chunk, which means no extra block read)
|
||||
uint32_t startChunkPos = startPos % kEncryptChunkSize;
|
||||
// Amount of data in the partial first chunk (0 if we're aligned)
|
||||
uint32_t startAmt = (startChunkPos != 0) ? hsMinimum(kEncryptChunkSize - startChunkPos, bytes) : 0;
|
||||
uint32_t startAmt = (startChunkPos != 0) ? std::min(kEncryptChunkSize - startChunkPos, bytes) : 0;
|
||||
|
||||
uint32_t totalNumRead = IRead(bytes, buffer);
|
||||
|
||||
|
Reference in New Issue
Block a user