# HG changeset patch # User Henry S. Thompson # Date 1727794766 -3600 # Node ID 51bd09d4289e027043f33f05c7d9e91c9baa5bf6 # Parent 992f59d21832f2adcbd55d7c850d91dcc65d4edc eof pblms fixed, seems to work diff -r 992f59d21832 -r 51bd09d4289e lib/python/unpackz.py --- a/lib/python/unpackz.py Sat Sep 28 15:19:05 2024 +0100 +++ b/lib/python/unpackz.py Tue Oct 01 15:59:26 2024 +0100 @@ -18,19 +18,22 @@ z = isal.isal_zlib.decompressobj(31) count = 0 while True: - if z.unused_data == b"": + if z.unused_data == b"": #print('n', obuf_len, file=sys.stderr) + if lastbuf: # buf == b"": + if outfile is None: + print(obuf_len, offset) + else: + outfile.write(b'\000%d\000%d\000'%(obuf_len, offset)) + if count!=0: + print("Unused data: count=%s offset=%s ?"%(count, offset), + file=sys.stderr) + break if nbuf: - obuf_len += BUFSIZE # still no EOS after a full buffer processed + obuf_len += BUFSIZE # still no EOS after a full buffer processed buf = f.read(BUFSIZE) nbuf = True lastbuf = ((truesize:=len(buf)) < BUFSIZE) # will only succeed if now at EOF - if buf == b"": - if outfile is None: - print(count, offset) - else: - outfile.write(b'\000%d\000%d\000'%(count, offset)) - break else: buf_len = len(buf) #print('b', obuf_len, buf_len, len(z.unused_data), len(buf)-len(z.unused_data), @@ -41,6 +44,8 @@ print(count, offset) else: outfile.write(b'\000%d\000%d\000'%(count, offset)) +# if (offset == 1352249): +# breakpoint() offset += count count = 0 buf = z.unused_data @@ -50,8 +55,5 @@ got = z.decompress(buf) if outfile is not None: outfile.write(got) -if count!=0: - print("Unused data: count=%s offset=%s ?"%(count, offset), - file=sys.stderr) if outfile is not None: outfile.close()