From c2f8ec0bd7788e2a1d99c05c97015e52323f8a92 Mon Sep 17 00:00:00 2001 From: zxl <1554188414@qq.com> Date: Fri, 25 Jul 2025 16:23:39 +0800 Subject: [PATCH] =?UTF-8?q?number=20=E8=BD=ACint=20=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zxl <1554188414@qq.com> Change-Id: Id4bd56b3f8fb7504ed22db516a5dbe1ab5e51764 --- interfaces/kits/js/src/common/ani_helper/ani_signature.cpp | 2 +- interfaces/kits/js/src/common/ani_helper/type_converter.cpp | 2 +- .../mod_fs/properties/ani/create_randomaccessfile_ani.cpp | 6 +++--- .../properties/copy_listener/ani/progress_listener_ani.cpp | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/interfaces/kits/js/src/common/ani_helper/ani_signature.cpp b/interfaces/kits/js/src/common/ani_helper/ani_signature.cpp index c4cb14137..a632f6f88 100644 --- a/interfaces/kits/js/src/common/ani_helper/ani_signature.cpp +++ b/interfaces/kits/js/src/common/ani_helper/ani_signature.cpp @@ -81,7 +81,7 @@ const string FS::FileInner::ctorSig = Builder::BuildSignatureDescriptor({ BasicT const Type FS::ProgressInner::classType = Builder::BuildClass("@ohos.file.fs.fileIo.ProgressInner"); const string FS::ProgressInner::classDesc = FS::ProgressInner::classType.Descriptor(); const string FS::ProgressInner::ctorSig = - Builder::BuildSignatureDescriptor({ BasicTypes::doubleType, BasicTypes::doubleType }); + Builder::BuildSignatureDescriptor({ BasicTypes::longType, BasicTypes::longType }); // FS::RandomAccessFileInner const Type FS::RandomAccessFileInner::classType = Builder::BuildClass("@ohos.file.fs.fileIo.RandomAccessFileInner"); const string FS::RandomAccessFileInner::classDesc = FS::RandomAccessFileInner::classType.Descriptor(); 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 6f13fa40e..662006f95 100644 --- a/interfaces/kits/js/src/common/ani_helper/type_converter.cpp +++ b/interfaces/kits/js/src/common/ani_helper/type_converter.cpp @@ -166,7 +166,7 @@ static std::tuple ParseFd(ani_env *env, const ani_object &pathOrF { ani_boolean isFd = false; - auto classDesc = BoxedTypes::Double::classDesc.c_str(); + auto classDesc = BoxedTypes::Int::classDesc.c_str(); ani_class cls; env->FindClass(classDesc, &cls); env->Object_InstanceOf(pathOrFd, cls, &isFd); diff --git a/interfaces/kits/js/src/mod_fs/properties/ani/create_randomaccessfile_ani.cpp b/interfaces/kits/js/src/mod_fs/properties/ani/create_randomaccessfile_ani.cpp index d7936360b..345181b02 100644 --- a/interfaces/kits/js/src/mod_fs/properties/ani/create_randomaccessfile_ani.cpp +++ b/interfaces/kits/js/src/mod_fs/properties/ani/create_randomaccessfile_ani.cpp @@ -186,13 +186,13 @@ ani_object CreateRandomAccessFileAni::CreateRandomAccessFileSync( if (isPath) { return CreateRandomAccessFileByString(env, file, mode, op); } else { - ani_double fdOp; - if (ANI_OK != env->Object_GetPropertyByName_Double(file, "fd", &fdOp)) { + ani_int fd; + if (ANI_OK != env->Object_GetPropertyByName_Int(file, "fd", &fd)) { HILOGE("Get fd in class file failed"); ErrorHandler::Throw(env, EINVAL); return nullptr; } - int32_t fd = static_cast(fdOp); + FsResult ret = CreateRandomAccessFileCore::DoCreateRandomAccessFile(fd, op); if (!ret.IsSuccess()) { HILOGE("CreateRandomAccessFile failed"); diff --git a/interfaces/kits/js/src/mod_fs/properties/copy_listener/ani/progress_listener_ani.cpp b/interfaces/kits/js/src/mod_fs/properties/copy_listener/ani/progress_listener_ani.cpp index f9b15b0db..e7379f4a3 100644 --- a/interfaces/kits/js/src/mod_fs/properties/copy_listener/ani/progress_listener_ani.cpp +++ b/interfaces/kits/js/src/mod_fs/properties/copy_listener/ani/progress_listener_ani.cpp @@ -42,8 +42,8 @@ static ani_object WrapCopyProgress(ani_env *env, uint64_t progressSize, uint64_t return nullptr; } - const ani_double aniProgressSize = static_cast(progressSize <= MAX_VALUE ? progressSize : 0); - const ani_double aniTotalSize = static_cast(totalSize <= MAX_VALUE ? totalSize : 0); + const ani_long aniProgressSize = static_cast(progressSize <= MAX_VALUE ? progressSize : 0); + const ani_long aniTotalSize = static_cast(totalSize <= MAX_VALUE ? totalSize : 0); ani_object obj; if (ANI_OK != env->Object_New(cls, ctor, &obj, aniProgressSize, aniTotalSize)) { -- Gitee