From 8d0bb0f368229ba336558d2cd508ae77de0e1d6c Mon Sep 17 00:00:00 2001 From: leihonglin Date: Wed, 12 Oct 2022 21:08:35 +0800 Subject: [PATCH] optimize cppcheck warning Signed-off-by: leihonglin --- frameworks/wms/lite_proxy_surface.cpp | 2 +- frameworks/wms/lite_win_requestor.cpp | 2 +- frameworks/wms/lite_wm_requestor.cpp | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/frameworks/wms/lite_proxy_surface.cpp b/frameworks/wms/lite_proxy_surface.cpp index 7b26da8..2bf0239 100644 --- a/frameworks/wms/lite_proxy_surface.cpp +++ b/frameworks/wms/lite_proxy_surface.cpp @@ -45,7 +45,7 @@ void LiteProxySurface::Lock(void** buf, void** phyMem, uint32_t* strideLen) } *buf = buffer_->GetVirAddr(); uintptr_t phyAddr = buffer_->GetPhyAddr(); - *phyMem = (void*)phyAddr; + *phyMem = reinterpret_cast(phyAddr); *strideLen = surface_->GetStride(); GRAPHIC_LOGI("strideLen=%d", *strideLen); } diff --git a/frameworks/wms/lite_win_requestor.cpp b/frameworks/wms/lite_win_requestor.cpp index 652ef72..d8c8a12 100644 --- a/frameworks/wms/lite_win_requestor.cpp +++ b/frameworks/wms/lite_win_requestor.cpp @@ -44,7 +44,7 @@ int LiteWinRequestor::Callback(void* owner, int code, IpcIo* reply) return -1; } - CallBackPara* para = (CallBackPara*)owner; + CallBackPara* para = static_cast(owner); GRAPHIC_LOGD("Callback, funcId = %d", para->funcId); switch (para->funcId) { case LiteWMS_GetSurface: { diff --git a/frameworks/wms/lite_wm_requestor.cpp b/frameworks/wms/lite_wm_requestor.cpp index 7fbf7af..4f6fa61 100644 --- a/frameworks/wms/lite_wm_requestor.cpp +++ b/frameworks/wms/lite_wm_requestor.cpp @@ -39,10 +39,10 @@ int LiteWMRequestor::Callback(void* owner, int code, IpcIo* reply) return -1; } - CallBackPara* para = (CallBackPara*)owner; + CallBackPara* para = static_cast(owner); switch (para->funcId) { case LiteWMS_CreateWindow: { - LiteWinRequestor** requestor = (LiteWinRequestor**)(para->data); + LiteWinRequestor** requestor = static_cast(para->data); if (requestor == nullptr) { break; } @@ -58,7 +58,7 @@ int LiteWMRequestor::Callback(void* owner, int code, IpcIo* reply) } case LiteWMS_GetEventData: { DeviceData* data = static_cast(ReadRawData(reply, sizeof(DeviceData))); - DeviceData* retData = (DeviceData*)(para->data); + DeviceData* retData = static_cast(para->data); if (data != nullptr && retData != nullptr) { *retData = *data; } @@ -75,7 +75,7 @@ int LiteWMRequestor::Callback(void* owner, int code, IpcIo* reply) } case LiteWMS_GetLayerInfo: { LiteLayerInfo* data = static_cast(ReadRawData(reply, sizeof(LiteLayerInfo))); - LiteLayerInfo* retData = (LiteLayerInfo*)(para->data); + LiteLayerInfo* retData = static_cast(para->data); if (data != nullptr && retData != nullptr) { *retData = *data; } @@ -174,7 +174,7 @@ void LiteWMRequestor::GetEventData(DeviceData* data) int LiteWMRequestor::SurfaceRequestHandler(uint32_t code, IpcIo* data, IpcIo* reply, MessageOption option) { - SurfaceImpl* surface = (SurfaceImpl*)(option.args); + SurfaceImpl* surface = reinterpret_cast(option.args); if (surface == nullptr) { return 0; } -- Gitee