mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:17:44 +00:00
AK: Make SeekableStream::truncate()
take a size_t
Similar to the return values earlier, a signed value doesn't really make sense here. Relying on the much more standard `size_t` makes it easier to use Stream in all contexts.
This commit is contained in:
parent
a85c18d3c4
commit
371c51f934
6 changed files with 9 additions and 6 deletions
|
@ -184,8 +184,11 @@ ErrorOr<size_t> File::seek(i64 offset, SeekMode mode)
|
|||
return seek_result;
|
||||
}
|
||||
|
||||
ErrorOr<void> File::truncate(off_t length)
|
||||
ErrorOr<void> File::truncate(size_t length)
|
||||
{
|
||||
if (length > static_cast<size_t>(NumericLimits<off_t>::max()))
|
||||
return Error::from_string_literal("Length is larger than the maximum supported length");
|
||||
|
||||
return System::ftruncate(m_fd, length);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue