Merge r585,r669 from libarchive.googlecode.com: If zlib is unavailable,

use external "gunzip" instead.  With this in place, we can unconditionally
enable gzip read support.
This commit is contained in:
Tim Kientzle 2009-03-07 02:51:18 +00:00
parent de01c3b1eb
commit cd22d2cc9e
2 changed files with 8 additions and 7 deletions

View file

@ -36,9 +36,8 @@ archive_read_support_compression_all(struct archive *a)
#endif
/* The decompress code doesn't use an outside library. */
archive_read_support_compression_compress(a);
#if HAVE_ZLIB_H
/* Gzip decompress falls back to "gunzip" command-line. */
archive_read_support_compression_gzip(a);
#endif
#if HAVE_LZMADEC_H
/* LZMA bidding is subject to false positives because
* the LZMA file format has a very weak signature. It

View file

@ -91,7 +91,7 @@ archive_read_support_compression_gzip(struct archive *_a)
bidder->bid = gzip_bidder_bid;
bidder->init = gzip_bidder_init;
bidder->options = NULL;
bidder->free = NULL;
bidder->free = NULL; /* No data, so no cleanup necessary. */
return (ARCHIVE_OK);
}
@ -212,12 +212,14 @@ gzip_bidder_bid(struct archive_read_filter_bidder *self,
* and emit a useful message.
*/
static int
gzip_bidder_init(struct archive_read_filter *filter)
gzip_bidder_init(struct archive_read_filter *self)
{
int r;
archive_set_error(&filter->archive->archive, -1,
"This version of libarchive was compiled without gzip support");
return (ARCHIVE_FATAL);
r = __archive_read_program(self, "gunzip");
self->code = ARCHIVE_COMPRESSION_GZIP;
self->name = "gzip";
return (r);
}
#else