From 922c3b214a5b0dfccc409e9700d598c2ea0dc954 Mon Sep 17 00:00:00 2001 From: Daniel Markstedt Date: Thu, 22 Sep 2022 11:50:47 -0700 Subject: [PATCH] Calculate image sizes for the Product string using MiB/KiB units --- src/raspberrypi/devices/scsihd.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/raspberrypi/devices/scsihd.cpp b/src/raspberrypi/devices/scsihd.cpp index d26f58f7..7a93d71b 100644 --- a/src/raspberrypi/devices/scsihd.cpp +++ b/src/raspberrypi/devices/scsihd.cpp @@ -39,13 +39,13 @@ void SCSIHD::FinalizeSetup(const Filepath &path, off_t size) if (!IsRemovable()) { uint64_t capacity = GetBlockCount() * GetSectorSizeInBytes(); string unit; - if (capacity >= 1000000) { - capacity /= 1000000; - unit = "MB"; + if (capacity >= 1048576) { + capacity /= 1048576; + unit = "MiB"; } else { - capacity /= 1000; - unit = "KB"; + capacity /= 1024; + unit = "KiB"; } stringstream product; product << DEFAULT_PRODUCT << " " << capacity << " " << unit;