summaryrefslogtreecommitdiff
path: root/src/file.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/file.hh')
-rw-r--r--src/file.hh2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/file.hh b/src/file.hh
index f5dfa112..5362b342 100644
--- a/src/file.hh
+++ b/src/file.hh
@@ -115,7 +115,7 @@ struct BufferedWriter
while (not data.empty())
{
const ByteCount length = data.length();
- const ByteCount write_len = std::min(length, size - m_pos);
+ const ByteCount write_len = clamp(length, ByteCount{0}, size - m_pos);
memcpy(m_buffer + m_pos, data.data(), (int)write_len);
m_pos += write_len;
if (m_pos == size)