From 6db8c2b18848121b7a29b1b0221e184afbab8d3d Mon Sep 17 00:00:00 2001 From: wangchaole Date: Fri, 23 Sep 2022 10:33:51 +0800 Subject: [PATCH] fix: Resolve reviewbot alarm Signed-off-by: wangchaole --- .../camera_sink/src/distributed_camera_sink_proxy.cpp | 3 +-- .../cameraservice/cameraoperator/client/src/dcamera_client.cpp | 2 +- .../src/listener/dcamera_video_surface_listener_common.cpp | 3 ++- .../src/distributedcamera/distributed_camera_sink_stub.cpp | 3 +-- .../distributedcamera/distributed_camera_sink_service_test.cpp | 2 +- .../dcamerahdf/dcamera_provider_callback_impl.cpp | 2 +- 6 files changed, 7 insertions(+), 8 deletions(-) diff --git a/interfaces/inner_kits/native_cpp/camera_sink/src/distributed_camera_sink_proxy.cpp b/interfaces/inner_kits/native_cpp/camera_sink/src/distributed_camera_sink_proxy.cpp index 9674fc02..7256c70e 100644 --- a/interfaces/inner_kits/native_cpp/camera_sink/src/distributed_camera_sink_proxy.cpp +++ b/interfaces/inner_kits/native_cpp/camera_sink/src/distributed_camera_sink_proxy.cpp @@ -195,8 +195,7 @@ int32_t DistributedCameraSinkProxy::ChannelNeg(const std::string& dhId, std::str int32_t DistributedCameraSinkProxy::GetCameraInfo(const std::string& dhId, std::string& cameraInfo) { DHLOGI("DistributedCameraSinkProxy::GetCameraInfo dhId: %s", GetAnonyString(dhId).c_str()); - if (dhId.empty() || dhId.size() > DID_MAX_SIZE || cameraInfo.empty() || - cameraInfo.size() > PARAM_MAX_SIZE) { + if (dhId.empty() || dhId.size() > DID_MAX_SIZE) { DHLOGE("DistributedCameraSinkProxy::GetCameraInfo parmas is invalid"); return DCAMERA_BAD_VALUE; } diff --git a/services/cameraservice/cameraoperator/client/src/dcamera_client.cpp b/services/cameraservice/cameraoperator/client/src/dcamera_client.cpp index 84f94373..69f5549f 100644 --- a/services/cameraservice/cameraoperator/client/src/dcamera_client.cpp +++ b/services/cameraservice/cameraoperator/client/src/dcamera_client.cpp @@ -564,7 +564,7 @@ void DCameraClient::SetPhotoCaptureLocation(const std::shared_ptrlongitude = item.data.d[longitudeIndex]; location->altitude = item.data.d[altitudeIndex]; photoCaptureSetting->SetLocation(location); - DHLOGI("DCameraClient::SetPhotoCaptureLocation %s photo capture settings set %d location success" , + DHLOGI("DCameraClient::SetPhotoCaptureLocation %s photo capture settings set %d location success", GetAnonyString(cameraId_).c_str(), item.count); } } diff --git a/services/cameraservice/cameraoperator/client/src/listener/dcamera_video_surface_listener_common.cpp b/services/cameraservice/cameraoperator/client/src/listener/dcamera_video_surface_listener_common.cpp index 9c3f5522..3203298c 100644 --- a/services/cameraservice/cameraoperator/client/src/listener/dcamera_video_surface_listener_common.cpp +++ b/services/cameraservice/cameraoperator/client/src/listener/dcamera_video_surface_listener_common.cpp @@ -51,7 +51,8 @@ void DCameraVideoSurfaceListener::OnBufferAvailable() int32_t size = width * height * 4; char *address = static_cast(buffer->GetVirAddr()); if ((address == nullptr) || (size <= 0) || (size > SURFACE_BUFFER_MAX_SIZE)) { - DHLOGE("DCameraVideoSurfaceListenerCommon invalid params, width: %d, height: %d, size: %d", width, height, size); + DHLOGE("DCameraVideoSurfaceListenerCommon invalid params, width: %d, height: %d, size: %d", + width, height, size); break; } DHLOGI("DCameraVideoSurfaceListenerCommon size: %d", size); diff --git a/services/cameraservice/sinkservice/src/distributedcamera/distributed_camera_sink_stub.cpp b/services/cameraservice/sinkservice/src/distributedcamera/distributed_camera_sink_stub.cpp index 385f281f..dd4ce423 100644 --- a/services/cameraservice/sinkservice/src/distributedcamera/distributed_camera_sink_stub.cpp +++ b/services/cameraservice/sinkservice/src/distributedcamera/distributed_camera_sink_stub.cpp @@ -158,8 +158,7 @@ int32_t DistributedCameraSinkStub::GetCameraInfoInner(MessageParcel &data, Messa do { std::string dhId = data.ReadString(); std::string cameraInfo = data.ReadString(); - if (dhId.empty() || dhId.size() > DID_MAX_SIZE || cameraInfo.empty() || - cameraInfo.size() > PARAM_MAX_SIZE) { + if (dhId.empty() || dhId.size() > DID_MAX_SIZE) { DHLOGE("DistributedCameraSinkStub::GetCameraInfoInner params is invalid"); ret = DCAMERA_BAD_VALUE; break; diff --git a/services/cameraservice/sinkservice/test/unittest/common/distributedcamera/distributed_camera_sink_service_test.cpp b/services/cameraservice/sinkservice/test/unittest/common/distributedcamera/distributed_camera_sink_service_test.cpp index e9b56f45..40332a23 100644 --- a/services/cameraservice/sinkservice/test/unittest/common/distributedcamera/distributed_camera_sink_service_test.cpp +++ b/services/cameraservice/sinkservice/test/unittest/common/distributedcamera/distributed_camera_sink_service_test.cpp @@ -37,7 +37,7 @@ public: static std::string g_dhId; static sptr g_service; -std::string g_testParams = ""; +std::string g_testParams = "TestParams"; std::string g_testCameraInfo = ""; std::string g_testChannelInfoContinue = R"({ "Type": "OPERATION", diff --git a/services/cameraservice/sourceservice/src/distributedcameramgr/dcamerahdf/dcamera_provider_callback_impl.cpp b/services/cameraservice/sourceservice/src/distributedcameramgr/dcamerahdf/dcamera_provider_callback_impl.cpp index cd981069..3049ca6e 100644 --- a/services/cameraservice/sourceservice/src/distributedcameramgr/dcamerahdf/dcamera_provider_callback_impl.cpp +++ b/services/cameraservice/sourceservice/src/distributedcameramgr/dcamerahdf/dcamera_provider_callback_impl.cpp @@ -88,7 +88,7 @@ int32_t DCameraProviderCallbackImpl::CloseSession(const DHBase& dhBase) bool DCameraProviderCallbackImpl::CheckDHBase(const DHBase& dhBase) { if (dhBase.deviceId_.empty() || dhBase.deviceId_.size() > DID_MAX_SIZE || - dhBase.dhId_.empty() || dhBase.dhId_.size() > DID_MAX_SIZE ) { + dhBase.dhId_.empty() || dhBase.dhId_.size() > DID_MAX_SIZE) { DHLOGE("DCameraProviderCallbackImpl CheckDHBase dhBase is invalid"); return false; } -- Gitee