storage: Compact old_storage_size logic

pull/25/head
Saleem Rashid 7 years ago committed by Pavol Rusnak
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…
Cancel
Save