Now that there is always a compression-layer skip function available,

skip over the end-of-entry padding instead of reading and discarding
it.

Considering that tar files normally have a block size of 10kB, this
isn't likely to avoid reading any data, but at least it makes the code
simpler and clearer.
This commit is contained in:
cperciva 2007-04-02 04:21:22 +00:00
parent c9d2b95e45
commit b975b5f5f0

View File

@ -524,15 +524,9 @@ archive_read_format_tar_read_data(struct archive_read *a,
(a->compression_read_consume)(a, bytes_read);
return (ARCHIVE_OK);
} else {
while (tar->entry_padding > 0) {
bytes_read = (a->compression_read_ahead)(a, buff, 1);
if (bytes_read <= 0)
return (ARCHIVE_FATAL);
if (bytes_read > tar->entry_padding)
bytes_read = tar->entry_padding;
(a->compression_read_consume)(a, bytes_read);
tar->entry_padding -= bytes_read;
}
if ((a->compression_skip)(a, tar->entry_padding) < 0)
return (ARCHIVE_FATAL);
tar->entry_padding = 0;
*buff = NULL;
*size = 0;
*offset = tar->entry_offset;