$OpenBSD: patch-core_io_compression_cpp,v 1.3 2021/08/22 01:43:49 thfr Exp $

revert long-distance matching in zstd which is based on private functions and
doesn't compile if archivers/zstd is installed
this is a revert of pertinent parts of commit 
f3436a841a3b59fc3a9deb94d5fdfd1e550d0351
based on github issue #17374

Index: core/io/compression.cpp
--- core/io/compression.cpp.orig
+++ core/io/compression.cpp
@@ -80,16 +80,8 @@ int Compression::compress(uint8_t *p_dst, const uint8_
 
 		} break;
 		case MODE_ZSTD: {
-			ZSTD_CCtx *cctx = ZSTD_createCCtx();
-			ZSTD_CCtx_setParameter(cctx, ZSTD_c_compressionLevel, zstd_level);
-			if (zstd_long_distance_matching) {
-				ZSTD_CCtx_setParameter(cctx, ZSTD_c_enableLongDistanceMatching, 1);
-				ZSTD_CCtx_setParameter(cctx, ZSTD_c_windowLog, zstd_window_log_size);
-			}
 			int max_dst_size = get_max_compressed_buffer_size(p_src_size, MODE_ZSTD);
-			int ret = ZSTD_compressCCtx(cctx, p_dst, max_dst_size, p_src, p_src_size, zstd_level);
-			ZSTD_freeCCtx(cctx);
-			return ret;
+			return ZSTD_compress(p_dst, max_dst_size, p_src, p_src_size, zstd_level);
 		} break;
 	}
 
@@ -175,13 +167,7 @@ int Compression::decompress(uint8_t *p_dst, int p_dst_
 			return total;
 		} break;
 		case MODE_ZSTD: {
-			ZSTD_DCtx *dctx = ZSTD_createDCtx();
-			if (zstd_long_distance_matching) {
-				ZSTD_DCtx_setParameter(dctx, ZSTD_d_windowLogMax, zstd_window_log_size);
-			}
-			int ret = ZSTD_decompressDCtx(dctx, p_dst, p_dst_max_size, p_src, p_src_size);
-			ZSTD_freeDCtx(dctx);
-			return ret;
+			return ZSTD_decompress(p_dst, p_dst_max_size, p_src, p_src_size);
 		} break;
 	}
 
@@ -191,5 +177,3 @@ int Compression::decompress(uint8_t *p_dst, int p_dst_
 int Compression::zlib_level = Z_DEFAULT_COMPRESSION;
 int Compression::gzip_level = Z_DEFAULT_COMPRESSION;
 int Compression::zstd_level = 3;
-bool Compression::zstd_long_distance_matching = false;
-int Compression::zstd_window_log_size = 27; // ZSTD_WINDOWLOG_LIMIT_DEFAULT
