From 21df154794749bde9ea2dfd5e0fc15dd680af561 Mon Sep 17 00:00:00 2001 From: Younger Date: Fri, 15 Sep 2023 10:54:00 +0800 Subject: [PATCH 25/26] uadk/zlibwrapper - fix failed to create multiple z_stream at same time In wd_deflate_init/wd_inflate_init, the wd_comp_init2_ will be called to initialize wd_comp. wd_comp_init2_ will return -WD_EEXIST if wd_comp initialized. Signed-off-by: Yang Shen --- include/wd_zlibwrapper.h | 2 ++ wd_zlibwrapper.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/wd_zlibwrapper.h b/include/wd_zlibwrapper.h index 847a315..58ad503 100644 --- a/include/wd_zlibwrapper.h +++ b/include/wd_zlibwrapper.h @@ -6,6 +6,8 @@ #ifndef UADK_ZLIBWRAPPER_H #define UADK_ZLIBWRAPPER_H +#include + /* * These APIs are used to replace the ZLIB library. So if you don't use them. * Please do not use these. These APIs provide limited function, while the diff --git a/wd_zlibwrapper.c b/wd_zlibwrapper.c index 4b785ce..7189b7f 100644 --- a/wd_zlibwrapper.c +++ b/wd_zlibwrapper.c @@ -68,7 +68,7 @@ static int wd_zlib_uadk_init(void) ctx_set_num[i].sync_ctx_num = WD_DIR_MAX; ret = wd_comp_init2_("zlib", 0, 0, &cparams); - if (ret) { + if (ret && ret != -WD_EEXIST) { ret = Z_STREAM_ERROR; goto out_freebmp; } -- 2.25.1