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 f600a41df81ba8238df6a32b8bcb39bc20afc633..f19c8f041bae91a3c6755dccf5ddd491b350a918 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 0bde26c2b9631c696280fd9e8f7a46c6bab9791b..d794b727d4cab76f7efd30bcef2c28cbdcd5f2c6 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 e2f7b9464691f51d71adf67ee1be4dc9fb888a76..ab03c25250a60487492a3242253fa010fd22d6fb 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 ab0a4ad5eb58825184c22448d85ba9fe621e19d5..43527ee474abfda13cfb1e53e14ccd918dac774f 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);