@@ -553,29 +553,27 @@ def _scan_iterator(
553
553
for section_start , section_length in sections :
554
554
output : List [Tuple [str , int , int ]] = []
555
555
556
- # Hold the offsets of each chunk (including how much has been filled)
557
- chunk_start = chunk_position = 0
558
-
559
556
# For each section, find out which bits of its exists and where they map to
560
557
# This is faster than cutting the entire space into scan_chunk sized blocks and then
561
558
# finding out what exists (particularly if most of the space isn't mapped)
559
+
562
560
for mapped in self .mapping (
563
561
section_start , section_length , ignore_errors = True
564
562
):
565
563
offset , sublength , mapped_offset , mapped_length , layer_name = mapped
566
564
567
565
for block_start in range (
568
- mapped_offset , mapped_offset + mapped_length , scanner .chunk_size
566
+ offset , offset + sublength , scanner .chunk_size
569
567
):
570
568
block_end = min (
571
- mapped_offset + mapped_length ,
569
+ offset + sublength ,
572
570
block_start + scanner .chunk_size + scanner .overlap ,
573
571
)
574
- output += [(self .name , block_start , block_end )]
572
+ output += [(self .name , block_start , block_end - block_start )]
575
573
576
574
# Ship anything that might be left
577
575
if output :
578
- yield output , mapped_offset
576
+ yield output , offset
579
577
580
578
581
579
class LayerContainer (collections .abc .Mapping ):
0 commit comments