From: Christian Herdtweck Date: Fri, 15 Jul 2016 10:42:52 +0000 (+0200) Subject: update comment: the "-2 * BLOCKSIZE" in size_left has 2 reasons, not just 1 X-Git-Url: http://developer.intra2net.com/git/?a=commitdiff_plain;h=874db6f0c9b2504002a389dca90e5c5a0f4e0c89;p=python-delta-tar update comment: the "-2 * BLOCKSIZE" in size_left has 2 reasons, not just 1 --- diff --git a/deltatar/tarfile.py b/deltatar/tarfile.py index 9be864a..1115373 100644 --- a/deltatar/tarfile.py +++ b/deltatar/tarfile.py @@ -2637,7 +2637,8 @@ class TarFile(object): Assumes self.max_volume_size is set. If using compression through a _Stream, use _size_left_stream instead """ - # left-over size = max_size - offset - 2 zero-blocks written in close + # left-over size = max_size - offset - 2 blocks (either 2 zero-blocks + # written in close or 1 tarinfo-block + first data block of next file) size_left = self.max_volume_size - 2*BLOCKSIZE - self.offset # limit size left to a discrete number of blocks, because we won't # write only half a block when writting the end of a volume @@ -2650,7 +2651,8 @@ class TarFile(object): Assumes self.max_volume_size is set and self.fileobj is a _Stream (otherwise use _size_left_file) """ - # left-over size = max_size - bytes written - 2 zero-blocks (close) + # left-over size = max_size - offset - 2 blocks (either 2 zero-blocks + # written in close or 1 tarinfo-block + first data block of next file) size_left = self.max_volume_size - self.fileobj.estim_file_size() \ - 2*BLOCKSIZE return BLOCKSIZE * (size_left // BLOCKSIZE)