From 6dc69fd767099dc1cd1e2390891af586c8aeee70 Mon Sep 17 00:00:00 2001 From: byndyx Date: Fri, 5 Jan 2024 09:54:11 +0800 Subject: [PATCH] fix warn Signed-off-by: byndyx --- common/include/daudio_log.h | 22 +++++++++---------- .../managersource/src/daudio_source_dev.cpp | 1 - 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/common/include/daudio_log.h b/common/include/daudio_log.h index 7e98f0b2..3d597a23 100644 --- a/common/include/daudio_log.h +++ b/common/include/daudio_log.h @@ -40,19 +40,19 @@ void DHLog(DHLogLevel logLevel, const char *fmt, ...); (std::string("[") + DH_LOG_TAG + "][" + __FUNCTION__ + "]:" + fmt).c_str(), ##__VA_ARGS__) #define CHECK_NULL_VOID(ptr) \ - do { \ - if (ptr == nullptr) { \ - DHLOGE("Address pointer is null");\ - return; \ - } \ + do { \ + if ((ptr) == nullptr) { \ + DHLOGE("Address pointer is null"); \ + return; \ + } \ } while (0) -#define CHECK_NULL_RETURN(ptr, ret) \ - do { \ - if (ptr == nullptr) { \ - DHLOGE("Address pointer is null");\ - return ret; \ - } \ +#define CHECK_NULL_RETURN(ptr, ret) \ + do { \ + if ((ptr) == nullptr) { \ + DHLOGE("Address pointer is null"); \ + return (ret); \ + } \ } while (0) } // namespace DistributedHardware } // namespace OHOS diff --git a/services/audiomanager/managersource/src/daudio_source_dev.cpp b/services/audiomanager/managersource/src/daudio_source_dev.cpp index 5e434236..ceb0c6b2 100644 --- a/services/audiomanager/managersource/src/daudio_source_dev.cpp +++ b/services/audiomanager/managersource/src/daudio_source_dev.cpp @@ -658,7 +658,6 @@ int32_t DAudioSourceDev::TaskOpenDSpeaker(const std::string &args) return ERR_DH_AUDIO_FAILED; } auto speaker = FindIoDevImpl(args); - if (speaker == nullptr) { DHLOGE("The IO device is invaild."); NotifyHDF(NOTIFY_OPEN_SPEAKER_RESULT, HDF_EVENT_RESULT_FAILED, dhId); -- Gitee