1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 03:17:34 +00:00

LibFileSystem+Userland: Rename size() to size_from_stat()

This reflects what the functions does more accurately, and allows for
adding functions to get sizes through other methods.

This also corrects the return type of said function, as size_t may only
hold sizes up to 4GB on 32-bit platforms.
This commit is contained in:
implicitfield 2024-01-16 12:05:18 +04:00 committed by Andrew Kaster
parent d3c6e31bf3
commit 896f213c6f
5 changed files with 5 additions and 5 deletions

View file

@ -170,7 +170,7 @@ ErrorOr<bool> Client::handle_request(HTTP::HttpRequest const& request)
auto const info = ContentInfo {
.type = TRY(String::from_utf8(Core::guess_mime_type_based_on_filename(real_path.bytes_as_string_view()))),
.length = TRY(FileSystem::size(real_path.bytes_as_string_view()))
.length = static_cast<u64>(TRY(FileSystem::size_from_stat(real_path.bytes_as_string_view())))
};
TRY(send_response(*stream, request, move(info)));
return true;

View file

@ -28,7 +28,7 @@ private:
struct ContentInfo {
String type;
size_t length {};
u64 length {};
};
ErrorOr<void, WrappedError> on_ready_to_read();