mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:18:11 +00:00
AK: Use size_t for ByteBuffer sizes
This matches what we already do for string types.
This commit is contained in:
parent
1dfc66c7cc
commit
88b9fcb976
14 changed files with 75 additions and 70 deletions
|
@ -182,7 +182,10 @@ ssize_t FileDescription::get_dir_entries(u8* buffer, ssize_t size)
|
|||
if (!metadata.is_valid())
|
||||
return -EIO;
|
||||
|
||||
int size_to_allocate = max(PAGE_SIZE, metadata.size);
|
||||
if (size < 0)
|
||||
return -EINVAL;
|
||||
|
||||
size_t size_to_allocate = max(PAGE_SIZE, metadata.size);
|
||||
|
||||
auto temp_buffer = ByteBuffer::create_uninitialized(size_to_allocate);
|
||||
BufferStream stream(temp_buffer);
|
||||
|
@ -195,8 +198,8 @@ ssize_t FileDescription::get_dir_entries(u8* buffer, ssize_t size)
|
|||
});
|
||||
stream.snip();
|
||||
|
||||
if (size < temp_buffer.size())
|
||||
return -1;
|
||||
if (static_cast<size_t>(size) < temp_buffer.size())
|
||||
return -EINVAL;
|
||||
|
||||
copy_to_user(buffer, temp_buffer.data(), temp_buffer.size());
|
||||
return stream.offset();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue