pmt: reformat code and improve

This commit is contained in:
2025-08-13 09:54:11 +03:00
parent d74f385a68
commit 0bc5f70294
14 changed files with 127 additions and 77 deletions

View File

@@ -40,14 +40,17 @@ std::vector<std::string> splitIfHasDelim(const std::string &s, const char delim,
}
void setupBufferSize(uint64_t &size, const std::string &entry) {
if (Variables->PartMap->hasPartition(entry) && Variables->PartMap->sizeOf(entry) % size != 0) {
println("%sWARNING%s: Specified buffer size is invalid for %s! Using different buffer size for %s.",
if (Variables->PartMap->hasPartition(entry) &&
Variables->PartMap->sizeOf(entry) % size != 0) {
println("%sWARNING%s: Specified buffer size is invalid for %s! Using "
"different buffer size for %s.",
YELLOW, STYLE_RESET, entry.data(), entry.data());
size = Variables->PartMap->sizeOf(entry) % 4096 == 0 ? 4096 : 1;
} else if (Helper::fileIsExists(entry)) {
if (Helper::fileSize(entry) % size != 0) {
println("%sWARNING%s: Specified buffer size is invalid for %s! using different buffer size for %s.",
YELLOW, STYLE_RESET, entry.data(), entry.data());
println("%sWARNING%s: Specified buffer size is invalid for %s! using "
"different buffer size for %s.",
YELLOW, STYLE_RESET, entry.data(), entry.data());
size = Helper::fileSize(entry) % 4096 == 0 ? 4096 : 1;
}
}