From bc4806262c6a03749bb6177fd61c681344b22549 Mon Sep 17 00:00:00 2001 From: onexiaomin Date: Thu, 8 Sep 2022 21:16:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9codecheck?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: onexiaomin --- .../file_access/src/js_file_access_ext_ability.cpp | 1 + .../file_access/test/file_access_helper_test.cpp | 4 ++-- .../file_access/test/file_extension_helper_test.cpp | 2 +- interfaces/kits/napi/file_access_module/napi_utils.cpp | 6 +++--- services/src/client/file_manager_proxy.h | 2 +- services/src/fileoper/cmd_response.h | 2 +- .../src/fileoper/ext_storage/ext_storage_subscriber.h | 2 +- services/src/fileoper/external_storage_oper.h | 2 +- services/src/fileoper/external_storage_utils.cpp | 2 +- services/src/fileoper/media_file_oper.h | 2 +- services/src/server/file_manager_service.h | 2 +- services/src/server/file_manager_service_stub.h | 3 +-- services/test/client/fms_manager_proxy_mock.h | 8 ++++---- 13 files changed, 19 insertions(+), 19 deletions(-) diff --git a/frameworks/innerkits/file_access/src/js_file_access_ext_ability.cpp b/frameworks/innerkits/file_access/src/js_file_access_ext_ability.cpp index c1cc9ed0..4239ed7e 100644 --- a/frameworks/innerkits/file_access/src/js_file_access_ext_ability.cpp +++ b/frameworks/innerkits/file_access/src/js_file_access_ext_ability.cpp @@ -423,6 +423,7 @@ int JsFileAccessExtAbility::CreateFile(const Uri &parent, const std::string &dis argc = ARGC_TWO; return true; }; + auto retParser = [value](NativeEngine &engine, NativeValue *result) -> bool { NativeObject *obj = ConvertNativeValueTo(result); if (obj == nullptr) { diff --git a/frameworks/innerkits/file_access/test/file_access_helper_test.cpp b/frameworks/innerkits/file_access/test/file_access_helper_test.cpp index 3b22fbc7..d95893eb 100644 --- a/frameworks/innerkits/file_access/test/file_access_helper_test.cpp +++ b/frameworks/innerkits/file_access/test/file_access_helper_test.cpp @@ -13,7 +13,7 @@ * limitations under the License. */ -#include +#include #include #include @@ -29,7 +29,7 @@ namespace { using namespace std; using namespace OHOS; using namespace FileAccessFwk; -int ABILITY_ID = 5003; +const int ABILITY_ID = 5003; shared_ptr fah = nullptr; Uri g_newDirUri(""); diff --git a/frameworks/innerkits/file_access/test/file_extension_helper_test.cpp b/frameworks/innerkits/file_access/test/file_extension_helper_test.cpp index ae68864e..e3f71cbf 100644 --- a/frameworks/innerkits/file_access/test/file_extension_helper_test.cpp +++ b/frameworks/innerkits/file_access/test/file_extension_helper_test.cpp @@ -28,7 +28,7 @@ namespace { using namespace std; using namespace OHOS; using namespace FileAccessFwk; -int ABILITY_ID = 5003; +const int ABILITY_ID = 5003; shared_ptr fah = nullptr; OHOS::Security::AccessToken::AccessTokenID tokenId; diff --git a/interfaces/kits/napi/file_access_module/napi_utils.cpp b/interfaces/kits/napi/file_access_module/napi_utils.cpp index ecbe70a5..b25c9302 100644 --- a/interfaces/kits/napi/file_access_module/napi_utils.cpp +++ b/interfaces/kits/napi/file_access_module/napi_utils.cpp @@ -83,7 +83,7 @@ int GetFileFilterParam(const NVal &argv, FileFilter &filter) } if (argv.HasProp("fileSizeOver")) { - int64_t fileSizeOver; + int64_t fileSizeOver = 0; std::tie(ret, fileSizeOver) = argv.GetProp("fileSizeOver").ToInt64(); if (!ret) { HILOG_ERROR("FileFilter get fileSizeOver param fail."); @@ -95,7 +95,7 @@ int GetFileFilterParam(const NVal &argv, FileFilter &filter) } if (argv.HasProp("lastModifiedAfter")) { - double lastModifiedAfter; + double lastModifiedAfter = 0.0; std::tie(ret, lastModifiedAfter) = argv.GetProp("lastModifiedAfter").ToDouble(); if (!ret) { HILOG_ERROR("FileFilter get lastModifiedAfter param fail."); @@ -107,7 +107,7 @@ int GetFileFilterParam(const NVal &argv, FileFilter &filter) } if (argv.HasProp("excludeMedia")) { - bool excludeMedia; + bool excludeMedia = false; std::tie(ret, excludeMedia) = argv.GetProp("excludeMedia").ToBool(); if (!ret) { HILOG_ERROR("FileFilter get excludeMedia param fail."); diff --git a/services/src/client/file_manager_proxy.h b/services/src/client/file_manager_proxy.h index 494648ed..147eb72a 100644 --- a/services/src/client/file_manager_proxy.h +++ b/services/src/client/file_manager_proxy.h @@ -26,7 +26,7 @@ namespace FileManagerService { class FileManagerProxy : public IRemoteProxy, public IFmsClient { public: explicit FileManagerProxy(const sptr &impl); - virtual ~FileManagerProxy() = default; + virtual ~FileManagerProxy() override = default; int Mkdir(const std::string &name, const std::string &path) override; int ListFile(const std::string &type, const std::string &path, const CmdOptions &option, std::vector> &fileRes) override; diff --git a/services/src/fileoper/cmd_response.h b/services/src/fileoper/cmd_response.h index f4a3b445..4e1e8905 100644 --- a/services/src/fileoper/cmd_response.h +++ b/services/src/fileoper/cmd_response.h @@ -62,7 +62,7 @@ public: return vecFileInfo_; } - virtual bool Marshalling(Parcel &parcel) const override + bool Marshalling(Parcel &parcel) const override { parcel.WriteInt32(err_); parcel.WriteString(uri_); diff --git a/services/src/fileoper/ext_storage/ext_storage_subscriber.h b/services/src/fileoper/ext_storage/ext_storage_subscriber.h index 18a34b77..835dbb9a 100644 --- a/services/src/fileoper/ext_storage/ext_storage_subscriber.h +++ b/services/src/fileoper/ext_storage/ext_storage_subscriber.h @@ -41,7 +41,7 @@ public: * @brief System common event receiver. * @param eventData Common event data. */ - virtual void OnReceiveEvent(const EventFwk::CommonEventData &eventData) override; + void OnReceiveEvent(const EventFwk::CommonEventData &eventData) override; bool CheckMountPoint(const std::string &path); diff --git a/services/src/fileoper/external_storage_oper.h b/services/src/fileoper/external_storage_oper.h index af5ee57a..a21677b8 100644 --- a/services/src/fileoper/external_storage_oper.h +++ b/services/src/fileoper/external_storage_oper.h @@ -23,7 +23,7 @@ namespace FileManagerService { class ExternalStorageOper : public FileOper { public: ExternalStorageOper() = default; - virtual ~ExternalStorageOper() = default; + virtual ~ExternalStorageOper() override = default; int OperProcess(uint32_t code, MessageParcel &data, MessageParcel &reply) const override; private: int CreateFile(const std::string &uri, const std::string &name, MessageParcel &reply) const; diff --git a/services/src/fileoper/external_storage_utils.cpp b/services/src/fileoper/external_storage_utils.cpp index 1cff272a..207425ae 100644 --- a/services/src/fileoper/external_storage_utils.cpp +++ b/services/src/fileoper/external_storage_utils.cpp @@ -113,7 +113,7 @@ int ExternalStorageUtils::DoListFile(const std::string &type, const std::string ERR_LOG("invalid file count or offset."); return E_INVALID_FILE_NUMBER; } - DEBUG_LOG("limit %{public}lld, offset %{public}lld", (long long)count, (long long)offset); + DEBUG_LOG("limit %{public}lld, offset %{public}lld", static_cast(count), static_cast(offset)); std::string path; if (!ConvertUriToAbsolutePath(uri, path)) { ERR_LOG("invalid uri[%{private}s].", uri.c_str()); diff --git a/services/src/fileoper/media_file_oper.h b/services/src/fileoper/media_file_oper.h index bc4374b2..b4f1b66b 100644 --- a/services/src/fileoper/media_file_oper.h +++ b/services/src/fileoper/media_file_oper.h @@ -22,7 +22,7 @@ namespace FileManagerService { class MediaFileOper : public FileOper { public: MediaFileOper() = default; - virtual ~MediaFileOper() = default; + virtual ~MediaFileOper() override = default; int OperProcess(uint32_t code, MessageParcel &data, MessageParcel &reply) const override; private: int CreateFile(const std::string &name, const std::string &path, MessageParcel &reply) const; diff --git a/services/src/server/file_manager_service.h b/services/src/server/file_manager_service.h index 3410c409..c007b185 100644 --- a/services/src/server/file_manager_service.h +++ b/services/src/server/file_manager_service.h @@ -26,7 +26,7 @@ class FileManagerService : public SystemAbility, public FileManagerServiceStub { public: DISALLOW_COPY_AND_MOVE(FileManagerService); explicit FileManagerService(int32_t systemAbilityId, bool runOnCreate = true); - virtual ~FileManagerService() = default; + virtual ~FileManagerService() override = default; void OnDump() override; void OnStart() override; void OnStop() override; diff --git a/services/src/server/file_manager_service_stub.h b/services/src/server/file_manager_service_stub.h index e00697a9..cd7c4a11 100644 --- a/services/src/server/file_manager_service_stub.h +++ b/services/src/server/file_manager_service_stub.h @@ -33,8 +33,7 @@ public: FileManagerServiceStub() = default; virtual ~FileManagerServiceStub() = default; int OperProcess(uint32_t code, MessageParcel &data, MessageParcel &reply); - virtual int OnRemoteRequest(uint32_t code, MessageParcel &data, - MessageParcel &reply, MessageOption &option) override; + int OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; }; } // namespace FileManagerService } // namespace OHOS diff --git a/services/test/client/fms_manager_proxy_mock.h b/services/test/client/fms_manager_proxy_mock.h index 811807ed..fb83916e 100644 --- a/services/test/client/fms_manager_proxy_mock.h +++ b/services/test/client/fms_manager_proxy_mock.h @@ -36,21 +36,21 @@ public: reply.WriteParcelable(cmdResponse); return ERR_NONE; } - virtual int Mkdir(const std::string &name, const std::string &path) override + virtual int Mkdir(const std::string &name, const std::string &path) { return ERR_NONE; } virtual int ListFile(const std::string &type, const std::string &path, const CmdOptions &option, - std::vector> &fileRes) override + std::vector> &fileRes) { return ERR_NONE; } - virtual int GetRoot(const CmdOptions &option, std::vector> &fileRes) override + virtual int GetRoot(const CmdOptions &option, std::vector> &fileRes) { return ERR_NONE; } virtual int CreateFile(const std::string &path, const std::string &fileName, - const CmdOptions &option, std::string &uri) override + const CmdOptions &option, std::string &uri) { return ERR_NONE; } -- Gitee