$OpenBSD: patch-core_io_compression_cpp,v 1.1.1.1 2018/04/27 07:32:53 bentley 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
@@ -79,16 +79,9 @@ int Compression::compress(uint8_t *p_dst, const uint8_
 
 		} break;
 		case MODE_ZSTD: {
-			ZSTD_CCtx *cctx = ZSTD_createCCtx();
-			ZSTD_CCtx_setParameter(cctx, ZSTD_p_compressionLevel, zstd_level);
-			if (zstd_long_distance_matching) {
-				ZSTD_CCtx_setParameter(cctx, ZSTD_p_enableLongDistanceMatching, 1);
-				ZSTD_CCtx_setParameter(cctx, ZSTD_p_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;
 	}
 
@@ -173,11 +166,8 @@ 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_setMaxWindowSize(dctx, 1 << 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;
 	}
 
@@ -187,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;
