Commit 6e8c2715 authored by Ximin Luo's avatar Ximin Luo

Actually only scan whole file when filename ends in ".rom"

In 5ebe5f82 Lunar commented:

> We restrict looking for a CBFS header in the whole image (which takes some
> time) to cases where the file name ends with `.rom`.

The code was not doing that. This commit fixes things so it actually does that.
parent d396eb39
......@@ -112,10 +112,10 @@ class CbfsFile(File):
logger.debug('looking for header at offset: %x', f.tell())
if is_header_valid(f.read(CBFS_HEADER_SIZE), size):
return True
elif not file.name.endswith('.rom'):
return False
else:
logger.debug('CBFS relative offset seems wrong, scanning whole image')
elif not file.name.endswith('.rom'):
return False
else:
logger.debug('CBFS relative offset seems wrong, scanning whole image')
f.seek(0, io.SEEK_SET)
offset = 0
buf = f.read(CBFS_HEADER_SIZE)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment