Some, uhh.. changes?

This commit is contained in:
StackZ
2020-06-27 09:15:29 +02:00
parent e3cda40b38
commit f68613ef06
63 changed files with 477 additions and 585 deletions
+7 -6
View File
@@ -1,6 +1,6 @@
/*
* This file is part of Universal-Updater
* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
* Copyright (C) 2019-2020 Universal-Team
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -29,16 +29,17 @@
// adapted from GM9i's byte parsing.
std::string formatBytes(int bytes) {
char out[32];
if (bytes == 1)
if (bytes == 1) {
snprintf(out, sizeof(out), "%d Byte", bytes);
else if (bytes < 1024)
} else if (bytes < 1024) {
snprintf(out, sizeof(out), "%d Bytes", bytes);
else if (bytes < 1024 * 1024)
} else if (bytes < 1024 * 1024) {
snprintf(out, sizeof(out), "%.1f KB", (float)bytes / 1024);
else if (bytes < 1024 * 1024 * 1024)
} else if (bytes < 1024 * 1024 * 1024) {
snprintf(out, sizeof(out), "%.1f MB", (float)bytes / 1024 / 1024);
else
} else {
snprintf(out, sizeof(out), "%.1f GB", (float)bytes / 1024 / 1024 / 1024);
}
return out;
}