Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make size recording format the same as migz #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions mgzip/multiProcGzip.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

__version__ = "0.2.1"

SID = b'IG' # Subfield ID of indexed gzip file
SID = b'MZ' # Subfield ID of indexed gzip file

def open(filename, mode="rb", compresslevel=9,
encoding=None, errors=None, newline=None,
Expand Down Expand Up @@ -330,7 +330,7 @@ def _write_member_header(self, compressed_size, raw_size):
member_size = 20 + len(fname) + 1 + compressed_size + 8
if not fname:
member_size -= 1
self.fileobj.write(struct.pack("<I", member_size)) # member size, 4 bytes
self.fileobj.write(struct.pack("<I", compressed_size)) # member size, 4 bytes
if fname:
self.fileobj.write(fname + b'\000')
return member_size
Expand Down Expand Up @@ -587,7 +587,7 @@ def read(self, size=-1):

if self._is_IG_member:
# 8 bytes for crc32 and isize
cpr_size = self.memberidx[-1] - self._header_size - 8
cpr_size = self.memberidx[-1]
self._decompress_async(self._fp.read(cpr_size),
*self._read_eof_crc())
self.thread -= 1
Expand Down Expand Up @@ -664,4 +664,4 @@ def set_block_iter(self, block_start_list):
self.block_start_iter = iter(block_start_list)

def clear_block_iter(self):
self.block_start_iter = None
self.block_start_iter = None