From c4fb5613b02e0d9c84249710e22d1685ef0dcb1c Mon Sep 17 00:00:00 2001 From: zxl <1554188414@qq.com> Date: Thu, 15 May 2025 12:01:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20signature?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zxl <1554188414@qq.com> Change-Id: I197bb9210125bc7926fe8803b0a9da2790ee3bd5 --- interfaces/kits/js/src/common/ani_helper/ani_signature.cpp | 3 +++ interfaces/kits/js/src/common/ani_helper/ani_signature.h | 5 +++++ .../class_randomaccessfile/ani/randomaccessfile_ani.cpp | 6 ++++-- 3 files changed, 12 insertions(+), 2 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 87ee3dfe3..4dba2490c 100644 --- a/interfaces/kits/js/src/common/ani_helper/ani_signature.cpp +++ b/interfaces/kits/js/src/common/ani_helper/ani_signature.cpp @@ -115,6 +115,9 @@ const Type FS::WatchEventInner::classType = Builder::BuildClass("@ohos.file.fs.W const string FS::WatchEventInner::classDesc = FS::WatchEventInner::classType.Descriptor(); const string FS::WatchEventInner::ctorSig = Builder::BuildSignatureDescriptor({ BuiltInTypes::stringType, BasicTypes::doubleType, BasicTypes::doubleType }); +// FS::ReadStreamOptionsInner +const Type FS::ReadStreamOptionsInner::classType = Builder::BuildClass("@ohos.file.fs.ReadStreamOptionsInner"); +const string FS::ReadStreamOptionsInner::classDesc = FS::ReadStreamOptionsInner::classType.Descriptor(); // Impl::EnvironmentImpl const Type Impl::EnvironmentImpl::classType = Builder::BuildClass("@ohos.file.environment.EnvironmentImpl"); const string Impl::EnvironmentImpl::classDesc = Impl::EnvironmentImpl::classType.Descriptor(); diff --git a/interfaces/kits/js/src/common/ani_helper/ani_signature.h b/interfaces/kits/js/src/common/ani_helper/ani_signature.h index c05470dc0..66beb1561 100644 --- a/interfaces/kits/js/src/common/ani_helper/ani_signature.h +++ b/interfaces/kits/js/src/common/ani_helper/ani_signature.h @@ -176,6 +176,11 @@ struct WatchEventInner : public BaseType { static const string ctorSig; }; +struct ReadStreamOptionsInner : public BaseType { + static const Type classType; + static const string classDesc; +}; + } // namespace FS namespace Impl { diff --git a/interfaces/kits/js/src/mod_fs/class_randomaccessfile/ani/randomaccessfile_ani.cpp b/interfaces/kits/js/src/mod_fs/class_randomaccessfile/ani/randomaccessfile_ani.cpp index 335092ba8..dceca8a85 100644 --- a/interfaces/kits/js/src/mod_fs/class_randomaccessfile/ani/randomaccessfile_ani.cpp +++ b/interfaces/kits/js/src/mod_fs/class_randomaccessfile/ani/randomaccessfile_ani.cpp @@ -283,14 +283,16 @@ static ani_string GetFilePath(ani_env *env, const int fd) static ani_object CreateReadStreamOptions(ani_env *env, int64_t start, int64_t end) { - static const char *className = "L@ohos/file/fs/ReadStreamOptionsInner;"; + static const char *className = FS::ReadStreamOptionsInner::classDesc.c_str(); ani_class cls; if (ANI_OK != env->FindClass(className, &cls)) { HILOGE("Cannot find class %s", className); return nullptr; } ani_method ctor; - if (ANI_OK != env->Class_FindMethod(cls, "", ":V", &ctor)) { + auto ctorDesc = BaseType::ctorDesc.c_str(); + auto ctorSig = BaseType::ctorSig0.c_str(); + if (ANI_OK != env->Class_FindMethod(cls, ctorDesc, ctorSig, &ctor)) { HILOGE("Cannot find constructor method for class %s", className); return nullptr; } -- Gitee