diff --git a/multimedia/image/image_js_standard/imageReceiverNDK/entry/src/main/cpp/napi/image_receiver_mdk_test.cpp b/multimedia/image/image_js_standard/imageReceiverNDK/entry/src/main/cpp/napi/image_receiver_mdk_test.cpp index be24fc826cb5df2246e83f754d1be970c18d2e02..6fc99c2ef49fcdce6f7c8653a8b61ba6fed1c3b1 100644 --- a/multimedia/image/image_js_standard/imageReceiverNDK/entry/src/main/cpp/napi/image_receiver_mdk_test.cpp +++ b/multimedia/image/image_js_standard/imageReceiverNDK/entry/src/main/cpp/napi/image_receiver_mdk_test.cpp @@ -57,7 +57,7 @@ napi_value ImageReceiverNDKTest::Init(napi_env env, napi_value exports) napi_define_properties(env, exports, sizeof(props) / sizeof(props[0]), props); return exports; } -static bool CheckArgs(size_t count, napi_value* argValues, size_t exceptCount) +static bool CheckArgs(size_t count, const napi_value* argValues, size_t exceptCount) { if (count != exceptCount) { return false; diff --git a/multimedia/image/image_js_standard/imageSourceNDK/entry/src/main/cpp/napi/image_source_test.cpp b/multimedia/image/image_js_standard/imageSourceNDK/entry/src/main/cpp/napi/image_source_test.cpp index 6b74a5fac0f6df619c4c5de64a774ddc124bdafe..d0cb08e77d8dc840139cf9b74d890003e519cb9b 100644 --- a/multimedia/image/image_js_standard/imageSourceNDK/entry/src/main/cpp/napi/image_source_test.cpp +++ b/multimedia/image/image_js_standard/imageSourceNDK/entry/src/main/cpp/napi/image_source_test.cpp @@ -147,7 +147,7 @@ static bool checkType(napi_env env, napi_value arg, napi_valuetype type) napi_typeof(env, arg, &argType); return (type == argType); } -static bool checkArgs(napi_value* argValue, size_t argCount, size_t want) +static bool checkArgs(const napi_value* argValue, size_t argCount, size_t want) { if (argCount < want) { DEBUG_LOG("argCount %{public}zu < want %{public}zu", argCount, want); @@ -414,7 +414,7 @@ napi_value ImageSourceNDKTest::GetDelayTime(napi_env env, napi_callback_info inf struct OhosImageSourceDelayTimeList timeList; int32_t res = OH_ImageSource_GetDelayTime(native, &timeList); - if (timeList.size == SIZE_ZERO) { + if (timeList.size == SIZE_ZERO || res != OHOS_IMAGE_RESULT_SUCCESS) { DEBUG_LOG("Delay time list get failed"); return createUndefine(env); } @@ -471,7 +471,7 @@ napi_value ImageSourceNDKTest::GetSupportedFormats(napi_env env, napi_callback_i { struct OhosImageSourceSupportedFormatList formatList; int32_t res = OH_ImageSource_GetSupportedFormats(&formatList); - if (formatList.size == SIZE_ZERO) { + if (formatList.size == SIZE_ZERO || res != OHOS_IMAGE_RESULT_SUCCESS) { DEBUG_LOG("Supported format list get failed"); return createUndefine(env); } @@ -497,7 +497,7 @@ napi_value ImageSourceNDKTest::GetSupportedFormats(napi_env env, napi_callback_i return createResultValue(env, res, result); } -static napi_value createImageInfoNVal(napi_env env, struct OhosImageSourceInfo &imageInfo) +static napi_value createImageInfoNVal(napi_env env, const struct OhosImageSourceInfo &imageInfo) { napi_value result = nullptr; napi_create_object(env, &result);