From d050b8aace3057a173d23e45ec7f0fb751e2302c Mon Sep 17 00:00:00 2001 From: wangchaole Date: Tue, 23 Aug 2022 20:07:45 +0800 Subject: [PATCH] =?UTF-8?q?fuzz=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: panchengzhong <1144372483@qq.com> --- .../camera_source/include/dcamera_source_handler.h | 4 ++-- .../camera_source/src/dcamera_source_handler.cpp | 13 +++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/interfaces/inner_kits/native_cpp/camera_source/include/dcamera_source_handler.h b/interfaces/inner_kits/native_cpp/camera_source/include/dcamera_source_handler.h index ea9f10f1..adc6cb99 100644 --- a/interfaces/inner_kits/native_cpp/camera_source/include/dcamera_source_handler.h +++ b/interfaces/inner_kits/native_cpp/camera_source/include/dcamera_source_handler.h @@ -41,7 +41,7 @@ public: const std::string& value) override; private: - DCameraSourceHandler() = default; + DCameraSourceHandler(); ~DCameraSourceHandler(); private: @@ -58,4 +58,4 @@ __attribute__((visibility("default"))) IDistributedHardwareSource *GetSourceHard #endif } } -#endif \ No newline at end of file +#endif diff --git a/interfaces/inner_kits/native_cpp/camera_source/src/dcamera_source_handler.cpp b/interfaces/inner_kits/native_cpp/camera_source/src/dcamera_source_handler.cpp index 5c22664a..9aeb4fa0 100644 --- a/interfaces/inner_kits/native_cpp/camera_source/src/dcamera_source_handler.cpp +++ b/interfaces/inner_kits/native_cpp/camera_source/src/dcamera_source_handler.cpp @@ -26,6 +26,12 @@ namespace OHOS { namespace DistributedHardware { IMPLEMENT_SINGLE_INSTANCE(DCameraSourceHandler); +DCameraSourceHandler::DCameraSourceHandler() +{ + DHLOGI("DCameraSourceHandler construct."); + callback_ = new DCameraSourceCallback(); +} + DCameraSourceHandler::~DCameraSourceHandler() { DHLOGI("~DCameraSourceHandler"); @@ -41,11 +47,6 @@ int32_t DCameraSourceHandler::InitSource(const std::string& params) return DCAMERA_INIT_ERR; } - callback_ = new DCameraSourceCallback(); - if (callback_ == nullptr) { - DHLOGE("DCameraSourceHandler InitSource init callback failed"); - return DCAMERA_INIT_ERR; - } int32_t ret = dCameraSourceSrv->InitSource(params, callback_); DHLOGI("DCameraSourceHandler InitSource end, ret: %d", ret); return ret; @@ -123,4 +124,4 @@ IDistributedHardwareSource *GetSourceHardwareHandler() return &DCameraSourceHandler::GetInstance(); } } -} \ No newline at end of file +} -- Gitee