]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Deal with bzip2 before 1.0 by not using it.
authorJoerg Sonnenberger <joerg.sonnenberger@gmail.com>
Sat, 19 Jun 2010 13:02:48 +0000 (09:02 -0400)
committerJoerg Sonnenberger <joerg.sonnenberger@gmail.com>
Sat, 19 Jun 2010 13:02:48 +0000 (09:02 -0400)
SVN-Revision: 2488

libarchive/archive_read_support_compression_bzip2.c
libarchive/archive_read_support_format_xar.c
libarchive/archive_write_add_filter_bzip2.c
libarchive/archive_write_set_format_xar.c

index d08488950b937017d071c26b7cffc06ce8ed4c83..7f5cd1a212fd1f56c4ed2bb3b3c87281081e639d 100644 (file)
@@ -48,7 +48,7 @@ __FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_compression_bzip2.c
 #include "archive_private.h"
 #include "archive_read_private.h"
 
-#if HAVE_BZLIB_H
+#if defined(HAVE_BZLIB_H) && defined(BZ_CONFIG_ERROR)
 struct private_data {
        bz_stream        stream;
        char            *out_block;
@@ -86,7 +86,7 @@ archive_read_support_compression_bzip2(struct archive *_a)
        reader->init = bzip2_reader_init;
        reader->options = NULL;
        reader->free = bzip2_reader_free;
-#if HAVE_BZLIB_H
+#if defined(HAVE_BZLIB_H) && defined(BZ_CONFIG_ERROR)
        return (ARCHIVE_OK);
 #else
        archive_set_error(_a, ARCHIVE_ERRNO_MISC,
@@ -146,7 +146,7 @@ bzip2_reader_bid(struct archive_read_filter_bidder *self, struct archive_read_fi
        return (bits_checked);
 }
 
-#ifndef HAVE_BZLIB_H
+#if !defined(HAVE_BZLIB_H) || !defined(BZ_CONFIG_ERROR)
 
 /*
  * If we don't have the library on this system, we can't actually do the
@@ -351,4 +351,4 @@ bzip2_filter_close(struct archive_read_filter *self)
        return (ret);
 }
 
-#endif /* HAVE_BZLIB_H */
+#endif /* HAVE_BZLIB_H && BZ_CONFIG_ERROR */
index 32c6045ff943040e7369b2796fda145dcfd94183..4f81937a72ccbd76e8599c0e1f0a16398edb322e 100644 (file)
@@ -325,7 +325,7 @@ struct xar {
        enum enctype             rd_encoding;
        z_stream                 stream;
        int                      stream_valid;
-#ifdef HAVE_BZLIB_H
+#if defined(HAVE_BZLIB_H) && defined(BZ_CONFIG_ERROR)
        bz_stream                bzstream;
        int                      bzstream_valid;
 #endif
@@ -1330,7 +1330,7 @@ decompression_init(struct archive_read *a, enum enctype encoding)
                xar->stream.total_in = 0;
                xar->stream.total_out = 0;
                break;
-#ifdef HAVE_BZLIB_H
+#if defined(HAVE_BZLIB_H) && defined(BZ_CONFIG_ERROR)
        case BZIP2:
                if (xar->bzstream_valid) {
                        BZ2_bzDecompressEnd(&(xar->bzstream));
@@ -1443,7 +1443,7 @@ decompression_init(struct archive_read *a, enum enctype encoding)
         * Unsupported compression.
         */
        default:
-#ifndef HAVE_BZLIB_H
+#if !defined(HAVE_BZLIB_H) || !defined(BZ_CONFIG_ERROR)
        case BZIP2:
 #endif
 #if !defined(HAVE_LZMA_H) || !defined(HAVE_LIBLZMA)
@@ -1503,7 +1503,7 @@ decompress(struct archive_read *a, const void **buff, size_t *outbytes,
                *used = avail_in - xar->stream.avail_in;
                *outbytes = avail_out - xar->stream.avail_out;
                break;
-#ifdef HAVE_BZLIB_H
+#if defined(HAVE_BZLIB_H) && defined(BZ_CONFIG_ERROR)
        case BZIP2:
                xar->bzstream.next_in = (char *)(uintptr_t)b;
                xar->bzstream.avail_in = avail_in;
@@ -1594,7 +1594,7 @@ decompress(struct archive_read *a, const void **buff, size_t *outbytes,
                *outbytes = avail_out - xar->lzstream.avail_out;
                break;
 #endif
-#ifndef HAVE_BZLIB_H
+#if !defined(HAVE_BZLIB_H) || !defined(BZ_CONFIG_ERROR)
        case BZIP2:
 #endif
 #if !defined(HAVE_LZMA_H) || !defined(HAVE_LIBLZMA)
@@ -1637,7 +1637,7 @@ decompression_cleanup(struct archive_read *a)
                        r = ARCHIVE_FATAL;
                }
        }
-#ifdef HAVE_BZLIB_H
+#if defined(HAVE_BZLIB_H) && defined(BZ_CONFIG_ERROR)
        if (xar->bzstream_valid) {
                if (BZ2_bzDecompressEnd(&(xar->bzstream)) != BZ_OK) {
                        archive_set_error(&a->archive,
index 35d29b95939127bf5405d2f9afbd70ccc8127873..85a849225296c2f899ea8a1cb4c33beabcfd8c05 100644 (file)
@@ -54,7 +54,7 @@ archive_write_set_compression_bzip2(struct archive *a)
 }
 #endif
 
-#ifndef HAVE_BZLIB_H
+#if !defined(HAVE_BZLIB_H) || !defined(BZ_CONFIG_ERROR)
 int
 archive_write_add_filter_bzip2(struct archive *a)
 {
@@ -341,4 +341,4 @@ drive_compressor(struct archive_write_filter *f,
        }
 }
 
-#endif /* HAVE_BZLIB_H */
+#endif /* HAVE_BZLIB_H && BZ_CONFIG_ERROR */
index 28292d274d2db38f4e11251d93158aba21c5962d..482ce7cac49914f79cfe7e98fdae4d1fe2406607 100644 (file)
@@ -311,7 +311,7 @@ static int  compression_code_gzip(struct archive *,
 static int     compression_end_gzip(struct archive *, struct la_zstream *);
 static int     compression_init_encoder_bzip2(struct archive *,
                    struct la_zstream *, int);
-#if defined(HAVE_BZLIB_H)
+#if defined(HAVE_BZLIB_H) && defined(BZ_CONFIG_ERROR)
 static int     compression_code_bzip2(struct archive *,
                    struct la_zstream *, enum la_zaction);
 static int     compression_end_bzip2(struct archive *, struct la_zstream *);
@@ -433,7 +433,7 @@ xar_options(struct archive_write *a, const char *key, const char *value)
                else if (strcmp(value, "gzip") == 0)
                        xar->opt_compression = GZIP;
                else if (strcmp(value, "bzip2") == 0)
-#ifdef HAVE_BZLIB_H
+#if defined(HAVE_BZLIB_H) && defined(BZ_CONFIG_ERROR)
                        xar->opt_compression = BZIP2;
 #else
                        name = "bzip2";
@@ -2516,7 +2516,7 @@ checksum_final(struct chksumwork *sumwrk, struct chksumval *sumval)
        sumval->alg = sumwrk->alg;
 }
 
-#if !defined(HAVE_BZLIB_H) || !defined(HAVE_LZMA_H)
+#if !defined(HAVE_BZLIB_H) || !defined(BZ_CONFIG_ERROR) || !defined(HAVE_LZMA_H)
 static int
 compression_unsupported_encoder(struct archive *a,
     struct la_zstream *lastrm, const char *name)
@@ -2626,7 +2626,7 @@ compression_end_gzip(struct archive *a, struct la_zstream *lastrm)
        return (ARCHIVE_OK);
 }
 
-#if defined(HAVE_BZLIB_H)
+#if defined(HAVE_BZLIB_H) && defined(BZ_CONFIG_ERROR)
 static int
 compression_init_encoder_bzip2(struct archive *a,
     struct la_zstream *lastrm, int level)