diff options
Diffstat (limited to '')
-rw-r--r-- | src/core/file_sys/vfs_offset.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/core/file_sys/vfs_offset.cpp b/src/core/file_sys/vfs_offset.cpp index 31fdd9aa1..217e02235 100644 --- a/src/core/file_sys/vfs_offset.cpp +++ b/src/core/file_sys/vfs_offset.cpp @@ -2,6 +2,7 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include <algorithm> #include <utility> #include "core/file_sys/vfs_offset.h" @@ -75,7 +76,7 @@ bool OffsetVfsFile::WriteByte(u8 data, size_t r_offset) { return false; } -size_t OffsetVfsFile::WriteBytes(std::vector<u8> data, size_t r_offset) { +size_t OffsetVfsFile::WriteBytes(const std::vector<u8>& data, size_t r_offset) { return file->Write(data.data(), TrimToFit(data.size(), r_offset), offset + r_offset); } @@ -88,7 +89,7 @@ size_t OffsetVfsFile::GetOffset() const { } size_t OffsetVfsFile::TrimToFit(size_t r_size, size_t r_offset) const { - return std::max<size_t>(std::min<size_t>(size - r_offset, r_size), 0); + return std::clamp(r_size, size_t{0}, size - r_offset); } } // namespace FileSys |