diff options
| author | Tim Kientzle <kientzle@FreeBSD.org> | 2008-02-21 03:21:50 +0000 |
|---|---|---|
| committer | Tim Kientzle <kientzle@FreeBSD.org> | 2008-02-21 03:21:50 +0000 |
| commit | 5b7a04161dc9fc414b2b430039b971ebfc5f088a (patch) | |
| tree | 59350512b3cef6e60796edb8506db2f2080e1e0b | |
| parent | 043ec583dc65083203281112bd7dce8abfa93e94 (diff) | |
Notes
| -rw-r--r-- | lib/libarchive/archive_write_set_compression_gzip.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/libarchive/archive_write_set_compression_gzip.c b/lib/libarchive/archive_write_set_compression_gzip.c index b2e4f80c61fd..e4db65187009 100644 --- a/lib/libarchive/archive_write_set_compression_gzip.c +++ b/lib/libarchive/archive_write_set_compression_gzip.c @@ -106,6 +106,21 @@ archive_compressor_gzip_init(struct archive_write *a) return (ret); } + /* + * The next check is a temporary workaround until the gzip + * code can be overhauled some. The code should not require + * that compressed_buffer_size == bytes_per_block. Removing + * this assumption will allow us to compress larger chunks at + * a time, which should improve overall performance + * marginally. As a minor side-effect, such a cleanup would + * allow us to support truly arbitrary block sizes. + */ + if (a->bytes_per_block < 10) { + archive_set_error(&a->archive, EINVAL, + "GZip compressor requires a minimum 10 byte block size"); + return (ARCHIVE_FATAL); + } + state = (struct private_data *)malloc(sizeof(*state)); if (state == NULL) { archive_set_error(&a->archive, ENOMEM, @@ -114,6 +129,10 @@ archive_compressor_gzip_init(struct archive_write *a) } memset(state, 0, sizeof(*state)); + /* + * See comment above. We should set compressed_buffer_size to + * max(bytes_per_block, 65536), but the code can't handle that yet. + */ state->compressed_buffer_size = a->bytes_per_block; state->compressed = (unsigned char *)malloc(state->compressed_buffer_size); state->crc = crc32(0L, NULL, 0); |
