CFlashExpert::checkSize: Fix display backupMaxSize & backupRequiredSize

This commit is contained in:
M. Liebmann
2014-01-29 05:29:10 +01:00
parent 91c62d6ff0
commit 583931e446
3 changed files with 7 additions and 4 deletions

View File

@@ -55,6 +55,7 @@
#include <system/flashtool.h>
#include <system/httptool.h>
#include <system/helpers.h>
#include <system/debug.h>
#include <lib/libnet/libnet.h>
@@ -582,6 +583,8 @@ bool CFlashExpert::checkSize(int mtd, std::string &backupFile)
return false;
}
backupRequiredSize = ((bused * bsize) / 1024ULL) * 2ULL; // twice disk space for summarized image
dprintf(DEBUG_INFO, "##### [%s] backupRequiredSize: %" PRIu64 ", btotal: %" PRIu64 ", bused: %" PRIu64 ", bsize: %ld\n",
__func__, backupRequiredSize, btotal, bused, bsize);
}
else
#endif
@@ -596,11 +599,11 @@ bool CFlashExpert::checkSize(int mtd, std::string &backupFile)
uint64_t backupMaxSize = (btotal - bused) * (uint64_t)bsize;
uint64_t res = 10; // Reserved 10% of available space
backupMaxSize = (backupMaxSize - ((backupMaxSize * res) / 100ULL)) / 1024ULL;
printf("##### [%s] backupMaxSize: %" PRIu64 ", btotal: %" PRIu64 ", bused: %" PRIu64 ", bsize: %ld\n",
dprintf(DEBUG_INFO, "##### [%s] backupMaxSize: %" PRIu64 ", btotal: %" PRIu64 ", bused: %" PRIu64 ", bsize: %ld\n",
__func__, backupMaxSize, btotal, bused, bsize);
if (backupMaxSize < backupRequiredSize) {
snprintf(errMsg, sizeof(errMsg)-1, g_Locale->getText(LOCALE_FLASHUPDATE_READ_NO_AVAILABLE_SPACE), path.c_str(), backupMaxSize, backupRequiredSize);
snprintf(errMsg, sizeof(errMsg)-1, g_Locale->getText(LOCALE_FLASHUPDATE_READ_NO_AVAILABLE_SPACE), path.c_str(), to_string(backupMaxSize).c_str(), to_string(backupRequiredSize).c_str());
ShowHint(LOCALE_MESSAGEBOX_ERROR, errMsg);
return false;
}