commit 8db1379: Migrate ZSTD_reset{C,D}Stream to a new API

Petr Vaněk arkamar at atlas.cz
Fri Apr 8 20:49:03 UTC 2022


Author: Petr Vaněk
Date: 2022-04-08 17:19:44 +0200
URL: https://github.com/rspamd/rspamd/commit/8db1379a19bafaf18bb42cd95c4aca87753192dd (refs/pull/4140/head)

Migrate ZSTD_reset{C,D}Stream to a new API
ZSTD_reset{C,D}Stream functions are deprecated since 1.4.0 version. This
change migrates them to a new equivalents as described in documentation.

---
 src/libserver/cfg_utils.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/libserver/cfg_utils.c b/src/libserver/cfg_utils.c
index 9a96f363c..e2dfd1d1b 100644
--- a/src/libserver/cfg_utils.c
+++ b/src/libserver/cfg_utils.c
@@ -2860,7 +2860,7 @@ rspamd_libs_reset_decompression (struct rspamd_external_libs_ctx *ctx)
 		return FALSE;
 	}
 	else {
-		r = ZSTD_resetDStream (ctx->in_zstream);
+		r = ZSTD_DCtx_reset (ctx->in_zstream, ZSTD_reset_session_only);
 
 		if (ZSTD_isError (r)) {
 			msg_err ("cannot init decompression stream: %s",
@@ -2885,7 +2885,10 @@ rspamd_libs_reset_compression (struct rspamd_external_libs_ctx *ctx)
 	}
 	else {
 		/* Dictionary will be reused automatically if specified */
-		r = ZSTD_resetCStream (ctx->out_zstream, 0);
+		r = ZSTD_CCtx_reset (ctx->out_zstream, ZSTD_reset_session_only);
+		if (!ZSTD_isError (r)) {
+			r = ZSTD_CCtx_setPledgedSrcSize (ctx->out_zstream, 0);
+		}
 
 		if (ZSTD_isError (r)) {
 			msg_err ("cannot init compression stream: %s",


More information about the Commits mailing list