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

@@ -537,7 +537,7 @@ flashupdate.proxyusername Benutzername
flashupdate.proxyusername_hint1 Geben Sie den Proxy-Benutzernamen ein
flashupdate.proxyusername_hint2 Ein leerer Eintrag bedeutet keine Authentifizierung
flashupdate.read_directory_not_exist Das Backupverzeichnis %s \nexistiert nicht!
flashupdate.read_no_available_space Der maximal verfügbare Platz in %s \nbeträgt %d KB, es werden aber %d KB benötigt.\n \nDer Vorgang wird abgebrochen, wählen sie bitte einen anderen Datenträger!
flashupdate.read_no_available_space Der maximal verfügbare Platz in %s \nbeträgt %s KB, es werden aber %s KB benötigt.\n \nDer Vorgang wird abgebrochen, wählen sie bitte einen anderen Datenträger!
flashupdate.read_volume_error Die Größe des Datenträgers %s \nkann nicht ermittelt werden!
flashupdate.readflash ganzes Flashimage auslesen
flashupdate.readflashmtd einzelne Partition auslesen

View File

@@ -537,7 +537,7 @@ flashupdate.proxyusername Username
flashupdate.proxyusername_hint1 enter the proxyserver username
flashupdate.proxyusername_hint2 a empty entry means no proxy-auth
flashupdate.read_directory_not_exist The backup directory %s \ndoes not exist!
flashupdate.read_no_available_space The maximum available space in %s \nis %d KB, but there are %d KB required.\n \nThe operation is canceled, please choose another medium!
flashupdate.read_no_available_space The maximum available space in %s \nis %s KB, but there are %s KB required.\n \nThe operation is canceled, please choose another medium!
flashupdate.read_volume_error The size of the volume %s \ncan not be determined!
flashupdate.readflash Read whole image
flashupdate.readflashmtd Read one partition

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;
}