From d503ab38be0a827f82bd911c0a5fe057d6ff2f57 Mon Sep 17 00:00:00 2001 From: Tobias Stoeckmann Date: Mon, 1 Jun 2026 20:15:31 +0200 Subject: [PATCH] 7zip: Support old zstd versions as well Use ZSTD_DStream only if it's available, which should always be the case. Signed-off-by: Tobias Stoeckmann --- libarchive/archive_read_support_format_7zip.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libarchive/archive_read_support_format_7zip.c b/libarchive/archive_read_support_format_7zip.c index 112fd2ef2..785c1fb00 100644 --- a/libarchive/archive_read_support_format_7zip.c +++ b/libarchive/archive_read_support_format_7zip.c @@ -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 -- 2.47.3