]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
7zip: Support old zstd versions as well 3102/head
authorTobias Stoeckmann <tobias@stoeckmann.org>
Mon, 1 Jun 2026 18:15:31 +0000 (20:15 +0200)
committerDustin L. Howett <dustin@howett.net>
Mon, 1 Jun 2026 18:29:06 +0000 (14:29 -0400)
Use ZSTD_DStream only if it's available, which should always be the
case.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
libarchive/archive_read_support_format_7zip.c

index 112fd2ef2606244b5e3aeafb408d93f3e04ab81b..785c1fb00a9c31687688ee16c74131f73bf9e218 100644 (file)
@@ -335,7 +335,7 @@ struct _7zip {
        int                      stream_valid;
 #endif
        /* Decoding Zstandard data. */
-#if HAVE_ZSTD_H
+#if HAVE_ZSTD_H && HAVE_LIBZSTD
        ZSTD_DStream             *zstd_dstream;
        int                      zstdstream_valid;
 #endif
@@ -1581,7 +1581,7 @@ init_decompression(struct archive_read *a, struct _7zip *zip,
 #endif
        case _7Z_ZSTD:
        {
-#if defined(HAVE_ZSTD_H)
+#if HAVE_ZSTD_H && HAVE_LIBZSTD
                if (zip->zstdstream_valid) {
                        ZSTD_freeDStream(zip->zstd_dstream);
                        zip->zstdstream_valid = 0;
@@ -1863,7 +1863,7 @@ decompress(struct archive_read *a, struct _7zip *zip,
                t_avail_out = zip->stream.avail_out;
                break;
 #endif
-#ifdef HAVE_ZSTD_H
+#if HAVE_ZSTD_H && HAVE_LIBZSTD
        case _7Z_ZSTD:
        {
                ZSTD_inBuffer input = { t_next_in, t_avail_in, 0 }; // src, size, pos
@@ -2050,7 +2050,7 @@ free_decompression(struct archive_read *a, struct _7zip *zip)
                zip->stream_valid = 0;
        }
 #endif
-#ifdef HAVE_ZSTD_H
+#if HAVE_ZSTD_H && HAVE_LIBZSTD
        if (zip->zstdstream_valid)
                ZSTD_freeDStream(zip->zstd_dstream);
 #endif