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 345181b028e86ddf886083635b106a9644882c7f..f2a7ecc9c63d9777b8a66beecbc609dc83c91dfe 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 @@ -142,12 +142,14 @@ static ani_object CreateRandomAccessFileByString( HILOGE("Parse file path failed"); return nullptr; } + auto [succMode, modeOp] = TypeConverter::ToOptionalInt32(env, mode); if (!succMode) { HILOGE("Invalid mode"); ErrorHandler::Throw(env, EINVAL); return nullptr; } + FsResult ret = CreateRandomAccessFileCore::DoCreateRandomAccessFile(path, modeOp, op); if (!ret.IsSuccess()) { HILOGE("CreateRandomAccessFile failed"); @@ -155,6 +157,7 @@ static ani_object CreateRandomAccessFileByString( ErrorHandler::Throw(env, err); return nullptr; } + const FsRandomAccessFile *refFile = ret.GetData().value(); auto result = Wrap(env, move(refFile)); if (result == nullptr) { @@ -200,6 +203,7 @@ ani_object CreateRandomAccessFileAni::CreateRandomAccessFileSync( ErrorHandler::Throw(env, err); return nullptr; } + const FsRandomAccessFile *refFile = ret.GetData().value(); auto result = Wrap(env, move(refFile)); if (result == nullptr) { diff --git a/interfaces/kits/js/src/mod_fs/properties/create_randomaccessfile_core.h b/interfaces/kits/js/src/mod_fs/properties/create_randomaccessfile_core.h index aa7b3a2b0da86b1816f7a065843496728977ab2e..0900891bae980358ec50348db1ee807f88c6149f 100644 --- a/interfaces/kits/js/src/mod_fs/properties/create_randomaccessfile_core.h +++ b/interfaces/kits/js/src/mod_fs/properties/create_randomaccessfile_core.h @@ -38,7 +38,7 @@ public: static FsResult DoCreateRandomAccessFile( const int32_t &fd, const optional &options = nullopt); }; -const string PROCEDURE_CREATERAT_NAME = "FileIOCreateRandomAccessFile"; + } // namespace ModuleFileIO } // namespace FileManagement } // namespace OHOS