diff --git a/frameworks/js/napi/BUILD.gn b/frameworks/js/napi/BUILD.gn index 1befc17736e4e5433ce804aa01056d8051d2acfc..3e02c96f986dce4031a83e980743beffcdabcf35 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 5ecb636cf788299dfe280273866d8206c088aafb..1061a6bc8f1116aad46bd7cf02ac4a98586775e0 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 49be78144e916e2ec0bd86ceae6f41c88af6c772..0bfa4aa958f2c8398bf8403abc7b4a47310a4d82 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 08b36c51cf84188f27533349f8bd82cc79e28eef..d6a429a5ca2deb1b48fd4ea548d3b08501537aca 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 d09af3316c6de4b91ab1091294bbb87f951f3620..79d138b6904fbc5a89cd64df3874b588dc301598 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 134d80e6115e3fe24d6b73f8bb32200cef678012..79acd072245f8971bf03221e165c98ae1d94566b 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 f4131f9a6158ce47a50bd933e049f42ca2a5c012..ac72ba28684c4e3842bf6b75a8f1b09431fe3109 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 7f83943c415f3f28d1a50bc693929079e0f8a6fd..0f041f6784f98d004aaad4ac8bab5908e3520f6c 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 1e3f4850fa2d8a273d44604d99b1957c499b2937..d9b6b93e1931d99594923d220d124b04bc34cc8c 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 c080df602b76b48ede7d11a92a5188bdd178de6e..8f9da6a61a85c810a2a58f1fecae8992bdb2b7c3 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 52fca4351a952d9a0f7e1a9e885dafd2171990bb..2a7516f63d6cdac19677fe43bbe758e5dc40f983 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 06c181a4b6b7427c65794ff39f7dabbc2e3e3dfa..d5e09d77d2e6026b7b19b8ab312716f75e1e23ae 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 07d9193e85430ef69026911356049e0a4ec1acc3..f3a19dabbec3a61514ebe51a6210e60e8bc4e05c 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 9adfea8428a57e82d73eb465fa0e4b7076d75db3..9dd1b4f7fb346662699673348e21c8e6b7cd9d0e 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 ed64de07e265d7dac63050df474393708b3a825a..945f8dd623ee7088ee50334190098a3c18ab01d1 100644 --- a/services/distributedfileservice/src/ipc/distributedfile_service.cpp +++ b/services/distributedfileservice/src/ipc/distributedfile_service.cpp @@ -243,7 +243,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 ac4ace9f4a07e5a6f7bb6f36ab9e2e693d366115..20a29f6ca6de3fc669ddb9772a5ba55cec4c5648 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