1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 09:04:59 +00:00

Everywhere: Correctly report progress of downloads larger than 4GiB

This commit changes the variables used to represent the size and
progress of downloads from u32 to u64. This allows `pro` and
`Browser` to report the total size and progress of a download
correctly for downloads larger than 4GiB.
This commit is contained in:
Tim Ledbetter 2023-06-11 00:56:35 +01:00 committed by Andreas Kling
parent c5e0547377
commit 1a17e08f87
18 changed files with 40 additions and 42 deletions

View file

@ -232,7 +232,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
bool should_save_stream_data = false;
bool following_url = false;
u32 previous_downloaded_size = 0;
u64 previous_downloaded_size = 0;
u32 const report_time_in_ms = 100;
u32 const speed_update_time_in_ms = 4000;
@ -274,7 +274,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
}
}
request->on_progress = [&](Optional<u32> maybe_total_size, u32 downloaded_size) {
request->on_progress = [&](Optional<u64> maybe_total_size, u64 downloaded_size) {
gettimeofday(&current_time, nullptr);
timersub(&current_time, &previous_time, &time_diff);
auto time_diff_ms = time_diff.tv_sec * 1000 + time_diff.tv_usec / 1000;