[scan_hierarchy] make sure counts get reset at ref boundaries
This commit is contained in:
parent
286f9e1949
commit
e72b792f6f
1 changed files with 9 additions and 4 deletions
|
|
@ -220,10 +220,15 @@ def scan_hierarchy(stream: IO[bytes]) -> dict[bytes, dict[bytes, int]]:
|
||||||
colrow = COLROW.read_data(stream, size)
|
colrow = COLROW.read_data(stream, size)
|
||||||
ref_count = colrow[0] * colrow[1]
|
ref_count = colrow[0] * colrow[1]
|
||||||
elif tag == ENDEL.tag:
|
elif tag == ENDEL.tag:
|
||||||
if ref_count is None:
|
if ref_name is not None:
|
||||||
ref_count = 1
|
if ref_count is None:
|
||||||
assert ref_name is not None
|
ref_count = 1
|
||||||
cur_structure[ref_name] += ref_count
|
cur_structure[ref_name] += ref_count
|
||||||
|
ref_name = None
|
||||||
|
ref_count = None
|
||||||
|
elif tag in (SREF.tag, AREF.tag):
|
||||||
|
ref_name = None
|
||||||
|
ref_count = None
|
||||||
else:
|
else:
|
||||||
stream.seek(size, io.SEEK_CUR)
|
stream.seek(size, io.SEEK_CUR)
|
||||||
size, tag = Record.read_header(stream)
|
size, tag = Record.read_header(stream)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue