fix some error

This commit is contained in:
chatlanin 2023-04-19 21:08:44 +03:00
parent cf2b28beca
commit dea68d7b33

View File

@ -11,19 +11,26 @@ void print_in_color(const T& text, const std::string& color)
} }
template <typename T> template <typename T>
std::string get_size_string(const T& size) { std::string get_size_string(const T& size)
if (size < 1024) { {
if (size < 1024)
{
return std::to_string(size) + " B"; return std::to_string(size) + " B";
} else if (size < 1024 * 1024) { }
else if (size < 1024 * 1024)
{
return std::to_string(size / 1024) + " KB"; return std::to_string(size / 1024) + " KB";
} else if (size < 1024 * 1024 * 1024) { }
else if (size < 1024 * 1024 * 1024)
{
return std::to_string(size / 1024 / 1024) + " MB"; return std::to_string(size / 1024 / 1024) + " MB";
} else { }
else
{
return std::to_string(size / 1024 / 1024 / 1024) + " GB"; return std::to_string(size / 1024 / 1024 / 1024) + " GB";
} }
} }
auto main() -> int auto main() -> int
{ {
std::ifstream fs("/etc/mtab"); std::ifstream fs("/etc/mtab");