From 8313f1cbe8422559603d45b6dc19b2739f4c7b84 Mon Sep 17 00:00:00 2001 From: yangbiao59 Date: Mon, 4 Aug 2025 06:54:03 +0000 Subject: [PATCH 1/2] =?UTF-8?q?mkdir=5Fcore=E5=A2=9E=E5=8A=A0nothrow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: yangbiao59 --- interfaces/kits/js/src/mod_fs/properties/mkdir_core.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/interfaces/kits/js/src/mod_fs/properties/mkdir_core.cpp b/interfaces/kits/js/src/mod_fs/properties/mkdir_core.cpp index cca9bb6e5..995dab24c 100644 --- a/interfaces/kits/js/src/mod_fs/properties/mkdir_core.cpp +++ b/interfaces/kits/js/src/mod_fs/properties/mkdir_core.cpp @@ -39,7 +39,7 @@ using namespace std; static int UvAccess(const string &path, int mode) { - std::unique_ptr accessReq = { new uv_fs_t, FsUtils::FsReqCleanup }; + std::unique_ptr accessReq = { new (nothrow) uv_fs_t, FsUtils::FsReqCleanup }; if (!accessReq) { HILOGE("Failed to request heap memory."); return ENOMEM; @@ -49,7 +49,7 @@ static int UvAccess(const string &path, int mode) static int MkdirCore(const string &path) { - std::unique_ptr mkdirReq = { new uv_fs_t, FsUtils::FsReqCleanup }; + std::unique_ptr mkdirReq = { new (nothrow) uv_fs_t, FsUtils::FsReqCleanup }; if (!mkdirReq) { HILOGE("Failed to request heap memory."); return ENOMEM; -- Gitee From 3c831671e312c3a19624dfeec27465e1877e28d5 Mon Sep 17 00:00:00 2001 From: yangbiao59 Date: Mon, 4 Aug 2025 08:11:28 +0000 Subject: [PATCH 2/2] update interfaces/kits/js/src/mod_fs/properties/mkdir_core.cpp. Signed-off-by: yangbiao59 --- interfaces/kits/js/src/mod_fs/properties/mkdir_core.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/interfaces/kits/js/src/mod_fs/properties/mkdir_core.cpp b/interfaces/kits/js/src/mod_fs/properties/mkdir_core.cpp index 995dab24c..0eec9a74f 100644 --- a/interfaces/kits/js/src/mod_fs/properties/mkdir_core.cpp +++ b/interfaces/kits/js/src/mod_fs/properties/mkdir_core.cpp @@ -39,7 +39,7 @@ using namespace std; static int UvAccess(const string &path, int mode) { - std::unique_ptr accessReq = { new (nothrow) uv_fs_t, FsUtils::FsReqCleanup }; + std::unique_ptr accessReq = { new uv_fs_t, FsUtils::FsReqCleanup }; if (!accessReq) { HILOGE("Failed to request heap memory."); return ENOMEM; @@ -49,7 +49,7 @@ static int UvAccess(const string &path, int mode) static int MkdirCore(const string &path) { - std::unique_ptr mkdirReq = { new (nothrow) uv_fs_t, FsUtils::FsReqCleanup }; + std::unique_ptr mkdirReq = { new uv_fs_t, FsUtils::FsReqCleanup }; if (!mkdirReq) { HILOGE("Failed to request heap memory."); return ENOMEM; @@ -57,7 +57,7 @@ static int MkdirCore(const string &path) return uv_fs_mkdir(nullptr, mkdirReq.get(), path.c_str(), DIR_DEFAULT_PERM, nullptr); } -static int32_t MkdirExec(const string &path, bool recursion, bool hasOption) +static int32_t MkdirExec(const std::string &path, bool recursion, bool hasOption) { #if !defined(WIN_PLATFORM) && !defined(IOS_PLATFORM) if (hasOption) { -- Gitee