From 886392f6e98fdbdaa62ee4708998fe26b00dda54 Mon Sep 17 00:00:00 2001 From: gaoqiang_strong Date: Tue, 8 Nov 2022 09:58:17 +0800 Subject: [PATCH] fix Signed-off-by: gaoqiang_strong --- .../callback/dscreen_source_callback_stub.h | 4 ++-- .../include/dscreen_source_proxy.h | 6 +++--- .../src/callback/dscreen_source_callback.cpp | 4 ++-- .../callback/dscreen_source_callback_stub.cpp | 6 +++++- .../src/dscreen_source_proxy.cpp | 21 ++++++++----------- .../common/databuffer/include/data_buffer.h | 2 +- services/screenclient/src/screen_client.cpp | 6 +++--- .../src/screen_client_window_adapter.cpp | 16 +++++++------- .../include/dscreen_sink_stub.h | 4 ++-- .../dscreenservice/src/dscreen_sink_stub.cpp | 7 +++++++ .../screenregionmgr/include/screenregion.h | 4 ++-- .../screenregionmgr/include/screenregionmgr.h | 2 +- .../dscreenmgr/include/dscreen.h | 2 +- .../dscreenmgr/include/dscreen_manager.h | 2 +- .../dscreenmgr/src/dscreen_manager.cpp | 4 ++-- .../callback/dscreen_source_callback_proxy.h | 2 +- .../include/dscreen_source_stub.h | 8 +++---- .../dscreen_source_callback_proxy.cpp | 2 +- .../src/dscreen_source_stub.cpp | 15 ++++++++++--- .../include/screen_data_channel_impl.h | 2 +- .../src/screen_data_channel_impl.cpp | 2 +- .../decoder/include/image_sink_decoder.h | 4 ++-- .../include/screen_sink_trans.h | 2 +- .../encoder/include/image_source_encoder.h | 4 ++-- .../include/screen_source_trans.h | 2 +- .../softbusadapter/include/softbus_adapter.h | 14 ++++++------- .../softbusadapter/src/softbus_adapter.cpp | 17 +++++++++------ 27 files changed, 93 insertions(+), 71 deletions(-) diff --git a/interfaces/innerkits/native_cpp/screen_source/include/callback/dscreen_source_callback_stub.h b/interfaces/innerkits/native_cpp/screen_source/include/callback/dscreen_source_callback_stub.h index ca7ae8aa..c4ddd5e9 100644 --- a/interfaces/innerkits/native_cpp/screen_source/include/callback/dscreen_source_callback_stub.h +++ b/interfaces/innerkits/native_cpp/screen_source/include/callback/dscreen_source_callback_stub.h @@ -31,7 +31,7 @@ namespace DistributedHardware { class DScreenSourceCallbackStub : public IRemoteStub { public: DScreenSourceCallbackStub(); - virtual ~DScreenSourceCallbackStub() = default; + ~DScreenSourceCallbackStub() = default; int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; private: @@ -46,7 +46,7 @@ private: int32_t OnNotifyUnregResultInner(MessageParcel &data, MessageParcel &reply, MessageOption &option); bool CheckParams(const std::string &devId, const std::string &dhId, const std::string &reqId, - const std::string &resultData); + const std::string &resultData) const; }; } } diff --git a/interfaces/innerkits/native_cpp/screen_source/include/dscreen_source_proxy.h b/interfaces/innerkits/native_cpp/screen_source/include/dscreen_source_proxy.h index 7fe69409..bf638d59 100644 --- a/interfaces/innerkits/native_cpp/screen_source/include/dscreen_source_proxy.h +++ b/interfaces/innerkits/native_cpp/screen_source/include/dscreen_source_proxy.h @@ -48,10 +48,10 @@ public: private: static inline BrokerDelegator delegator_; bool CheckRegParams(const std::string &devId, const std::string &dhId, - const EnableParam ¶m, const std::string &reqId); - bool CheckUnregParams(const std::string &devId, const std::string &dhId, const std::string &reqId); + const EnableParam ¶m, const std::string &reqId) const; + bool CheckUnregParams(const std::string &devId, const std::string &dhId, const std::string &reqId) const; bool CheckConfigParams(const std::string &devId, const std::string &dhId, - const std::string &key, const std::string &value); + const std::string &key, const std::string &value) const; const size_t DID_MAX_SIZE = 256; const size_t PARAM_MAX_SIZE = 50 * 1024 * 1024; }; diff --git a/interfaces/innerkits/native_cpp/screen_source/src/callback/dscreen_source_callback.cpp b/interfaces/innerkits/native_cpp/screen_source/src/callback/dscreen_source_callback.cpp index 5631fcf9..c0e5eaad 100644 --- a/interfaces/innerkits/native_cpp/screen_source/src/callback/dscreen_source_callback.cpp +++ b/interfaces/innerkits/native_cpp/screen_source/src/callback/dscreen_source_callback.cpp @@ -26,7 +26,7 @@ int32_t DScreenSourceCallback::OnNotifyRegResult(const std::string &devId, const { DHLOGI("DScreenSourceCallback OnNotifyRegResult devId: %s dhId: %s status: %d", GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str(), status); - auto iter = registerCallbackMap_.find(reqId); + const auto iter = registerCallbackMap_.find(reqId); if (iter != registerCallbackMap_.end()) { if (iter->second == nullptr) { DHLOGE("DScreenSourceCallback Regcallback is null."); @@ -45,7 +45,7 @@ int32_t DScreenSourceCallback::OnNotifyUnregResult(const std::string &devId, con { DHLOGI("DScreenSourceCallback OnNotifyUnregResult devId: %s dhId: %s status: %d", GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str(), status); - auto iter = unregisterCallbackMap_.find(reqId); + const auto iter = unregisterCallbackMap_.find(reqId); if (iter != unregisterCallbackMap_.end()) { if (iter->second == nullptr) { DHLOGE("DScreenSourceCallback Unregcallback is null."); diff --git a/interfaces/innerkits/native_cpp/screen_source/src/callback/dscreen_source_callback_stub.cpp b/interfaces/innerkits/native_cpp/screen_source/src/callback/dscreen_source_callback_stub.cpp index 79744f0d..dce62441 100644 --- a/interfaces/innerkits/native_cpp/screen_source/src/callback/dscreen_source_callback_stub.cpp +++ b/interfaces/innerkits/native_cpp/screen_source/src/callback/dscreen_source_callback_stub.cpp @@ -55,6 +55,8 @@ int32_t DScreenSourceCallbackStub::OnRemoteRequest(uint32_t code, MessageParcel int32_t DScreenSourceCallbackStub::OnNotifyRegResultInner(MessageParcel &data, MessageParcel &reply, MessageOption &option) { + (void)reply; + (void)option; std::string devId = data.ReadString(); std::string dhId = data.ReadString(); std::string reqId = data.ReadString(); @@ -71,6 +73,8 @@ int32_t DScreenSourceCallbackStub::OnNotifyRegResultInner(MessageParcel &data, M int32_t DScreenSourceCallbackStub::OnNotifyUnregResultInner(MessageParcel &data, MessageParcel &reply, MessageOption &option) { + (void)reply; + (void)option; std::string devId = data.ReadString(); std::string dhId = data.ReadString(); std::string reqId = data.ReadString(); @@ -85,7 +89,7 @@ int32_t DScreenSourceCallbackStub::OnNotifyUnregResultInner(MessageParcel &data, } bool DScreenSourceCallbackStub::CheckParams(const std::string &devId, const std::string &dhId, - const std::string &reqId, const std::string &resultData) + const std::string &reqId, const std::string &resultData) const { if (devId.empty() || devId.size() > DID_MAX_SIZE || dhId.empty() || dhId.size() > DID_MAX_SIZE) { DHLOGE("DScreenSourceCallbackStub CheckParams devId or dhId is invalid."); diff --git a/interfaces/innerkits/native_cpp/screen_source/src/dscreen_source_proxy.cpp b/interfaces/innerkits/native_cpp/screen_source/src/dscreen_source_proxy.cpp index 7daa876c..fb8cfd89 100644 --- a/interfaces/innerkits/native_cpp/screen_source/src/dscreen_source_proxy.cpp +++ b/interfaces/innerkits/native_cpp/screen_source/src/dscreen_source_proxy.cpp @@ -46,8 +46,7 @@ int32_t DScreenSourceProxy::InitSource(const std::string ¶ms, const sptrAsObject())) { + if (!data.WriteString(params) || !data.WriteRemoteObject(callback->AsObject())) { DHLOGE("Write param failed."); return ERR_DH_SCREEN_SA_WRITEPARAM_FAILED; } @@ -99,9 +98,8 @@ int32_t DScreenSourceProxy::RegisterDistributedHardware(const std::string &devId return ERR_DH_SCREEN_SA_WRITEINTERFACETOKEN_FAILED; } - if (!data.WriteString(devId) || !data.WriteString(dhId) - || !data.WriteString(param.version) || !data.WriteString(param.attrs) - || !data.WriteString(reqId)) { + if (!data.WriteString(devId) || !data.WriteString(dhId) || + !data.WriteString(param.version) || !data.WriteString(param.attrs) || !data.WriteString(reqId)) { DHLOGE("Write param failed."); return ERR_DH_SCREEN_SA_WRITEPARAM_FAILED; } @@ -131,8 +129,7 @@ int32_t DScreenSourceProxy::UnregisterDistributedHardware(const std::string &dev return ERR_DH_SCREEN_SA_WRITEINTERFACETOKEN_FAILED; } - if (!data.WriteString(devId) || !data.WriteString(dhId) - || !data.WriteString(reqId)) { + if (!data.WriteString(devId) || !data.WriteString(dhId) || !data.WriteString(reqId)) { DHLOGE("Write param failed."); return ERR_DH_SCREEN_SA_WRITEPARAM_FAILED; } @@ -162,8 +159,7 @@ int32_t DScreenSourceProxy::ConfigDistributedHardware(const std::string &devId, return ERR_DH_SCREEN_SA_WRITEINTERFACETOKEN_FAILED; } - if (!data.WriteString(devId) || !data.WriteString(dhId) - || !data.WriteString(key) || !data.WriteString(value)) { + if (!data.WriteString(devId) || !data.WriteString(dhId) || !data.WriteString(key) || !data.WriteString(value)) { DHLOGE("Write param failed."); return ERR_DH_SCREEN_SA_WRITEPARAM_FAILED; } @@ -202,7 +198,7 @@ void DScreenSourceProxy::DScreenNotify(const std::string &devId, int32_t eventCo } bool DScreenSourceProxy::CheckRegParams(const std::string &devId, const std::string &dhId, - const EnableParam ¶m, const std::string &reqId) + const EnableParam ¶m, const std::string &reqId) const { if (devId.empty() || devId.size() > DID_MAX_SIZE || dhId.empty() || dhId.size() > DID_MAX_SIZE) { DHLOGE("DScreenSourceProxy CheckRegParams devId or dhId is invalid."); @@ -220,7 +216,8 @@ bool DScreenSourceProxy::CheckRegParams(const std::string &devId, const std::str return true; } -bool DScreenSourceProxy::CheckUnregParams(const std::string &devId, const std::string &dhId, const std::string &reqId) +bool DScreenSourceProxy::CheckUnregParams(const std::string &devId, + const std::string &dhId, const std::string &reqId) const { if (devId.empty() || devId.size() > DID_MAX_SIZE || dhId.empty() || dhId.size() > DID_MAX_SIZE) { DHLOGE("DScreenSourceProxy CheckUnregParams devId or dhId is invalid."); @@ -234,7 +231,7 @@ bool DScreenSourceProxy::CheckUnregParams(const std::string &devId, const std::s } bool DScreenSourceProxy::CheckConfigParams(const std::string &devId, const std::string &dhId, - const std::string &key, const std::string &value) + const std::string &key, const std::string &value) const { if (devId.empty() || devId.size() > DID_MAX_SIZE || dhId.empty() || dhId.size() > DID_MAX_SIZE) { DHLOGE("DScreenSourceProxy CheckConfigParams devId or dhId is invalid."); diff --git a/services/common/databuffer/include/data_buffer.h b/services/common/databuffer/include/data_buffer.h index 7c465b66..5c34a9b5 100644 --- a/services/common/databuffer/include/data_buffer.h +++ b/services/common/databuffer/include/data_buffer.h @@ -17,7 +17,7 @@ #define OHOS_DATA_BUFFER_H #include -#include +#include namespace OHOS { namespace DistributedHardware { diff --git a/services/screenclient/src/screen_client.cpp b/services/screenclient/src/screen_client.cpp index 8bf8d0f6..52d68230 100644 --- a/services/screenclient/src/screen_client.cpp +++ b/services/screenclient/src/screen_client.cpp @@ -73,7 +73,7 @@ int32_t ScreenClient::ShowWindow(int32_t windowId) } } int32_t ret = ScreenClientWindowAdapter::GetInstance().ShowWindow(windowId); - if (DH_SUCCESS != ret) { + if (ret != DH_SUCCESS) { DHLOGE("Show window (ID = %d) failed.", windowId); return ret; } @@ -92,7 +92,7 @@ int32_t ScreenClient::HideWindow(int32_t windowId) } } int32_t ret = ScreenClientWindowAdapter::GetInstance().HideWindow(windowId); - if (DH_SUCCESS != ret) { + if (ret != DH_SUCCESS) { DHLOGE("Hide window (ID = %d) failed.", windowId); return ret; } @@ -111,7 +111,7 @@ int32_t ScreenClient::MoveWindow(int32_t windowId, int32_t startX, int32_t start } } int32_t ret = ScreenClientWindowAdapter::GetInstance().MoveWindow(windowId, startX, startY); - if (DH_SUCCESS != ret) { + if (ret != DH_SUCCESS) { DHLOGE("Move window (ID = %d) failed.", windowId); return ret; } diff --git a/services/screenclient/src/screen_client_window_adapter.cpp b/services/screenclient/src/screen_client_window_adapter.cpp index 16266dc2..f1509ac6 100644 --- a/services/screenclient/src/screen_client_window_adapter.cpp +++ b/services/screenclient/src/screen_client_window_adapter.cpp @@ -39,7 +39,7 @@ ScreenClientWindowAdapter::~ScreenClientWindowAdapter() DHLOGE("window is nullptr(windowId = %d).", item.first); return; } - if (OHOS::Rosen::WMError::WM_OK != window->Destroy()) { + if (window->Destroy() != OHOS::Rosen::WMError::WM_OK) { DHLOGE("screenclientSurface is nullptr(windowId = %d).", item.first); return; } @@ -82,12 +82,12 @@ sptr ScreenClientWindowAdapter::CreateWindow(std::shared_ptr(ScreenClientInputEventListener()); window->SetInputEventConsumer(listener); DHLOGD("Create window name is %s.", windowName.c_str()); - if (OHOS::Rosen::WMError::WM_OK != window->Resize(windowProperty->width, windowProperty->height)) { + if (window->Resize(windowProperty->width, windowProperty->height) != OHOS::Rosen::WMError::WM_OK) { window->Destroy(); DHLOGE("Window resize failed."); return nullptr; } - if (OHOS::Rosen::WMError::WM_OK != window->MoveTo(windowProperty->startX, windowProperty->startY)) { + if (window->MoveTo(windowProperty->startX, windowProperty->startY) != OHOS::Rosen::WMError::WM_OK) { window->Destroy(); DHLOGE("Window moveto failed."); return nullptr; @@ -116,7 +116,7 @@ int32_t ScreenClientWindowAdapter::ShowWindow(int32_t windowId) DHLOGE("Current window is null."); return ERR_DH_SCREEN_SCREENCLIENT_SHOW_WINDOW_ERROR; } - if (OHOS::Rosen::WMError::WM_OK != window->Show()) { + if (window->Show() != OHOS::Rosen::WMError::WM_OK) { DHLOGE("Show window failed."); return ERR_DH_SCREEN_SCREENCLIENT_SHOW_WINDOW_ERROR; } @@ -140,7 +140,7 @@ int32_t ScreenClientWindowAdapter::HideWindow(int32_t windowId) DHLOGE("Current window is null."); return ERR_DH_SCREEN_SCREENCLIENT_HIDE_WINDOW_ERROR; } - if (OHOS::Rosen::WMError::WM_OK != window->Hide()) { + if (window->Hide() != OHOS::Rosen::WMError::WM_OK) { DHLOGE("Hide window failed."); return ERR_DH_SCREEN_SCREENCLIENT_HIDE_WINDOW_ERROR; } @@ -164,7 +164,7 @@ int32_t ScreenClientWindowAdapter::MoveWindow(int32_t windowId, int32_t startX, DHLOGE("Current window is null(windowId = %d).", windowId); return ERR_DH_SCREEN_SCREENCLIENT_MOVE_WINDOW_ERROR; } - if (OHOS::Rosen::WMError::WM_OK != window->MoveTo(startX, startY)) { + if (window->MoveTo(startX, startY) != OHOS::Rosen::WMError::WM_OK) { DHLOGE("Move window failed (windowId = %d).", windowId); return ERR_DH_SCREEN_SCREENCLIENT_MOVE_WINDOW_ERROR; } @@ -189,11 +189,11 @@ int32_t ScreenClientWindowAdapter::RemoveWindow(int32_t windowId) DHLOGE("Current window is null(windowId = %d).", windowId); return ERR_DH_SCREEN_SCREENCLIENT_REMOVE_WINDOW_ERROR; } - if (OHOS::Rosen::WMError::WM_OK != window->Hide()) { + if (window->Hide() != OHOS::Rosen::WMError::WM_OK) { DHLOGE("Remove window window failed(windowId = %d).", windowId); return ERR_DH_SCREEN_SCREENCLIENT_REMOVE_WINDOW_ERROR; } - if (OHOS::Rosen::WMError::WM_OK != window->Destroy()) { + if (window->Destroy() != OHOS::Rosen::WMError::WM_OK) { DHLOGE("Remove window window failed(windowId = %d).", windowId); return ERR_DH_SCREEN_SCREENCLIENT_REMOVE_WINDOW_ERROR; } diff --git a/services/screenservice/sinkservice/dscreenservice/include/dscreen_sink_stub.h b/services/screenservice/sinkservice/dscreenservice/include/dscreen_sink_stub.h index ce4b223a..d11f1174 100644 --- a/services/screenservice/sinkservice/dscreenservice/include/dscreen_sink_stub.h +++ b/services/screenservice/sinkservice/dscreenservice/include/dscreen_sink_stub.h @@ -27,8 +27,8 @@ namespace DistributedHardware { class DScreenSinkStub : public IRemoteStub { public: DScreenSinkStub(); - virtual ~DScreenSinkStub() = default; - virtual int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, + ~DScreenSinkStub() = default; + int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; private: using DScreenSinkFunc = int32_t (DScreenSinkStub::*)(MessageParcel &data, MessageParcel &reply, diff --git a/services/screenservice/sinkservice/dscreenservice/src/dscreen_sink_stub.cpp b/services/screenservice/sinkservice/dscreenservice/src/dscreen_sink_stub.cpp index 6c4eaf6c..bb856bac 100644 --- a/services/screenservice/sinkservice/dscreenservice/src/dscreen_sink_stub.cpp +++ b/services/screenservice/sinkservice/dscreenservice/src/dscreen_sink_stub.cpp @@ -52,6 +52,7 @@ int32_t DScreenSinkStub::OnRemoteRequest(uint32_t code, MessageParcel &data, Mes int32_t DScreenSinkStub::InitSinkInner(MessageParcel &data, MessageParcel &reply, MessageOption &option) { + (void)option; std::string param = data.ReadString(); if (param.empty() || param.size() > PARAM_MAX_SIZE) { DHLOGE("InitSinkInner error: invalid parameter."); @@ -65,6 +66,8 @@ int32_t DScreenSinkStub::InitSinkInner(MessageParcel &data, MessageParcel &reply int32_t DScreenSinkStub::ReleaseSinkInner(MessageParcel &data, MessageParcel &reply, MessageOption &option) { + (void)data; + (void)option; int32_t ret = ReleaseSink(); reply.WriteInt32(ret); return DH_SUCCESS; @@ -73,6 +76,7 @@ int32_t DScreenSinkStub::ReleaseSinkInner(MessageParcel &data, MessageParcel &re int32_t DScreenSinkStub::SubscribeDistributedHardwareInner(MessageParcel &data, MessageParcel &reply, MessageOption &option) { + (void)option; std::string dhId = data.ReadString(); std::string param = data.ReadString(); if (dhId.empty() || dhId.size() > DID_MAX_SIZE || param.empty() || param.size() > PARAM_MAX_SIZE) { @@ -87,6 +91,7 @@ int32_t DScreenSinkStub::SubscribeDistributedHardwareInner(MessageParcel &data, int32_t DScreenSinkStub::UnsubscribeDistributedHardwareInner(MessageParcel &data, MessageParcel &reply, MessageOption &option) { + (void)option; std::string dhId = data.ReadString(); if (dhId.empty() || dhId.size() > DID_MAX_SIZE) { DHLOGE("UnsubscribeDistributedHardwareInner error: invalid parameter."); @@ -100,6 +105,8 @@ int32_t DScreenSinkStub::UnsubscribeDistributedHardwareInner(MessageParcel &data int32_t DScreenSinkStub::DScreenNotifyInner(MessageParcel &data, MessageParcel &reply, MessageOption &option) { + (void)reply; + (void)option; std::string devId = data.ReadString(); int32_t eventCode = data.ReadInt32(); std::string eventContent = data.ReadString(); diff --git a/services/screenservice/sinkservice/screenregionmgr/include/screenregion.h b/services/screenservice/sinkservice/screenregionmgr/include/screenregion.h index 4aba6850..39b817a8 100644 --- a/services/screenservice/sinkservice/screenregionmgr/include/screenregion.h +++ b/services/screenservice/sinkservice/screenregionmgr/include/screenregion.h @@ -32,7 +32,7 @@ class ScreenSinkTransCallback : public IScreenSinkTransCallback { public: ~ScreenSinkTransCallback() override {}; virtual void OnTransError(int32_t err, const std::string &content) = 0; - virtual void OnError(int32_t err, const std::string &content) override + void OnError(int32_t err, const std::string &content) override { OnTransError(err, content); } @@ -44,7 +44,7 @@ public: ~ScreenRegion(); void OnTransError(int32_t err, const std::string &content) override; void SetVideoParam(std::shared_ptr &videoParam); - void SetMapRelation(std::shared_ptr &mapRElation); + void SetMapRelation(std::shared_ptr &mapRelation); std::string GetRemoteDevId(); uint64_t GetScreenId(); uint64_t GetDisplayId(); diff --git a/services/screenservice/sinkservice/screenregionmgr/include/screenregionmgr.h b/services/screenservice/sinkservice/screenregionmgr/include/screenregionmgr.h index 0495174f..eda7f48a 100644 --- a/services/screenservice/sinkservice/screenregionmgr/include/screenregionmgr.h +++ b/services/screenservice/sinkservice/screenregionmgr/include/screenregionmgr.h @@ -31,7 +31,7 @@ class ScreenRegionManager { DECLARE_SINGLE_INSTANCE_BASE(ScreenRegionManager); public: int32_t ReleaseAllRegions(); - void HandleDScreenNotify(const std::string &devId, int32_t eventCode, const std::string &eventContent); + void HandleDScreenNotify(const std::string &remoteDevId, int32_t eventCode, const std::string &eventContent); void GetScreenDumpInfo(std::string &result); void PublishMessage(const DHTopic topic, const uint64_t &screenId, const std::string &remoteDevId, const int32_t &windowId, std::shared_ptr windowProperty); diff --git a/services/screenservice/sourceservice/dscreenmgr/include/dscreen.h b/services/screenservice/sourceservice/dscreenmgr/include/dscreen.h index 90a394bf..e68b3957 100644 --- a/services/screenservice/sourceservice/dscreenmgr/include/dscreen.h +++ b/services/screenservice/sourceservice/dscreenmgr/include/dscreen.h @@ -42,7 +42,7 @@ class ScreenSourceTransCallback : public IScreenSourceTransCallback { public: ~ScreenSourceTransCallback() override {}; virtual void OnTransError(int32_t err, const std::string &content) = 0; - virtual void OnError(int32_t err, const std::string &content) override + void OnError(int32_t err, const std::string &content) override { OnTransError(err, content); } diff --git a/services/screenservice/sourceservice/dscreenmgr/include/dscreen_manager.h b/services/screenservice/sourceservice/dscreenmgr/include/dscreen_manager.h index df558954..a54cd8e9 100644 --- a/services/screenservice/sourceservice/dscreenmgr/include/dscreen_manager.h +++ b/services/screenservice/sourceservice/dscreenmgr/include/dscreen_manager.h @@ -52,7 +52,7 @@ public: int32_t Init(); int32_t UnInit(); - int32_t EnableDistributedScreen(const std::string &devId, const std::string &dhId, const std::string ¶m, + int32_t EnableDistributedScreen(const std::string &devId, const std::string &dhId, const std::string &attrs, const std::string &reqId); int32_t DisableDistributedScreen(const std::string &devId, const std::string &dhId, const std::string &reqId); void HandleDScreenNotify(const std::string &devId, int32_t eventCode, const std::string &eventContent); diff --git a/services/screenservice/sourceservice/dscreenmgr/src/dscreen_manager.cpp b/services/screenservice/sourceservice/dscreenmgr/src/dscreen_manager.cpp index 5cdaba24..5f2a8215 100644 --- a/services/screenservice/sourceservice/dscreenmgr/src/dscreen_manager.cpp +++ b/services/screenservice/sourceservice/dscreenmgr/src/dscreen_manager.cpp @@ -123,14 +123,14 @@ void DScreenManager::HandleScreenChange(const std::shared_ptr &changedS uint64_t screenId = changedScreen->GetScreenId(); DHLOGI("DScreenManager::HandleScreenChange, screenId: %ulld, changeEvent: %", screenId, event); if (event == Rosen::ScreenGroupChangeEvent::ADD_TO_GROUP) { - if (DH_SUCCESS != AddToGroup(changedScreen, screenId)) { + if (AddToGroup(changedScreen, screenId) != DH_SUCCESS) { DHLOGE("AddToGroup failed."); return; } NotifyRemoteSinkSetUp(changedScreen); PublishMessage(DHTopic::TOPIC_START_DSCREEN, changedScreen); } else if (event == Rosen::ScreenGroupChangeEvent::REMOVE_FROM_GROUP) { - if (DH_SUCCESS != RemoveFromGroup(changedScreen, screenId)) { + if (RemoveFromGroup(changedScreen, screenId) != DH_SUCCESS) { DHLOGE("RemoveFromGroup failed."); } PublishMessage(DHTopic::TOPIC_STOP_DSCREEN, changedScreen); diff --git a/services/screenservice/sourceservice/dscreenservice/include/callback/dscreen_source_callback_proxy.h b/services/screenservice/sourceservice/dscreenservice/include/callback/dscreen_source_callback_proxy.h index 8a91b413..e809de15 100644 --- a/services/screenservice/sourceservice/dscreenservice/include/callback/dscreen_source_callback_proxy.h +++ b/services/screenservice/sourceservice/dscreenservice/include/callback/dscreen_source_callback_proxy.h @@ -38,7 +38,7 @@ public: private: static inline BrokerDelegator delegator_; bool CheckParams(const std::string &devId, const std::string &dhId, const std::string &reqId, - const std::string &resultData); + const std::string &resultData) const; const size_t DID_MAX_SIZE = 256; const size_t PARAM_MAX_SIZE = 50 * 1024 * 1024; }; diff --git a/services/screenservice/sourceservice/dscreenservice/include/dscreen_source_stub.h b/services/screenservice/sourceservice/dscreenservice/include/dscreen_source_stub.h index 487d7e7f..ad7dc6e0 100644 --- a/services/screenservice/sourceservice/dscreenservice/include/dscreen_source_stub.h +++ b/services/screenservice/sourceservice/dscreenservice/include/dscreen_source_stub.h @@ -26,7 +26,7 @@ class DScreenSourceStub : public IRemoteStub { public: DScreenSourceStub(); virtual ~DScreenSourceStub() = default; - virtual int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, + int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; private: @@ -43,10 +43,10 @@ private: int32_t DScreenNotifyInner(MessageParcel &data, MessageParcel &reply, MessageOption &option); bool CheckRegParams(const std::string &devId, const std::string &dhId, - const std::string &version, const std::string &attrs, const std::string &reqId); - bool CheckUnregParams(const std::string &devId, const std::string &dhId, const std::string &reqId); + const std::string &version, const std::string &attrs, const std::string &reqId) const; + bool CheckUnregParams(const std::string &devId, const std::string &dhId, const std::string &reqId) const; bool CheckConfigParams(const std::string &devId, const std::string &dhId, - const std::string &key, const std::string &value); + const std::string &key, const std::string &value) const; using DScreenSourceFunc = int32_t (DScreenSourceStub::*)(MessageParcel &data, MessageParcel &reply, MessageOption &option); std::map memberFuncMap_; diff --git a/services/screenservice/sourceservice/dscreenservice/src/callback/dscreen_source_callback_proxy.cpp b/services/screenservice/sourceservice/dscreenservice/src/callback/dscreen_source_callback_proxy.cpp index af76103f..9ed713fa 100644 --- a/services/screenservice/sourceservice/dscreenservice/src/callback/dscreen_source_callback_proxy.cpp +++ b/services/screenservice/sourceservice/dscreenservice/src/callback/dscreen_source_callback_proxy.cpp @@ -86,7 +86,7 @@ int32_t DScreenSourceCallbackProxy::OnNotifyUnregResult(const std::string &devId } bool DScreenSourceCallbackProxy::CheckParams(const std::string &devId, const std::string &dhId, - const std::string &reqId, const std::string &resultData) + const std::string &reqId, const std::string &resultData) const { if (devId.empty() || devId.size() > DID_MAX_SIZE || dhId.empty() || dhId.size() > DID_MAX_SIZE) { DHLOGE("DScreenSourceCallbackProxy CheckParams devId or dhId is invalid."); diff --git a/services/screenservice/sourceservice/dscreenservice/src/dscreen_source_stub.cpp b/services/screenservice/sourceservice/dscreenservice/src/dscreen_source_stub.cpp index e8fda0a4..4a023c20 100644 --- a/services/screenservice/sourceservice/dscreenservice/src/dscreen_source_stub.cpp +++ b/services/screenservice/sourceservice/dscreenservice/src/dscreen_source_stub.cpp @@ -56,6 +56,7 @@ int32_t DScreenSourceStub::OnRemoteRequest(uint32_t code, MessageParcel &data, M int32_t DScreenSourceStub::InitSourceInner(MessageParcel &data, MessageParcel &reply, MessageOption &option) { + (void)option; std::string param = data.ReadString(); if (param.empty() || param.size() > PARAM_MAX_SIZE) { DHLOGE("InitSourceInner error: invalid parameter"); @@ -80,6 +81,8 @@ int32_t DScreenSourceStub::InitSourceInner(MessageParcel &data, MessageParcel &r int32_t DScreenSourceStub::ReleaseSourceInner(MessageParcel &data, MessageParcel &reply, MessageOption &option) { + (void)data; + (void)option; int32_t ret = ReleaseSource(); reply.WriteInt32(ret); return DH_SUCCESS; @@ -88,6 +91,7 @@ int32_t DScreenSourceStub::ReleaseSourceInner(MessageParcel &data, MessageParcel int32_t DScreenSourceStub::RegisterDistributedHardwareInner(MessageParcel &data, MessageParcel &reply, MessageOption &option) { + (void)option; std::string devId = data.ReadString(); std::string dhId = data.ReadString(); std::string version = data.ReadString(); @@ -109,6 +113,7 @@ int32_t DScreenSourceStub::RegisterDistributedHardwareInner(MessageParcel &data, int32_t DScreenSourceStub::UnregisterDistributedHardwareInner(MessageParcel &data, MessageParcel &reply, MessageOption &option) { + (void)option; std::string devId = data.ReadString(); std::string dhId = data.ReadString(); std::string reqId = data.ReadString(); @@ -125,6 +130,7 @@ int32_t DScreenSourceStub::UnregisterDistributedHardwareInner(MessageParcel &dat int32_t DScreenSourceStub::ConfigDistributedHardwareInner(MessageParcel &data, MessageParcel &reply, MessageOption &option) { + (void)option; std::string devId = data.ReadString(); std::string dhId = data.ReadString(); std::string key = data.ReadString(); @@ -142,6 +148,8 @@ int32_t DScreenSourceStub::ConfigDistributedHardwareInner(MessageParcel &data, M int32_t DScreenSourceStub::DScreenNotifyInner(MessageParcel &data, MessageParcel &reply, MessageOption &option) { + (void)reply; + (void)option; std::string devId = data.ReadString(); int32_t eventCode = data.ReadInt32(); std::string eventContent = data.ReadString(); @@ -156,7 +164,7 @@ int32_t DScreenSourceStub::DScreenNotifyInner(MessageParcel &data, MessageParcel } bool DScreenSourceStub::CheckRegParams(const std::string &devId, const std::string &dhId, - const std::string &version, const std::string &attrs, const std::string &reqId) + const std::string &version, const std::string &attrs, const std::string &reqId) const { if (devId.empty() || devId.size() > DID_MAX_SIZE || dhId.empty() || dhId.size() > DID_MAX_SIZE) { DHLOGE("DScreenSourceStub CheckRegParams devId or dhId is inlvalid."); @@ -173,7 +181,8 @@ bool DScreenSourceStub::CheckRegParams(const std::string &devId, const std::stri return true; } -bool DScreenSourceStub::CheckUnregParams(const std::string &devId, const std::string &dhId, const std::string &reqId) +bool DScreenSourceStub::CheckUnregParams(const std::string &devId, + const std::string &dhId, const std::string &reqId) const { if (devId.empty() || devId.size() > DID_MAX_SIZE || dhId.empty() || dhId.size() > DID_MAX_SIZE) { DHLOGE("DScreenSourceStub CheckUnregParams devId or dhId is invalid."); @@ -187,7 +196,7 @@ bool DScreenSourceStub::CheckUnregParams(const std::string &devId, const std::st } bool DScreenSourceStub::CheckConfigParams(const std::string &devId, const std::string &dhId, - const std::string &key, const std::string &value) + const std::string &key, const std::string &value) const { if (devId.empty() || devId.size() > DID_MAX_SIZE || dhId.empty() || dhId.size() > DID_MAX_SIZE) { DHLOGE("DScreenSourceStub CheckConfigParams devId or dhId is invalid."); diff --git a/services/screentransport/screendatachannel/include/screen_data_channel_impl.h b/services/screentransport/screendatachannel/include/screen_data_channel_impl.h index 9ec16416..1eff6b3c 100644 --- a/services/screentransport/screendatachannel/include/screen_data_channel_impl.h +++ b/services/screentransport/screendatachannel/include/screen_data_channel_impl.h @@ -29,7 +29,7 @@ class ScreenDataChannelImpl : public IScreenChannel, public ISoftbusListener, public std::enable_shared_from_this { public: - ScreenDataChannelImpl(std::string peerDevId) : peerDevId_(peerDevId) {}; + explicit ScreenDataChannelImpl(std::string peerDevId) : peerDevId_(peerDevId) {}; ~ScreenDataChannelImpl() = default; int32_t CreateSession(const std::shared_ptr &listener) override; diff --git a/services/screentransport/screendatachannel/src/screen_data_channel_impl.cpp b/services/screentransport/screendatachannel/src/screen_data_channel_impl.cpp index f9f94bfd..1f34d730 100644 --- a/services/screentransport/screendatachannel/src/screen_data_channel_impl.cpp +++ b/services/screentransport/screendatachannel/src/screen_data_channel_impl.cpp @@ -115,7 +115,7 @@ int32_t ScreenDataChannelImpl::SendData(const std::shared_ptr &scree } StreamData data = {reinterpret_cast(screenData->Data()), screenData->Capacity()}; - StreamData ext = {0}; + StreamData ext = {nullptr}; StreamFrameInfo frameInfo = {0}; int32_t ret = SoftbusAdapter::GetInstance().SendSoftbusStream(sessionId_, &data, &ext, &frameInfo); diff --git a/services/screentransport/screensinkprocessor/decoder/include/image_sink_decoder.h b/services/screentransport/screensinkprocessor/decoder/include/image_sink_decoder.h index d3061757..44a3270f 100644 --- a/services/screentransport/screensinkprocessor/decoder/include/image_sink_decoder.h +++ b/services/screentransport/screensinkprocessor/decoder/include/image_sink_decoder.h @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include "avsharedmemory.h" #include "avcodec_common.h" @@ -38,7 +38,7 @@ namespace OHOS { namespace DistributedHardware { class ImageSinkDecoder : public std::enable_shared_from_this { public: - ImageSinkDecoder(const std::shared_ptr &imageListener) + explicit ImageSinkDecoder(const std::shared_ptr &imageListener) : imageProcessorListener_(imageListener) {}; ~ImageSinkDecoder() = default; diff --git a/services/screentransport/screensinktrans/include/screen_sink_trans.h b/services/screentransport/screensinktrans/include/screen_sink_trans.h index 665c3dc0..f7b417c5 100644 --- a/services/screentransport/screensinktrans/include/screen_sink_trans.h +++ b/services/screentransport/screensinktrans/include/screen_sink_trans.h @@ -38,7 +38,7 @@ public: int32_t Release() override; int32_t Start() override; int32_t Stop() override; - int32_t RegisterStateCallback(const std::shared_ptr &callBack) override; + int32_t RegisterStateCallback(const std::shared_ptr &callback) override; int32_t SetImageSurface(const sptr &surface) override; void OnSessionOpened() override; diff --git a/services/screentransport/screensourceprocessor/encoder/include/image_source_encoder.h b/services/screentransport/screensourceprocessor/encoder/include/image_source_encoder.h index 781ba171..0a15e52a 100644 --- a/services/screentransport/screensourceprocessor/encoder/include/image_source_encoder.h +++ b/services/screentransport/screensourceprocessor/encoder/include/image_source_encoder.h @@ -37,7 +37,7 @@ public: : imageProcessorListener_(imageListener) {}; ~ImageSourceEncoder() = default; - int32_t ConfigureEncoder(const VideoParam &cofigParam); + int32_t ConfigureEncoder(const VideoParam &configParam); int32_t ReleaseEncoder(); int32_t StartEncoder(); int32_t StopEncoder(); @@ -53,7 +53,7 @@ public: private: int32_t InitVideoEncoder(const VideoParam &configParam); - int32_t SetEncoderFormat(const VideoParam &cofigParam); + int32_t SetEncoderFormat(const VideoParam &configParam); private: static const constexpr char *LOG_TAG = "ImageSourceEncoder"; diff --git a/services/screentransport/screensourcetrans/include/screen_source_trans.h b/services/screentransport/screensourcetrans/include/screen_source_trans.h index 81c4bde0..3f40712a 100644 --- a/services/screentransport/screensourcetrans/include/screen_source_trans.h +++ b/services/screentransport/screensourcetrans/include/screen_source_trans.h @@ -42,7 +42,7 @@ public: int32_t Release() override; int32_t Start() override; int32_t Stop() override; - int32_t RegisterStateCallback(const std::shared_ptr &callBack) override; + int32_t RegisterStateCallback(const std::shared_ptr &callback) override; sptr &GetImageSurface() override; void OnSessionOpened() override; diff --git a/services/softbusadapter/include/softbus_adapter.h b/services/softbusadapter/include/softbus_adapter.h index 3d556675..fdcbd733 100644 --- a/services/softbusadapter/include/softbus_adapter.h +++ b/services/softbusadapter/include/softbus_adapter.h @@ -42,11 +42,11 @@ public: int32_t RemoveSoftbusSessionServer(const std::string &pkgname, const std::string &sessionName, const std::string &peerDevId); int32_t OpenSoftbusSession(const std::string &mySessionName, const std::string &peerSessionName, - const std::string &peerDevId); - int32_t CloseSoftbusSession(int32_t sessionId); - int32_t SendSoftbusBytes(int32_t sessionId, const void *data, int32_t dataLen); + const std::string &peerDevId) const; + int32_t CloseSoftbusSession(const int32_t sessionId); + int32_t SendSoftbusBytes(int32_t sessionId, const void *data, int32_t dataLen) const; int32_t SendSoftbusStream(int32_t sessionId, const StreamData *data, const StreamData *ext, - const StreamFrameInfo *param); + const StreamFrameInfo *param) const; int32_t RegisterSoftbusListener(const std::shared_ptr &listener, const std::string &sessionName, const std::string &peerDevId); int32_t UnRegisterSoftbusListener(const std::string &sessionName, const std::string &peerDevId); @@ -55,9 +55,9 @@ public: void OnSoftbusSessionClosed(int32_t sessionId); void OnBytesReceived(int32_t sessionId, const void *data, uint32_t dataLen); void OnStreamReceived(int32_t sessionId, const StreamData *data, const StreamData *ext, - const StreamFrameInfo *StreamFrameInfo); - void OnMessageReceived(int sessionId, const void *data, unsigned int dataLen); - void OnQosEvent(int sessionId, int eventId, int tvCount, const QosTv *tvList); + const StreamFrameInfo *frameInfo); + void OnMessageReceived(int sessionId, const void *data, unsigned int dataLen) const; + void OnQosEvent(int sessionId, int eventId, int tvCount, const QosTv *tvList) const; private: SoftbusAdapter(); diff --git a/services/softbusadapter/src/softbus_adapter.cpp b/services/softbusadapter/src/softbus_adapter.cpp index c4814ab4..89d4e1ec 100644 --- a/services/softbusadapter/src/softbus_adapter.cpp +++ b/services/softbusadapter/src/softbus_adapter.cpp @@ -154,7 +154,7 @@ int32_t SoftbusAdapter::RemoveSoftbusSessionServer(const std::string &pkgname, c } int32_t SoftbusAdapter::OpenSoftbusSession(const std::string &mySessionName, const std::string &peerSessionName, - const std::string &peerDevId) + const std::string &peerDevId) const { DHLOGI("%s: OpenSoftbusSession mysess:%s peersess:%s id:%s.", LOG_TAG, mySessionName.c_str(), peerSessionName.c_str(), GetAnonyString(peerDevId).c_str()); @@ -202,7 +202,7 @@ int32_t SoftbusAdapter::CloseSoftbusSession(const int32_t sessionId) return DH_SUCCESS; } -int32_t SoftbusAdapter::SendSoftbusBytes(int32_t sessionId, const void *data, int32_t dataLen) +int32_t SoftbusAdapter::SendSoftbusBytes(int32_t sessionId, const void *data, int32_t dataLen) const { DHLOGD("%s: SendSoftbusBytes, sessid:%d.", LOG_TAG, sessionId); int32_t ret = SendBytes(sessionId, data, dataLen); @@ -215,7 +215,7 @@ int32_t SoftbusAdapter::SendSoftbusBytes(int32_t sessionId, const void *data, in } int32_t SoftbusAdapter::SendSoftbusStream(int32_t sessionId, const StreamData *data, const StreamData *ext, - const StreamFrameInfo *param) + const StreamFrameInfo *param) const { DHLOGD("%s: SendSoftbusStream, sessid:%d.", LOG_TAG, sessionId); int32_t ret = SendStream(sessionId, data, ext, param); @@ -330,7 +330,7 @@ void SoftbusAdapter::OnStreamReceived(int32_t sessionId, const StreamData *data, DHLOGE("StreamData is null."); return; } - if (data->bufLen <= 0 || data->bufLen > (int32_t)DSCREEN_MAX_RECV_DATA_LEN) { + if (data->bufLen <= 0 || data->bufLen > static_cast(DSCREEN_MAX_RECV_DATA_LEN)) { DHLOGE("StreamData length is too large, dataLen:%d.", data->bufLen); return; } @@ -343,13 +343,18 @@ void SoftbusAdapter::OnStreamReceived(int32_t sessionId, const StreamData *data, listener->OnStreamReceived(sessionId, data, ext, frameInfo); } -void SoftbusAdapter::OnMessageReceived(int sessionId, const void *data, unsigned int dataLen) +void SoftbusAdapter::OnMessageReceived(int sessionId, const void *data, unsigned int dataLen) const { + (void)data; + (void)dataLen; DHLOGD("%s OnMessageReceived, sessionId:%d.", LOG_TAG, sessionId); } -void SoftbusAdapter::OnQosEvent(int sessionId, int eventId, int tvCount, const QosTv *tvList) +void SoftbusAdapter::OnQosEvent(int sessionId, int eventId, int tvCount, const QosTv *tvList) const { + (void)eventId; + (void)tvCount; + (void)tvList; DHLOGD("%s OnQosEvent, sessionId:%d.", LOG_TAG, sessionId); } } // namespace DistributedHardware -- Gitee