1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 18:27:36 +00:00

AK+Userland: Return String from human_readable_size() functions

This commit is contained in:
Sam Atkins 2024-01-24 12:16:32 +00:00 committed by Andreas Kling
parent 7e8cfb60eb
commit 388856dc7e
7 changed files with 23 additions and 23 deletions

View file

@ -56,7 +56,7 @@ static void closing_statistics()
warnln("{}+{} blocks out", statistics.total_blocks_out, statistics.partial_blocks_out);
if (statistics.status != Noxfer) {
auto elapsed_time = statistics.timer.elapsed_time();
ByteString copy_speed = "INF B/s";
String copy_speed = "INF B/s"_string;
if (!elapsed_time.is_zero()) {
auto speed = statistics.total_bytes_copied * 1000 / elapsed_time.to_milliseconds();
copy_speed = human_readable_quantity(speed, AK::HumanReadableBasedOn::Base2, "B/s"sv);

View file

@ -405,9 +405,9 @@ static bool print_filesystem_object(ByteString const& path, ByteString const& na
printf(" %4u,%4u ", major(st.st_rdev), minor(st.st_rdev));
} else {
if (flag_human_readable) {
printf(" %10s ", human_readable_size(st.st_size).characters());
printf(" %10s ", human_readable_size(st.st_size).to_byte_string().characters());
} else if (flag_human_readable_si) {
printf(" %10s ", human_readable_size(st.st_size, AK::HumanReadableBasedOn::Base10).characters());
printf(" %10s ", human_readable_size(st.st_size, AK::HumanReadableBasedOn::Base10).to_byte_string().characters());
} else {
printf(" %10" PRIu64 " ", (uint64_t)st.st_size);
}