From 19450c74b7ddf0d2abe32649fa9f8ea2fc31ed10 Mon Sep 17 00:00:00 2001 From: lanhaoyu Date: Wed, 13 Aug 2025 14:20:46 +0800 Subject: [PATCH] bms zlib ReturnStatus add enum item Signed-off-by: lanhaoyu --- interfaces/kits/ani/common/enum_util.h | 29 ++++++++++++++++----- interfaces/kits/ani/zlib/ets/@ohos.zlib.ets | 5 ++++ 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/interfaces/kits/ani/common/enum_util.h b/interfaces/kits/ani/common/enum_util.h index 1db80dffe5..90affd7d7c 100644 --- a/interfaces/kits/ani/common/enum_util.h +++ b/interfaces/kits/ani/common/enum_util.h @@ -246,6 +246,27 @@ private: 9, 8, }; + /* zlib.ReturnStatus + enum ReturnStatus { + OK = 0, + STREAM_END = 1, + NEED_DICT = 2, + ERRNO = -1, + STREAM_ERROR = -2, + DATA_ERROR = -3, + MEM_ERROR = -4, + BUF_ERROR = -5 + } */ + static constexpr std::array Array_Zlib_ReturnStatus = { + 0, + 1, + 2, + -1, + -2, + -3, + -4, + -5 + }; public: template @@ -463,14 +484,10 @@ public: } // zlib.ReturnStatus - // enum ReturnStatus { - // OK = 0, - // STREAM_END = 1, - // NEED_DICT = 2, - // } static inline ani_enum_item EnumNativeToETS_Zlib_ReturnStatus(ani_env* env, const int32_t value) { - return EnumNativeToETSByOffset(env, CommonFunAniNS::CLASSNAME_ZLIB_RETURN_STATUS, value, 0); + return EnumNativeToETSByTable(env, + CommonFunAniNS::CLASSNAME_ZLIB_RETURN_STATUS, value, Array_Zlib_ReturnStatus); } // appControl.ComponentType diff --git a/interfaces/kits/ani/zlib/ets/@ohos.zlib.ets b/interfaces/kits/ani/zlib/ets/@ohos.zlib.ets index a9345f015e..41aa0d20a2 100644 --- a/interfaces/kits/ani/zlib/ets/@ohos.zlib.ets +++ b/interfaces/kits/ani/zlib/ets/@ohos.zlib.ets @@ -64,6 +64,11 @@ export default namespace zlib { OK = 0, STREAM_END = 1, NEED_DICT = 2, + ERRNO = -1, + STREAM_ERROR = -2, + DATA_ERROR = -3, + MEM_ERROR = -4, + BUF_ERROR = -5 } export enum CompressMethod { -- Gitee