Description: fix the cppcheck

IssueNo: https://gitee.com/openharmony/graphic_utils/issues/I5RYU4
Feature or Bugfix: Bugfix
Binary Source:No
Signed-off-by: zhouyj <zhouyuanjie1@huawei.com>
This commit is contained in:
Zhouyj_zju
2022-09-20 16:03:55 +08:00
parent c7d67a1131
commit 92167db581
10 changed files with 32 additions and 34 deletions
@@ -107,9 +107,7 @@ bool InputEventListenerProxy::UnregisterInputEventListener()
IpcIoInit(&io, tmpData, IMS_DEFAULT_IPC_SIZE, 1);
int32_t ret = proxy_->Invoke(proxy_, LITEIMS_CLIENT_UNREGISTER, &io, NULL, NULL);
if (ret == 0) {
if (listener_ != nullptr) {
listener_ = nullptr;
}
listener_ = nullptr;
return true;
}
}
+1 -1
View File
@@ -23,7 +23,7 @@
namespace OHOS {
class LiteProxySurface : public ISurface {
public:
LiteProxySurface(Surface* surface);
explicit LiteProxySurface(Surface* surface);
virtual ~LiteProxySurface();
virtual void Lock(void** buf, void** phyMem, uint32_t* strideLen) override;
@@ -40,11 +40,11 @@ IWindow* LiteProxyWindowsManager::CreateWindow(const LiteWinConfig& config)
}
}
void LiteProxyWindowsManager::RemoveWindow(IWindow* window)
void LiteProxyWindowsManager::RemoveWindow(IWindow* win)
{
if (window != nullptr) {
int32_t id = window->GetWindowId();
delete window;
if (win != nullptr) {
int32_t id = win->GetWindowId();
delete win;
LiteWMRequestor::GetInstance()->RemoveWindow(id);
}
}
+1 -1
View File
@@ -48,7 +48,7 @@ int LiteWinRequestor::Callback(void* owner, int code, IpcIo* reply)
GRAPHIC_LOGD("Callback, funcId = %d", para->funcId);
switch (para->funcId) {
case LiteWMS_GetSurface: {
LiteWinRequestor* requestor = (LiteWinRequestor*)(para->data);
LiteWinRequestor* requestor = static_cast<LiteWinRequestor*>(para->data);
int32_t ret;
ReadInt32(reply, &ret);
if ((ret == LiteWMS_EOK) && (requestor != nullptr)) {
+1 -1
View File
@@ -38,7 +38,7 @@ public:
void Resize(int16_t width, int16_t height);
void Update();
int32_t GetWindowId()
int32_t GetWindowId() const
{
return id_;
}
+1 -1
View File
@@ -92,7 +92,7 @@ void InputEventClientProxy::OnRawEvent(const RawEvent& event)
WriteRawData(&io, static_cast<const void*>(&event), sizeof(RawEvent));
pthread_mutex_lock(&lock_);
std::map<pid_t, ClientInfo>::iterator it;
for (it = clientInfoMap_.begin(); it != clientInfoMap_.end(); it++) {
for (it = clientInfoMap_.begin(); it != clientInfoMap_.end(); ++it) {
if (it->second.alwaysInvoke || (event.state != lastState_)) {
MessageOption option;
MessageOptionInit(&option);
+1 -1
View File
@@ -50,7 +50,7 @@ public:
*
* @returns return -1: register callback failed; return 0: register success.
*/
int32_t RegisterReadCallback(ReadCallback callback)
static int32_t RegisterReadCallback(const ReadCallback &callback)
{
if (callback == nullptr) {
return -1;
+2 -2
View File
@@ -35,12 +35,12 @@ public:
/**
* Init input manager service.
*/
void Run();
static void Run();
/**
* Delete input manager service.
*/
void Stop();
static void Stop();
/**
* @brief Distribute task function.
+6 -6
View File
@@ -38,7 +38,7 @@ public:
return id_;
}
const LiteWinConfig& GetConfig()
const LiteWinConfig& GetConfig() const
{
return config_;
}
@@ -54,7 +54,7 @@ public:
isShow_ = isShow;
}
bool GetIsShow()
bool GetIsShow() const
{
return isShow_;
}
@@ -64,17 +64,17 @@ public:
pid_ = pid;
}
pid_t GetPid()
pid_t GetPid() const
{
return pid_;
}
bool IsCoverMode()
bool IsCoverMode() const
{
return config_.compositeMode == LiteWinConfig::COPY;
}
bool NoNeedToDraw()
bool NoNeedToDraw() const
{
return config_.compositeMode == LiteWinConfig::BLEND && config_.opacity == OPA_TRANSPARENT;
}
@@ -90,7 +90,7 @@ public:
void Resize(int16_t width, int16_t height);
private:
bool CreateSurface();
void ReleaseSurface();
static void ReleaseSurface();
void FlushWithModeCopy(const Rect& srcRect, const LiteSurfaceData* layerData, int16_t dx, int16_t dy);
void FlushWithModeBlend(const Rect& srcRect, const LiteSurfaceData* layerData, int16_t dx, int16_t dy);
+14 -14
View File
@@ -38,20 +38,20 @@ private:
static int32_t SurfaceRequestHandler(uint32_t code, IpcIo *data, IpcIo *reply, MessageOption option);
static void DeathCallback(void* arg);
void GetSurface(IpcIo* req, IpcIo* reply);
void Show(IpcIo* req, IpcIo* reply);
void Hide(IpcIo* req, IpcIo* reply);
void RaiseToTop(IpcIo* req, IpcIo* reply);
void LowerToBottom(IpcIo* req, IpcIo* reply);
void MoveTo(IpcIo* req, IpcIo* reply);
void Resize(IpcIo* req, IpcIo* reply);
void Update(IpcIo* req, IpcIo* reply);
void CreateWindow(IpcIo* req, IpcIo* reply);
void RemoveWindow(IpcIo* req, IpcIo* reply);
void GetEventData(IpcIo* req, IpcIo* reply);
void Screenshot(IpcIo* req, IpcIo* reply);
void ClientRegister(IpcIo* req, IpcIo* reply);
void GetLayerInfo(IpcIo* req, IpcIo* reply);
static void GetSurface(IpcIo* req, IpcIo* reply);
static void Show(IpcIo* req, IpcIo* reply);
static void Hide(IpcIo* req, IpcIo* reply);
static void RaiseToTop(IpcIo* req, IpcIo* reply);
static void LowerToBottom(IpcIo* req, IpcIo* reply);
static void MoveTo(IpcIo* req, IpcIo* reply);
static void Resize(IpcIo* req, IpcIo* reply);
static void Update(IpcIo* req, IpcIo* reply);
static void CreateWindow(IpcIo* req, IpcIo* reply);
static void RemoveWindow(IpcIo* req, IpcIo* reply);
static void GetEventData(IpcIo* req, IpcIo* reply);
static void Screenshot(IpcIo* req, IpcIo* reply);
static void ClientRegister(IpcIo* req, IpcIo* reply);
static void GetLayerInfo(IpcIo* req, IpcIo* reply);
};
} // namespace OHOS
#endif