From 9a192354da4d4c2bc6e2ea3accbd00f75ce95094 Mon Sep 17 00:00:00 2001 From: onexiaomin Date: Wed, 16 Nov 2022 17:05:10 +0800 Subject: [PATCH] Description: Change the parameter name to be the same as the declaration Sig:OpenHarmony/filemanagement_file_api Feature or Bugfix:Bugfix Binary Source: No Signed-off-by: onexiaomin --- .../class_dirent/dirent_n_exporter.cpp | 44 +++++++++---------- .../properties/create_randomaccessfile.cpp | 16 +++---- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/interfaces/kits/js/src/mod_fileio/class_dirent/dirent_n_exporter.cpp b/interfaces/kits/js/src/mod_fileio/class_dirent/dirent_n_exporter.cpp index 1e316221e..29b78ca89 100644 --- a/interfaces/kits/js/src/mod_fileio/class_dirent/dirent_n_exporter.cpp +++ b/interfaces/kits/js/src/mod_fileio/class_dirent/dirent_n_exporter.cpp @@ -34,9 +34,9 @@ namespace DistributedFS { namespace ModuleFileIO { using namespace std; -static DirentEntity *GetDirentEntity(napi_env env, napi_callback_info info) +static DirentEntity *GetDirentEntity(napi_env env, napi_callback_info cbinfo) { - NFuncArg funcArg(env, info); + NFuncArg funcArg(env, cbinfo); if (!funcArg.InitArgs(NARG_CNT::ZERO)) { UniError(EINVAL).ThrowErr(env, "Number of arguments unmatched"); return nullptr; @@ -50,9 +50,9 @@ static DirentEntity *GetDirentEntity(napi_env env, napi_callback_info info) return direntEntity; } -static napi_value CheckDirentDType(napi_env env, napi_callback_info info, unsigned char dType) +static napi_value CheckDirentDType(napi_env env, napi_callback_info cbinfo, unsigned char dType) { - DirentEntity *direntEntity = GetDirentEntity(env, info); + DirentEntity *direntEntity = GetDirentEntity(env, cbinfo); if (!direntEntity) { return nullptr; } @@ -60,53 +60,53 @@ static napi_value CheckDirentDType(napi_env env, napi_callback_info info, unsign return NVal::CreateBool(env, direntEntity->dirent_.d_type == dType).val_; } -napi_value DirentNExporter::isBlockDevice(napi_env env, napi_callback_info info) +napi_value DirentNExporter::isBlockDevice(napi_env env, napi_callback_info cbinfo) { - return CheckDirentDType(env, info, DT_BLK); + return CheckDirentDType(env, cbinfo, DT_BLK); } -napi_value DirentNExporter::isCharacterDevice(napi_env env, napi_callback_info info) +napi_value DirentNExporter::isCharacterDevice(napi_env env, napi_callback_info cbinfo) { - return CheckDirentDType(env, info, DT_CHR); + return CheckDirentDType(env, cbinfo, DT_CHR); } -napi_value DirentNExporter::isDirectory(napi_env env, napi_callback_info info) +napi_value DirentNExporter::isDirectory(napi_env env, napi_callback_info cbinfo) { - return CheckDirentDType(env, info, DT_DIR); + return CheckDirentDType(env, cbinfo, DT_DIR); } -napi_value DirentNExporter::isFIFO(napi_env env, napi_callback_info info) +napi_value DirentNExporter::isFIFO(napi_env env, napi_callback_info cbinfo) { - return CheckDirentDType(env, info, DT_FIFO); + return CheckDirentDType(env, cbinfo, DT_FIFO); } -napi_value DirentNExporter::isFile(napi_env env, napi_callback_info info) +napi_value DirentNExporter::isFile(napi_env env, napi_callback_info cbinfo) { - return CheckDirentDType(env, info, DT_REG); + return CheckDirentDType(env, cbinfo, DT_REG); } -napi_value DirentNExporter::isSocket(napi_env env, napi_callback_info info) +napi_value DirentNExporter::isSocket(napi_env env, napi_callback_info cbinfo) { - return CheckDirentDType(env, info, DT_SOCK); + return CheckDirentDType(env, cbinfo, DT_SOCK); } -napi_value DirentNExporter::isSymbolicLink(napi_env env, napi_callback_info info) +napi_value DirentNExporter::isSymbolicLink(napi_env env, napi_callback_info cbinfo) { - return CheckDirentDType(env, info, DT_LNK); + return CheckDirentDType(env, cbinfo, DT_LNK); } -napi_value DirentNExporter::GetName(napi_env env, napi_callback_info info) +napi_value DirentNExporter::GetName(napi_env env, napi_callback_info cbinfo) { - DirentEntity *direntEntity = GetDirentEntity(env, info); + DirentEntity *direntEntity = GetDirentEntity(env, cbinfo); if (!direntEntity) { return nullptr; } return NVal::CreateUTF8String(env, direntEntity->dirent_.d_name).val_; } -napi_value DirentNExporter::Constructor(napi_env env, napi_callback_info info) +napi_value DirentNExporter::Constructor(napi_env env, napi_callback_info cbinfo) { - NFuncArg funcArg(env, info); + NFuncArg funcArg(env, cbinfo); if (!funcArg.InitArgs(NARG_CNT::ZERO)) { UniError(EINVAL).ThrowErr(env, "Number of arguments unmatched"); return nullptr; diff --git a/interfaces/kits/js/src/mod_fileio/properties/create_randomaccessfile.cpp b/interfaces/kits/js/src/mod_fileio/properties/create_randomaccessfile.cpp index 8fa4fbaa7..461390164 100644 --- a/interfaces/kits/js/src/mod_fileio/properties/create_randomaccessfile.cpp +++ b/interfaces/kits/js/src/mod_fileio/properties/create_randomaccessfile.cpp @@ -140,15 +140,15 @@ napi_value CreateRandomAccessFile::Sync(napi_env env, napi_callback_info info) } uv_loop_s *loop = nullptr; napi_get_uv_event_loop(env, &loop); - uv_fs_t open_req; - int ret = uv_fs_open(loop, &open_req, fileInfo.path.get(), flags, S_IRUSR | + uv_fs_t openReq; + int ret = uv_fs_open(loop, &openReq, fileInfo.path.get(), flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP, NULL); if (ret < 0) { UniError(errno).ThrowErr(env); return nullptr; } - fileInfo.fdg.SetFD(open_req.result, false); - uv_fs_req_cleanup(&open_req); + fileInfo.fdg.SetFD(openReq.result, false); + uv_fs_req_cleanup(&openReq); } return InstantiateRandomAccessFile(env, fileInfo.fdg.GetFD(), fp).val_; } @@ -179,14 +179,14 @@ napi_value CreateRandomAccessFile::Async(napi_env env, napi_callback_info info) if (fileInfo->isPath) { uv_loop_s *loop = nullptr; napi_get_uv_event_loop(env, &loop); - uv_fs_t open_req; - int ret = uv_fs_open(loop, &open_req, fileInfo->path.get(), flags, S_IRUSR | + uv_fs_t openReq; + int ret = uv_fs_open(loop, &openReq, fileInfo->path.get(), flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP, NULL); if (ret < 0) { return UniError(errno); } - fileInfo->fdg.SetFD(open_req.result, false); - uv_fs_req_cleanup(&open_req); + fileInfo->fdg.SetFD(openReq.result, false); + uv_fs_req_cleanup(&openReq); } arg->fd = fileInfo->fdg.GetFD(); arg->fp = fp; -- Gitee