mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2025-02-17 05:48:33 +00:00
Updater: fix inability to update with bigger updater.bin (#3676)
This commit is contained in:
parent
3f04d6dd46
commit
3b83604fb7
1 changed files with 7 additions and 7 deletions
|
@ -78,21 +78,21 @@ static bool flipper_update_load_stage(const FuriString* work_dir, UpdateManifest
|
||||||
furi_string_free(loader_img_path);
|
furi_string_free(loader_img_path);
|
||||||
|
|
||||||
void* img = malloc(stat.fsize);
|
void* img = malloc(stat.fsize);
|
||||||
uint32_t bytes_read = 0;
|
uint32_t read_total = 0;
|
||||||
|
uint16_t read_current = 0;
|
||||||
const uint16_t MAX_READ = 0xFFFF;
|
const uint16_t MAX_READ = 0xFFFF;
|
||||||
|
|
||||||
uint32_t crc = 0;
|
uint32_t crc = 0;
|
||||||
do {
|
do {
|
||||||
uint16_t size_read = 0;
|
if(f_read(&file, img + read_total, MAX_READ, &read_current) != FR_OK) { //-V769
|
||||||
if(f_read(&file, img + bytes_read, MAX_READ, &size_read) != FR_OK) { //-V769
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
crc = crc32_calc_buffer(crc, img + bytes_read, size_read);
|
crc = crc32_calc_buffer(crc, img + read_total, read_current);
|
||||||
bytes_read += size_read;
|
read_total += read_current;
|
||||||
} while(bytes_read == MAX_READ);
|
} while(read_current == MAX_READ);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if((bytes_read != stat.fsize) || (crc != manifest->staged_loader_crc)) {
|
if((read_total != stat.fsize) || (crc != manifest->staged_loader_crc)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue