diff --git a/interfaces/inner_kits/test/unittest/mock/mock_distributed_input_client.cpp b/interfaces/inner_kits/test/unittest/mock/mock_distributed_input_client.cpp index 683375c..d48faf2 100644 --- a/interfaces/inner_kits/test/unittest/mock/mock_distributed_input_client.cpp +++ b/interfaces/inner_kits/test/unittest/mock/mock_distributed_input_client.cpp @@ -73,7 +73,7 @@ void DistributedInputClient::AddWhiteListInfosCb::OnResult(const std::string &de return; } size_t jsonSize = inputData.size(); - DHLOGI("AddWhiteListInfosCb OnResult json size:%d.\n", jsonSize); + DHLOGI("AddWhiteListInfosCb OnResult json size:%zu.\n", jsonSize); TYPE_WHITE_LIST_VEC vecWhiteList = inputData; WhiteListUtil::GetInstance().SyncWhiteList(deviceId, vecWhiteList); } diff --git a/interfaces/ipc/src/distributed_input_client.cpp b/interfaces/ipc/src/distributed_input_client.cpp index aed168d..1cd468f 100644 --- a/interfaces/ipc/src/distributed_input_client.cpp +++ b/interfaces/ipc/src/distributed_input_client.cpp @@ -643,7 +643,7 @@ void DistributedInputClient::AddWhiteListInfos(const std::string &deviceId, cons return; } size_t jsonSize = inputData.size(); - DHLOGI("AddWhiteListInfosCb OnResult deviceId: %s, json str: %s, json size:%d.\n", + DHLOGI("AddWhiteListInfosCb OnResult deviceId: %s, json str: %s, json size:%zu.\n", GetAnonyString(deviceId).c_str(), GetAnonyString(strJson).c_str(), jsonSize); TYPE_WHITE_LIST_VEC vecWhiteList = inputData; WhiteListUtil::GetInstance().SyncWhiteList(deviceId, vecWhiteList); @@ -668,7 +668,7 @@ void DistributedInputClient::UpdateSinkScreenInfos(const std::string &strJson) return; } size_t jsonSize = inputData.size(); - DHLOGI("OnResult json str: %s, json size:%d.\n", GetAnonyString(strJson).c_str(), jsonSize); + DHLOGI("OnResult json str: %s, json size:%zu.\n", GetAnonyString(strJson).c_str(), jsonSize); std::vector> transInfos = inputData; for (auto info : transInfos) { if (info.size() != SINK_SCREEN_INFO_SIZE) { diff --git a/services/sink/sinkmanager/src/distributed_input_sink_manager.cpp b/services/sink/sinkmanager/src/distributed_input_sink_manager.cpp index 38680bf..2a4e51d 100644 --- a/services/sink/sinkmanager/src/distributed_input_sink_manager.cpp +++ b/services/sink/sinkmanager/src/distributed_input_sink_manager.cpp @@ -748,7 +748,7 @@ void DistributedInputSinkManager::ProjectWindowListener::OnMessage(const DHTopic { DHLOGI("ProjectWindowListener OnMessage!"); if (topic != DHTopic::TOPIC_SINK_PROJECT_WINDOW_INFO) { - DHLOGE("this topic is wrong, %d", static_cast(topic)); + DHLOGE("this topic is wrong, %u", static_cast(topic)); return; } std::string srcDeviceId = ""; @@ -876,7 +876,7 @@ void DistributedInputSinkManager::PluginStartListener::OnMessage(const DHTopic t { DHLOGI("PluginStartListener OnMessage!"); if (topic != DHTopic::TOPIC_PHY_DEV_PLUGIN) { - DHLOGE("this topic is wrong, %d", static_cast(topic)); + DHLOGE("this topic is wrong, %u", static_cast(topic)); return; } if (message.empty()) { diff --git a/services/sink/transport/src/distributed_input_sink_transport.cpp b/services/sink/transport/src/distributed_input_sink_transport.cpp index 10e27f9..04ff964 100644 --- a/services/sink/transport/src/distributed_input_sink_transport.cpp +++ b/services/sink/transport/src/distributed_input_sink_transport.cpp @@ -210,7 +210,7 @@ void DistributedInputSinkTransport::SendKeyStateNodeMsg(const int32_t sessionId, DHLOGE("SendKeyStateNodeMsg error, sessionId <= 0."); return; } - DHLOGI("SendKeyStateNodeMsg sessionId: %d, btnCode: %d.", sessionId, btnCode); + DHLOGI("SendKeyStateNodeMsg sessionId: %d, btnCode: %u.", sessionId, btnCode); nlohmann::json jsonStr; jsonStr[DINPUT_SOFTBUS_KEY_CMD_TYPE] = TRANS_SINK_MSG_KEY_STATE; jsonStr[DINPUT_SOFTBUS_KEY_KEYSTATE_DHID] = dhId; diff --git a/services/source/sourcemanager/src/dinput_source_listener.cpp b/services/source/sourcemanager/src/dinput_source_listener.cpp index c35328d..6645e76 100644 --- a/services/source/sourcemanager/src/dinput_source_listener.cpp +++ b/services/source/sourcemanager/src/dinput_source_listener.cpp @@ -346,7 +346,7 @@ void DInputSourceListener::OnReceivedEventRemoteInput(const std::string deviceId } size_t jsonSize = inputData.size(); - DHLOGD("OnReceivedEventRemoteInput called, deviceId: %s, json size:%d.", + DHLOGD("OnReceivedEventRemoteInput called, deviceId: %s, json size:%zu.", GetAnonyString(deviceId).c_str(), jsonSize); std::vector mEventBuffer(jsonSize); diff --git a/services/source/sourcemanager/src/distributed_input_source_manager.cpp b/services/source/sourcemanager/src/distributed_input_source_manager.cpp index d3df093..8f89121 100644 --- a/services/source/sourcemanager/src/distributed_input_source_manager.cpp +++ b/services/source/sourcemanager/src/distributed_input_source_manager.cpp @@ -637,15 +637,6 @@ int32_t DistributedInputSourceManager::StartRemoteInput(const std::string &srcId if (srcId != localNetworkId) { return RelayStartRemoteInputByType(srcId, sinkId, inputTypes, callback); } - for (auto iter : staCallbacks_) { - if (iter.devId == sinkId && iter.inputTypes == inputTypes) { - DHLOGE("StartRemoteInput called, repeat call."); - HisyseventUtil::GetInstance().SysEventWriteFault(DINPUT_OPT_FAIL, sinkId, - ERR_DH_INPUT_SERVER_SOURCE_MANAGER_START_FAIL, "Dinput start use failed in already started."); - FinishAsyncTrace(DINPUT_HITRACE_LABEL, DINPUT_START_START, DINPUT_START_TASK); - return ERR_DH_INPUT_SERVER_SOURCE_MANAGER_START_FAIL; - } - } DInputClientStartInfo info {sinkId, inputTypes, callback}; staCallbacks_.push_back(info); @@ -690,15 +681,6 @@ int32_t DistributedInputSourceManager::StopRemoteInput(const std::string &srcId, if (srcId != localNetworkId) { return RelayStopRemoteInputByType(srcId, sinkId, inputTypes, callback); } - for (auto iter : stpCallbacks_) { - if (iter.devId == sinkId && iter.inputTypes == inputTypes) { - DHLOGE("StopRemoteInput called, repeat call."); - HisyseventUtil::GetInstance().SysEventWriteFault(DINPUT_OPT_FAIL, sinkId, - ERR_DH_INPUT_SERVER_SOURCE_MANAGER_STOP_FAIL, "Dinput stop use failed in already stoped."); - FinishAsyncTrace(DINPUT_HITRACE_LABEL, DINPUT_STOP_START, DINPUT_STOP_TASK); - return ERR_DH_INPUT_SERVER_SOURCE_MANAGER_STOP_FAIL; - } - } DInputClientStopInfo info {sinkId, inputTypes, callback}; stpCallbacks_.push_back(info); @@ -723,13 +705,6 @@ int32_t DistributedInputSourceManager::RelayStartRemoteInputByType(const std::st const uint32_t &inputTypes, sptr callback) { std::lock_guard lock(startStopMutex_); - for (auto iter : relayStaTypeCallbacks_) { - if (iter.srcId == srcId && iter.sinkId == sinkId && iter.inputTypes == inputTypes) { - DHLOGE("Repeat call."); - return ERR_DH_INPUT_SERVER_SOURCE_MANAGER_START_FAIL; - } - } - DInputClientStartTypeInfo info(srcId, sinkId, inputTypes, callback); relayStaTypeCallbacks_.push_back(info); @@ -752,13 +727,6 @@ int32_t DistributedInputSourceManager::RelayStopRemoteInputByType( const std::string &srcId, const std::string &sinkId, const uint32_t &inputTypes, sptr callback) { std::lock_guard lock(startStopMutex_); - for (auto iter : relayStpTypeCallbacks_) { - if (iter.srcId == srcId && iter.sinkId == sinkId && iter.inputTypes == inputTypes) { - DHLOGE("Repeat call."); - return ERR_DH_INPUT_SERVER_SOURCE_MANAGER_STOP_FAIL; - } - } - DInputClientStopTypeInfo info(srcId, sinkId, inputTypes, callback); relayStpTypeCallbacks_.push_back(info); @@ -882,16 +850,6 @@ int32_t DistributedInputSourceManager::StartRemoteInput(const std::string &sinkI } // current device is source device - for (auto iter : staStringCallbacks_) { - if (iter.sinkId == sinkId && IsStringDataSame(iter.dhIds, dhIds)) { - HisyseventUtil::GetInstance().SysEventWriteFault(DINPUT_OPT_FAIL, sinkId, - ERR_DH_INPUT_SERVER_SOURCE_MANAGER_START_FAIL, "dinput start use failed in already started"); - FinishAsyncTrace(DINPUT_HITRACE_LABEL, DINPUT_START_START, DINPUT_START_TASK); - DHLOGE("sinkId: %s, repeat call.", GetAnonyString(sinkId).c_str()); - return ERR_DH_INPUT_SERVER_SOURCE_MANAGER_START_FAIL; - } - } - DInputClientStartDhidInfo info {localNetworkId, sinkId, dhIds, callback}; staStringCallbacks_.push_back(info); DeviceMap_[sinkId] = DINPUT_SOURCE_SWITCH_OFF; // when sink device start success,set DINPUT_SOURCE_SWITCH_ON @@ -931,15 +889,6 @@ int32_t DistributedInputSourceManager::StopRemoteInput(const std::string &sinkId FinishAsyncTrace(DINPUT_HITRACE_LABEL, DINPUT_STOP_START, DINPUT_STOP_TASK); return ERR_DH_INPUT_SERVER_SOURCE_MANAGER_STOP_FAIL; } - for (auto iter : stpStringCallbacks_) { - if (iter.sinkId == sinkId && IsStringDataSame(iter.dhIds, dhIds)) { - HisyseventUtil::GetInstance().SysEventWriteFault(DINPUT_OPT_FAIL, sinkId, - ERR_DH_INPUT_SERVER_SOURCE_MANAGER_STOP_FAIL, "dinput stop use failed in already stop"); - FinishAsyncTrace(DINPUT_HITRACE_LABEL, DINPUT_STOP_START, DINPUT_STOP_TASK); - DHLOGE("sinkId: %s, repeat call.", GetAnonyString(sinkId).c_str()); - return ERR_DH_INPUT_SERVER_SOURCE_MANAGER_STOP_FAIL; - } - } DInputClientStopDhidInfo info {localNetworkId, sinkId, dhIds, callback}; stpStringCallbacks_.push_back(info); @@ -982,15 +931,6 @@ int32_t DistributedInputSourceManager::StartRemoteInput(const std::string &srcId if (srcId != localNetworkId) { return RelayStartRemoteInputByDhid(srcId, sinkId, dhIds, callback); } - for (auto iter : staStringCallbacks_) { - if (iter.srcId == srcId && iter.sinkId == sinkId && IsStringDataSame(iter.dhIds, dhIds)) { - HisyseventUtil::GetInstance().SysEventWriteFault(DINPUT_OPT_FAIL, sinkId, - ERR_DH_INPUT_SERVER_SOURCE_MANAGER_START_FAIL, "Dinput start use failed in already start."); - FinishAsyncTrace(DINPUT_HITRACE_LABEL, DINPUT_START_START, DINPUT_START_TASK); - DHLOGE("sinkId: %s, repeat call.", GetAnonyString(sinkId).c_str()); - return ERR_DH_INPUT_SERVER_SOURCE_MANAGER_START_FAIL; - } - } DInputClientStartDhidInfo info {srcId, sinkId, dhIds, callback}; staStringCallbacks_.push_back(info); @@ -1035,15 +975,6 @@ int32_t DistributedInputSourceManager::StopRemoteInput(const std::string &srcId, if (srcId != localNetworkId) { return RelayStopRemoteInputByDhid(srcId, sinkId, dhIds, callback); } - for (auto iter : stpStringCallbacks_) { - if (iter.srcId == srcId && iter.sinkId == sinkId && IsStringDataSame(iter.dhIds, dhIds)) { - HisyseventUtil::GetInstance().SysEventWriteFault(DINPUT_OPT_FAIL, sinkId, - ERR_DH_INPUT_SERVER_SOURCE_MANAGER_STOP_FAIL, "Dinput stop use failed in already stop."); - FinishAsyncTrace(DINPUT_HITRACE_LABEL, DINPUT_STOP_START, DINPUT_STOP_TASK); - DHLOGE("sinkId: %s, repeat call.", GetAnonyString(sinkId).c_str()); - return ERR_DH_INPUT_SERVER_SOURCE_MANAGER_STOP_FAIL; - } - } DInputClientStopDhidInfo info {srcId, sinkId, dhIds, callback}; stpStringCallbacks_.push_back(info); @@ -1168,13 +1099,6 @@ int32_t DistributedInputSourceManager::RelayStartRemoteInputByDhid(const std::st const std::vector &dhIds, sptr callback) { std::lock_guard lock(startStopMutex_); - for (auto iter : relayStaDhidCallbacks_) { - if (iter.srcId == srcId && iter.sinkId == sinkId && IsStringDataSame(iter.dhIds, dhIds)) { - DHLOGE("Repeat call."); - return ERR_DH_INPUT_SERVER_SOURCE_MANAGER_START_FAIL; - } - } - DInputClientStartDhidInfo info{srcId, sinkId, dhIds, callback}; relayStaDhidCallbacks_.push_back(info); @@ -1196,13 +1120,6 @@ int32_t DistributedInputSourceManager::RelayStopRemoteInputByDhid(const std::str const std::vector &dhIds, sptr callback) { std::lock_guard lock(startStopMutex_); - for (auto iter : relayStpDhidCallbacks_) { - if (iter.srcId == srcId && iter.sinkId == sinkId && IsStringDataSame(iter.dhIds, dhIds)) { - DHLOGE("Repeat call."); - return ERR_DH_INPUT_SERVER_SOURCE_MANAGER_STOP_FAIL; - } - } - DInputClientStopDhidInfo info{srcId, sinkId, dhIds, callback}; relayStpDhidCallbacks_.push_back(info); @@ -1715,7 +1632,7 @@ void DistributedInputSourceManager::StopDScreenListener::OnMessage(const DHTopic { DHLOGI("StopDScreenListener OnMessage!"); if (topic != DHTopic::TOPIC_STOP_DSCREEN) { - DHLOGE("this topic is wrong, %d", static_cast(topic)); + DHLOGE("this topic is wrong, %u", static_cast(topic)); return; } std::string sinkDevId = ""; @@ -1783,7 +1700,7 @@ void DistributedInputSourceManager::DeviceOfflineListener::OnMessage(const DHTop { DHLOGI("DeviceOfflineListener OnMessage!"); if (topic != DHTopic::TOPIC_DEV_OFFLINE) { - DHLOGE("this topic is wrong, %d", static_cast(topic)); + DHLOGE("this topic is wrong, %u", static_cast(topic)); return; } if (message.empty()) { diff --git a/services/transportbase/src/distributed_input_transport_base.cpp b/services/transportbase/src/distributed_input_transport_base.cpp index 698be02..03a040f 100644 --- a/services/transportbase/src/distributed_input_transport_base.cpp +++ b/services/transportbase/src/distributed_input_transport_base.cpp @@ -95,7 +95,7 @@ void OnFile(int32_t socket, FileEvent *event) void OnQos(int32_t socket, QoSEvent eventId, const QosTV *qos, uint32_t qosCount) { - DHLOGI("OnQos, socket: %d, QoSEvent: %d, qosCount: %ld", socket, (int32_t)eventId, qosCount); + DHLOGI("OnQos, socket: %d, QoSEvent: %d, qosCount: %u", socket, (int32_t)eventId, qosCount); for (uint32_t idx = 0; idx < qosCount; idx++) { DHLOGI("QosTV: type: %d, value: %d", (int32_t)qos[idx].qos, qos[idx].value); } diff --git a/sinkhandler/test/unittest/mock/mock_distributed_input_client.cpp b/sinkhandler/test/unittest/mock/mock_distributed_input_client.cpp index 8a5e798..6c453fd 100644 --- a/sinkhandler/test/unittest/mock/mock_distributed_input_client.cpp +++ b/sinkhandler/test/unittest/mock/mock_distributed_input_client.cpp @@ -68,7 +68,7 @@ void DistributedInputClient::AddWhiteListInfosCb::OnResult(const std::string &de return; } size_t jsonSize = inputData.size(); - DHLOGI("AddWhiteListInfosCb OnResult json size:%d.\n", jsonSize); + DHLOGI("AddWhiteListInfosCb OnResult json size:%zu.\n", jsonSize); TYPE_WHITE_LIST_VEC vecWhiteList = inputData; WhiteListUtil::GetInstance().SyncWhiteList(deviceId, vecWhiteList); } diff --git a/sourcehandler/test/unittest/mock/mock_distributed_input_client.cpp b/sourcehandler/test/unittest/mock/mock_distributed_input_client.cpp index ae72613..544fd11 100644 --- a/sourcehandler/test/unittest/mock/mock_distributed_input_client.cpp +++ b/sourcehandler/test/unittest/mock/mock_distributed_input_client.cpp @@ -69,7 +69,7 @@ void DistributedInputClient::AddWhiteListInfosCb::OnResult(const std::string &de return; } size_t jsonSize = inputData.size(); - DHLOGI("AddWhiteListInfosCb OnResult json size:%d.\n", jsonSize); + DHLOGI("AddWhiteListInfosCb OnResult json size:%zu.\n", jsonSize); TYPE_WHITE_LIST_VEC vecWhiteList = inputData; WhiteListUtil::GetInstance().SyncWhiteList(deviceId, vecWhiteList); }