From 6ab2b9ef1fdd24a6ca90f356384cc47aee6d234c Mon Sep 17 00:00:00 2001 From: liuhan53 Date: Fri, 20 Sep 2024 16:09:08 +0800 Subject: [PATCH] [fix]: delete always false condition Signed-off-by: liuhan53 --- interfaces/kits/cj/src/copy_file.cpp | 3 --- interfaces/kits/cj/src/file_fs_impl.cpp | 6 ------ interfaces/kits/cj/src/stream_impl.cpp | 4 ---- 3 files changed, 13 deletions(-) diff --git a/interfaces/kits/cj/src/copy_file.cpp b/interfaces/kits/cj/src/copy_file.cpp index 9335526c0c..35523d3e6b 100644 --- a/interfaces/kits/cj/src/copy_file.cpp +++ b/interfaces/kits/cj/src/copy_file.cpp @@ -53,9 +53,6 @@ std::tuple ParseOperand(std::string file) { LOGI("FS_TEST:: ParseOperand"); std::unique_ptr filePath = std::make_unique(file.length() + 1); - if (!filePath) { - return { ENOMEM, FileInfo { true, {}, {} } }; - } for (size_t i = 0; i < file.length(); i++) { filePath[i] = file[i]; } diff --git a/interfaces/kits/cj/src/file_fs_impl.cpp b/interfaces/kits/cj/src/file_fs_impl.cpp index e647288fbf..7c8e55829c 100644 --- a/interfaces/kits/cj/src/file_fs_impl.cpp +++ b/interfaces/kits/cj/src/file_fs_impl.cpp @@ -40,9 +40,6 @@ std::tuple ParseFile(int32_t file) std::tuple ParseFile(std::string file) { std::unique_ptr filePath = std::make_unique(file.length() + 1); - if (!filePath) { - return { ENOMEM, FileInfo { true, nullptr, {} } }; - } for (size_t i = 0; i < file.length(); i++) { filePath[i] = file[i]; } @@ -91,9 +88,6 @@ std::tuple ParseRandomFile(std::string file) { LOGI("FS_TEST:: RandomAccessFileImpl::ParseRandomFile"); std::unique_ptr filePath = std::make_unique(file.length() + 1); - if (!filePath) { - return { false, FileInfo { true, nullptr, {} }, ENOMEM }; - } for (size_t i = 0; i < file.length(); i++) { filePath[i] = file[i]; } diff --git a/interfaces/kits/cj/src/stream_impl.cpp b/interfaces/kits/cj/src/stream_impl.cpp index a26b4a2fc3..65244d8b78 100644 --- a/interfaces/kits/cj/src/stream_impl.cpp +++ b/interfaces/kits/cj/src/stream_impl.cpp @@ -28,10 +28,6 @@ namespace FileFs { std::tuple, size_t> DecodeString(const std::string& buffer, const std::string& encode) { std::unique_ptr buf = std::make_unique(buffer.length() + 1); - if (!buf) { - return { ENOMEM, nullptr, 0}; - } - for (size_t i = 0; i < buffer.length(); i++) { buf[i] = buffer[i]; } -- Gitee