Skip to content

Commit b6ec1c5

Browse files
committed
mlx-mkbfb: Improve the performance when extracting a single image
This commit breaks the loop when exacting a single image after having found it. It also ports a graceful change to hangle ctrl+C. RM #4374856
1 parent 74bf936 commit b6ec1c5

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

scripts/mlx-mkbfb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,7 @@ def dump_stream(infn, do_dump, do_extract, prefix, images):
589589
if file_len < ImageHdr.length:
590590
raise FormatError("BFB too short")
591591
inf.seek(0, os.SEEK_SET)
592+
count=0
592593

593594
while True:
594595
try:
@@ -619,6 +620,10 @@ def dump_stream(infn, do_dump, do_extract, prefix, images):
619620
xfile = open(prefix + fn, "wb")
620621
xfile.write(img.get_bits())
621622
xfile.close()
623+
if fn in images.split():
624+
count = count + 1
625+
if len(images.split()) == count:
626+
break
622627

623628
inf.close()
624629

0 commit comments

Comments
 (0)