diff --git a/companion/src/file.cpp b/companion/src/file.cpp index 4e7c5f353..34873a37d 100644 --- a/companion/src/file.cpp +++ b/companion/src/file.cpp @@ -122,20 +122,16 @@ PACK(struct EepromFileHeader bool RleFile::searchFat() { - int bestFatIndex = -1; + eepromFatHeader = NULL; + uint32_t bestFatIndex = 0; for (int i=0; imark == EEPROM_MARK && (int)header->index >= bestFatIndex) { - bestFatIndex = i; + eepromFatHeader = header; + bestFatIndex = header->index; } } - if (bestFatIndex >= 0) { - eepromFatHeader = (EepromHeader *)(eeprom+bestFatIndex*EEPROM_FAT_SIZE);; - return true; - } - else { - return false; - } + return (eepromFatHeader != NULL); } bool RleFile::EeFsOpen(uint8_t *eeprom, int size, BoardEnum board)