From 449cee7cf07fa1c36a09146269c30e74f6618124 Mon Sep 17 00:00:00 2001 From: Jinny You Date: Wed, 6 Mar 2024 16:58:03 +0900 Subject: [PATCH] lottie/api: specify clear result for override API In case the given JSON is invalid, it's more closed to `Result::InvalidArguments`. --- src/bindings/capi/thorvg_capi.h | 3 ++- src/loaders/lottie/thorvg_lottie.h | 3 ++- src/loaders/lottie/tvgLottieAnimation.cpp | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/bindings/capi/thorvg_capi.h b/src/bindings/capi/thorvg_capi.h index 592d4b63..fdee9568 100644 --- a/src/bindings/capi/thorvg_capi.h +++ b/src/bindings/capi/thorvg_capi.h @@ -2359,7 +2359,8 @@ TVG_API Tvg_Animation* tvg_lottie_animation_new(); * * \return Tvg_Animation A new Tvg_LottieAnimation object. * \retval TVG_RESULT_SUCCESS Succeed. -* \retval TVG_RESULT_INSUFFICIENT_CONDITION When the given @p slot is invalid +* \retval TVG_RESULT_INSUFFICIENT_CONDITION In case the animation is not loaded. +* \retval TVG_RESULT_INVALID_ARGUMENT When the given @p slot is invalid * \retval TVG_RESULT_NOT_SUPPORTED The Lottie Animation is not supported. */ TVG_API Tvg_Result tvg_lottie_animation_override(Tvg_Animation* animation, const char* slot); diff --git a/src/loaders/lottie/thorvg_lottie.h b/src/loaders/lottie/thorvg_lottie.h index a6de6dcb..c0bc8e9c 100644 --- a/src/loaders/lottie/thorvg_lottie.h +++ b/src/loaders/lottie/thorvg_lottie.h @@ -28,7 +28,8 @@ public: * @param[in] slot The Lottie slot data in JSON format. * * @retval Result::Success When succeed. - * @retval Result::InsufficientCondition When the given parameter is invalid. + * @retval Result::InsufficientCondition In case the animation is not loaded. + * @retval Result::InvalidArguments When the given parameter is invalid. * * @note Experimental API */ diff --git a/src/loaders/lottie/tvgLottieAnimation.cpp b/src/loaders/lottie/tvgLottieAnimation.cpp index c81a8d93..63ce4cc2 100644 --- a/src/loaders/lottie/tvgLottieAnimation.cpp +++ b/src/loaders/lottie/tvgLottieAnimation.cpp @@ -46,7 +46,7 @@ Result LottieAnimation::override(const char* slot) noexcept return Result::Success; } - return Result::InsufficientCondition; + return Result::InvalidArguments; }