[diffoscope] 01/01: Actually only scan whole file when filename ends in ".rom"
Ximin Luo
infinity0 at debian.org
Wed Aug 24 16:47:26 CEST 2016
This is an automated email from the git hooks/post-receive script.
infinity0 pushed a commit to branch master
in repository diffoscope.
commit 6e8c2715a142cd1383ed2dfb220ae85de31e55d5
Author: Ximin Luo <infinity0 at debian.org>
Date: Wed Aug 24 16:46:10 2016 +0200
Actually only scan whole file when filename ends in ".rom"
In 5ebe5f822dcaaad6218ae1e79efad9aa283e7f0d 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.
---
diffoscope/comparators/cbfs.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/diffoscope/comparators/cbfs.py b/diffoscope/comparators/cbfs.py
index a66d8b6..012367b 100644
--- a/diffoscope/comparators/cbfs.py
+++ b/diffoscope/comparators/cbfs.py
@@ -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)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git
More information about the diffoscope
mailing list