mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-09 06:50:58 +00:00
storage: Compact old_storage_size logic
This commit is contained in:
parent
a304b76d34
commit
cfc5fda603
@ -157,22 +157,19 @@ bool storage_from_flash(void)
|
|||||||
// copy storage
|
// copy storage
|
||||||
size_t old_storage_size = 0;
|
size_t old_storage_size = 0;
|
||||||
|
|
||||||
if (version == 1 || version == 2) {
|
if (version == 0) {
|
||||||
|
} else if (version <= 2) {
|
||||||
old_storage_size = OLD_STORAGE_SIZE(imported);
|
old_storage_size = OLD_STORAGE_SIZE(imported);
|
||||||
} else
|
} else if (version <= 5) {
|
||||||
if (version == 3 || version == 4 || version == 5) {
|
|
||||||
// added homescreen
|
// added homescreen
|
||||||
old_storage_size = OLD_STORAGE_SIZE(homescreen);
|
old_storage_size = OLD_STORAGE_SIZE(homescreen);
|
||||||
} else
|
} else if (version <= 7) {
|
||||||
if (version == 6 || version == 7) {
|
|
||||||
// added u2fcounter
|
// added u2fcounter
|
||||||
old_storage_size = OLD_STORAGE_SIZE(u2f_counter);
|
old_storage_size = OLD_STORAGE_SIZE(u2f_counter);
|
||||||
} else
|
} else if (version <= 8) {
|
||||||
if (version == 8) {
|
|
||||||
// added flags and needsBackup
|
// added flags and needsBackup
|
||||||
old_storage_size = OLD_STORAGE_SIZE(flags);
|
old_storage_size = OLD_STORAGE_SIZE(flags);
|
||||||
} else
|
} else if (version <= 9) {
|
||||||
if (version == 9) {
|
|
||||||
// added u2froot
|
// added u2froot
|
||||||
old_storage_size = OLD_STORAGE_SIZE(u2froot);
|
old_storage_size = OLD_STORAGE_SIZE(u2froot);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user