From 4eebf38bb5fdf4df5d35d174435b0f2058d1bbac Mon Sep 17 00:00:00 2001 From: linjun9528 Date: Tue, 29 Mar 2022 15:16:19 +0800 Subject: [PATCH] fix codex Signed-off-by: linjun9528 --- frameworks/js/napi/BUILD.gn | 2 +- frameworks/js/napi/include/event_agent.h | 2 +- frameworks/js/napi/src/event_agent.cpp | 2 +- frameworks/js/napi/src/sendfile_napi.cpp | 6 ++++-- interfaces/innerkits/kits/js/@ohos.sendfile.d.ts | 2 +- services/5201.xml | 2 +- services/5202.xml | 2 +- services/distributedfiledaemon/src/device/device_info.cpp | 2 +- .../src/device/device_manager_agent.cpp | 3 ++- services/distributedfiledaemon/src/ipc/daemon.cpp | 1 + .../distributedfiledaemon/src/mountpoint/mount_manager.cpp | 3 +++ .../src/network/network_agent_template.cpp | 1 + .../src/network/softbus/softbus_agent.cpp | 4 ++-- .../src/device/device_manager_agent.cpp | 2 +- .../src/ipc/distributedfile_service.cpp | 1 - .../src/network/softbus_dispatcher.cpp | 2 +- 16 files changed, 22 insertions(+), 15 deletions(-) diff --git a/frameworks/js/napi/BUILD.gn b/frameworks/js/napi/BUILD.gn index d2353d2..1276c26 100644 --- a/frameworks/js/napi/BUILD.gn +++ b/frameworks/js/napi/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Huawei Device Co., Ltd. +# Copyright (c) 2021-2022 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/frameworks/js/napi/include/event_agent.h b/frameworks/js/napi/include/event_agent.h index 5ecb636..1061a6b 100644 --- a/frameworks/js/napi/include/event_agent.h +++ b/frameworks/js/napi/include/event_agent.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/frameworks/js/napi/src/event_agent.cpp b/frameworks/js/napi/src/event_agent.cpp index 49be781..0bfa4aa 100644 --- a/frameworks/js/napi/src/event_agent.cpp +++ b/frameworks/js/napi/src/event_agent.cpp @@ -51,7 +51,7 @@ void EventAgent::On(const char* type, napi_value handler) auto tmp = new EventListener(); LOGD("EventAgent::On: JS callback register.\n"); - if (strncpy_s(tmp->type, LISTENER_TYPTE_MAX_LENGTH, type, strlen(type)) == -1) { + if (strncpy_s(tmp->type, LISTENER_TYPTE_MAX_LENGTH, type, strlen(type)) != EOK) { delete tmp; tmp = nullptr; return; diff --git a/frameworks/js/napi/src/sendfile_napi.cpp b/frameworks/js/napi/src/sendfile_napi.cpp index 08b36c5..d6a429a 100644 --- a/frameworks/js/napi/src/sendfile_napi.cpp +++ b/frameworks/js/napi/src/sendfile_napi.cpp @@ -24,7 +24,9 @@ namespace OHOS { namespace Storage { namespace DistributedFile { using namespace FileManagement::LibN; - +namespace { + constexpr int TYPE_LEN = 64; +} std::vector GetJsPath(napi_env env, napi_value param) { std::vector jsPath; @@ -134,7 +136,7 @@ napi_value JsOn(napi_env env, napi_callback_info cbinfo) napi_typeof(env, argv[1], &eventHandleType); NAPI_ASSERT(env, eventHandleType == napi_function, "type mismatch for parameter 2"); - char type[64] = { 0 }; + char type[TYPE_LEN] = { 0 }; size_t typeLen = 0; napi_get_value_string_utf8(env, argv[0], type, sizeof(type), &typeLen); diff --git a/interfaces/innerkits/kits/js/@ohos.sendfile.d.ts b/interfaces/innerkits/kits/js/@ohos.sendfile.d.ts index d09af33..79d138b 100644 --- a/interfaces/innerkits/kits/js/@ohos.sendfile.d.ts +++ b/interfaces/innerkits/kits/js/@ohos.sendfile.d.ts @@ -1,5 +1,5 @@ /* -* Copyright (C) 2021 Huawei Device Co., Ltd. +* Copyright (C) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/services/5201.xml b/services/5201.xml index 134d80e..79acd07 100644 --- a/services/5201.xml +++ b/services/5201.xml @@ -22,6 +22,6 @@ 60000 true false - 1 + 1 diff --git a/services/5202.xml b/services/5202.xml index f4131f9..ac72ba2 100644 --- a/services/5202.xml +++ b/services/5202.xml @@ -22,6 +22,6 @@ 60000 true false - 1 + 1 diff --git a/services/distributedfiledaemon/src/device/device_info.cpp b/services/distributedfiledaemon/src/device/device_info.cpp index 7f83943..0f041f6 100644 --- a/services/distributedfiledaemon/src/device/device_info.cpp +++ b/services/distributedfiledaemon/src/device/device_info.cpp @@ -49,7 +49,7 @@ void DeviceInfo::SetCid(const string &cid) cid_ = cid; initCidFlag_ = true; } else { - LOGI("Cid is already initializing"); + LOGI("Cid is already initialized"); } } diff --git a/services/distributedfiledaemon/src/device/device_manager_agent.cpp b/services/distributedfiledaemon/src/device/device_manager_agent.cpp index 1e3f485..d9b6b93 100644 --- a/services/distributedfiledaemon/src/device/device_manager_agent.cpp +++ b/services/distributedfiledaemon/src/device/device_manager_agent.cpp @@ -240,7 +240,7 @@ void DeviceManagerAgent::QueryRelatedGroups(const std::string &udid, const std:: } if (groupNum == 0) { - LOGE("failed to get related groups, groupNum is %{public}d", groupNum); + LOGE("failed to get related groups, groupNum is %{public}u", groupNum); return; } @@ -289,6 +289,7 @@ bool DeviceManagerAgent::CheckIsAccountless(const GroupInfo &group) void DeviceManagerAgent::OnDeviceChanged(const DistributedHardware::DmDeviceInfo &deviceInfo) { + (void)deviceInfo; LOGI("OnDeviceInfoChanged"); } diff --git a/services/distributedfiledaemon/src/ipc/daemon.cpp b/services/distributedfiledaemon/src/ipc/daemon.cpp index c080df6..8f9da6a 100644 --- a/services/distributedfiledaemon/src/ipc/daemon.cpp +++ b/services/distributedfiledaemon/src/ipc/daemon.cpp @@ -89,6 +89,7 @@ void Daemon::OnStop() int32_t Daemon::EchoServerDemo(const string &echoStr) { + (void)echoStr; return 0; } } // namespace DistributedFile diff --git a/services/distributedfiledaemon/src/mountpoint/mount_manager.cpp b/services/distributedfiledaemon/src/mountpoint/mount_manager.cpp index 52fca43..2a7516f 100644 --- a/services/distributedfiledaemon/src/mountpoint/mount_manager.cpp +++ b/services/distributedfiledaemon/src/mountpoint/mount_manager.cpp @@ -37,14 +37,17 @@ MountManager::~MountManager() void MountManager::Mount(unique_ptr mp) { + (void)mp; } void MountManager::Umount(weak_ptr wmp) { + (void)wmp; } void MountManager::Umount(const std::string &groupId) { + (void)groupId; } } // namespace DistributedFile } // namespace Storage diff --git a/services/distributedfiledaemon/src/network/network_agent_template.cpp b/services/distributedfiledaemon/src/network/network_agent_template.cpp index 06c181a..d5e09d7 100644 --- a/services/distributedfiledaemon/src/network/network_agent_template.cpp +++ b/services/distributedfiledaemon/src/network/network_agent_template.cpp @@ -74,6 +74,7 @@ void NetworkAgentTemplate::DisconnectDevice(const DeviceInfo info) void NetworkAgentTemplate::CloseSessionForOneDevice(const string &cid) { + (void)cid; LOGI("session closed!"); } diff --git a/services/distributedfiledaemon/src/network/softbus/softbus_agent.cpp b/services/distributedfiledaemon/src/network/softbus/softbus_agent.cpp index 07d9193..f3a19da 100644 --- a/services/distributedfiledaemon/src/network/softbus/softbus_agent.cpp +++ b/services/distributedfiledaemon/src/network/softbus/softbus_agent.cpp @@ -57,7 +57,7 @@ void SoftbusAgent::JoinDomain() SoftbusSessionDispatcher::RegisterSessionListener(sessionName_, shared_from_this()); int ret = ::CreateSessionServer(IDaemon::SERVICE_NAME.c_str(), sessionName_.c_str(), &sessionListener); - if (ret != 0) { // ! 错误码 + if (ret != 0) { stringstream ss; ss << "Failed to CreateSessionServer, errno:" << ret; LOGE("%{public}s, sessionName:%{public}s", ss.str().c_str(), sessionName_.c_str()); @@ -69,7 +69,7 @@ void SoftbusAgent::JoinDomain() void SoftbusAgent::QuitDomain() { int ret = ::RemoveSessionServer(IDaemon::SERVICE_NAME.c_str(), sessionName_.c_str()); - if (ret != 0) { // ! 错误码 + if (ret != 0) { stringstream ss; ss << "Failed to RemoveSessionServer, errno:" << ret; LOGE("%{public}s", ss.str().c_str()); diff --git a/services/distributedfileservice/src/device/device_manager_agent.cpp b/services/distributedfileservice/src/device/device_manager_agent.cpp index 9adfea8..9dd1b4f 100644 --- a/services/distributedfileservice/src/device/device_manager_agent.cpp +++ b/services/distributedfileservice/src/device/device_manager_agent.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/services/distributedfileservice/src/ipc/distributedfile_service.cpp b/services/distributedfileservice/src/ipc/distributedfile_service.cpp index fb9306a..910502f 100644 --- a/services/distributedfileservice/src/ipc/distributedfile_service.cpp +++ b/services/distributedfileservice/src/ipc/distributedfile_service.cpp @@ -248,7 +248,6 @@ int32_t DistributedFileService::OpenFile(int32_t fd, const std::string &fileName int32_t DistributedFileService::RegisterNotifyCallback(sptr &callback) { SoftbusAgent::GetInstance()->SetTransCallback(callback); - LOGD("DistributedFileService::RegisterNotifyCallback: cb[%{public}p]", callback->AsObject().GetRefPtr()); return DFS_SUCCESS; } diff --git a/services/distributedfileservice/src/network/softbus_dispatcher.cpp b/services/distributedfileservice/src/network/softbus_dispatcher.cpp index ac4ace9..20a29f6 100644 --- a/services/distributedfileservice/src/network/softbus_dispatcher.cpp +++ b/services/distributedfileservice/src/network/softbus_dispatcher.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at -- Gitee