From fe9ecd8d32a307ea86df9084f1ce42ea851ea5ba Mon Sep 17 00:00:00 2001 From: zxl <1554188414@qq.com> Date: Sat, 14 Jun 2025 18:39:57 +0800 Subject: [PATCH] =?UTF-8?q?toInt=20toLong=20toDobule=20=E5=9B=9E=E9=80=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zxl <1554188414@qq.com> Change-Id: I276e9bf83fd868050691825593526f9344fcdf34 --- interfaces/kits/js/src/common/ani_helper/ani_helper.h | 2 +- interfaces/kits/js/src/common/ani_helper/type_converter.cpp | 6 +++--- interfaces/kits/js/src/mod_fs/properties/ani/close_ani.cpp | 2 +- .../kits/js/src/mod_fs/properties/ani/listfile_ani.cpp | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/interfaces/kits/js/src/common/ani_helper/ani_helper.h b/interfaces/kits/js/src/common/ani_helper/ani_helper.h index f600a41df..f19c8f041 100644 --- a/interfaces/kits/js/src/common/ani_helper/ani_helper.h +++ b/interfaces/kits/js/src/common/ani_helper/ani_helper.h @@ -116,7 +116,7 @@ public: static const string longValueSig = Builder::BuildSignatureDescriptor({}, BasicTypes::longType); ani_long value; status = env->Object_CallMethodByName_Long( - static_cast(property), "toLong", longValueSig.c_str(), &value); + static_cast(property), "longValue", longValueSig.c_str(), &value); if (status != ANI_OK) { return { false, nullopt }; } diff --git a/interfaces/kits/js/src/common/ani_helper/type_converter.cpp b/interfaces/kits/js/src/common/ani_helper/type_converter.cpp index 0bde26c2b..d794b727d 100644 --- a/interfaces/kits/js/src/common/ani_helper/type_converter.cpp +++ b/interfaces/kits/js/src/common/ani_helper/type_converter.cpp @@ -59,7 +59,7 @@ std::tuple> TypeConverter::ToOptionalInt32(ani_env } ani_int intValue; - if (ANI_OK == env->Object_CallMethodByName_Int(value, "toInt", nullptr, &intValue)) { + if (ANI_OK == env->Object_CallMethodByName_Int(value, "intValue", nullptr, &intValue)) { return { true, std::make_optional(intValue) }; } @@ -79,7 +79,7 @@ std::tuple> TypeConverter::ToOptionalInt64(ani_env } ani_long longValue; - if (ANI_OK == env->Object_CallMethodByName_Long(value, "toLong", nullptr, &longValue)) { + if (ANI_OK == env->Object_CallMethodByName_Long(value, "longValue", nullptr, &longValue)) { return { true, std::make_optional(longValue) }; } @@ -152,7 +152,7 @@ static std::tuple ParseFd(ani_env *env, const ani_object &pathOrF env->Object_InstanceOf(pathOrFd, cls, &isFd); if (isFd) { ani_int fd; - if (ANI_OK != env->Object_CallMethodByName_Int(pathOrFd, "toInt", nullptr, &fd)) { + if (ANI_OK != env->Object_CallMethodByName_Int(pathOrFd, "intValue", nullptr, &fd)) { HILOGE("Parse file path failed"); return { false, 0 }; } diff --git a/interfaces/kits/js/src/mod_fs/properties/ani/close_ani.cpp b/interfaces/kits/js/src/mod_fs/properties/ani/close_ani.cpp index e2f7b9464..ab03c2525 100644 --- a/interfaces/kits/js/src/mod_fs/properties/ani/close_ani.cpp +++ b/interfaces/kits/js/src/mod_fs/properties/ani/close_ani.cpp @@ -43,7 +43,7 @@ tuple ParseFdOrFile(ani_env *env, ani_object obj) env->Object_InstanceOf(obj, doubleClass, &isDouble); if (isDouble) { ani_int fd; - if (ANI_OK != env->Object_CallMethodByName_Int(obj, "toInt", nullptr, &fd)) { + if (ANI_OK != env->Object_CallMethodByName_Int(obj, "intValue", nullptr, &fd)) { HILOGE("Get fd value failed"); return { false, result, nullptr }; } diff --git a/interfaces/kits/js/src/mod_fs/properties/ani/listfile_ani.cpp b/interfaces/kits/js/src/mod_fs/properties/ani/listfile_ani.cpp index ab0a4ad5e..43527ee47 100644 --- a/interfaces/kits/js/src/mod_fs/properties/ani/listfile_ani.cpp +++ b/interfaces/kits/js/src/mod_fs/properties/ani/listfile_ani.cpp @@ -65,7 +65,7 @@ tuple ParseIntParam(ani_env *env, ani_object obj, string tag) } ani_int resultRefRes; if (ANI_OK != env->Object_CallMethodByName_Int( - static_cast(resultRef), "toInt", nullptr, &resultRefRes)) { + static_cast(resultRef), "intValue", nullptr, &resultRefRes)) { result = -1; return { false, result }; } @@ -87,7 +87,7 @@ tuple> ParseDoubleParam(ani_env *env, ani_object obj, str ani_double resultRefRes; if (ANI_OK != env->Object_CallMethodByName_Double( - static_cast(resultRef), "toDouble", nullptr, &resultRefRes)) { + static_cast(resultRef), "doubleValue", nullptr, &resultRefRes)) { return { false, nullopt }; } double result = static_cast(resultRefRes); -- Gitee