From 46a6d464e77b84ca909aa3b9dcf52b566b724a98 Mon Sep 17 00:00:00 2001 From: trupthi1403 Date: Fri, 22 May 2026 11:46:16 +0530 Subject: [PATCH] RDKEMW-17599: Fix Low priority Coverity issues Reason for change: Fixed BUFFER_SIZE, PASS_BY_VALUE, PW.NARROWING_CONVERSION, PW.USELESS_TYPE_QUALIFIER_ON_RETURN_TYPE Test procedure: As mentioned in ticket Risks: Low --- closedcaptions/subtec/CCDataController.cpp | 4 ++-- closedcaptions/subtec/CCDataController.h | 2 +- closedcaptions/subtec/SubtecConnector.cpp | 3 ++- drm/helper/DrmHelper.h | 2 +- subtec/libsubtec/SubtecPacket.hpp | 4 ++-- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/closedcaptions/subtec/CCDataController.cpp b/closedcaptions/subtec/CCDataController.cpp index 679e2b5d..847a5b4b 100644 --- a/closedcaptions/subtec/CCDataController.cpp +++ b/closedcaptions/subtec/CCDataController.cpp @@ -274,7 +274,7 @@ namespace } } -void CCDataController::sendCCSetAttribute(gsw_CcAttributes * attrib, short type, gsw_CcType ccType) +void CCDataController::sendCCSetAttribute(gsw_CcAttributes * attrib, uint32_t type, gsw_CcType ccType) { using AttributesArray = std::array ; @@ -312,7 +312,7 @@ void CCDataController::sendCCSetAttribute(gsw_CcAttributes * attrib, short type, const auto ccTypeValue = getValue(ccType); - channel.SendCCSetAttributePacket(ccTypeValue, uint32_t{type}, attributes); + channel.SendCCSetAttributePacket(ccTypeValue, type, attributes); } void closedCaptionDecodeCb(void *context, int decoderIndex, int event) diff --git a/closedcaptions/subtec/CCDataController.h b/closedcaptions/subtec/CCDataController.h index 178afdc2..d9726900 100644 --- a/closedcaptions/subtec/CCDataController.h +++ b/closedcaptions/subtec/CCDataController.h @@ -62,7 +62,7 @@ class CCDataController void sendPause(); void sendResume(); void sendResetChannelPacket(); - void sendCCSetAttribute(gsw_CcAttributes * attrib, short type, gsw_CcType ccType); + void sendCCSetAttribute(gsw_CcAttributes * attrib, uint32_t type, gsw_CcType ccType); void ccSetDigitalChannel(unsigned int channel); void ccSetAnalogChannel(unsigned int channel); diff --git a/closedcaptions/subtec/SubtecConnector.cpp b/closedcaptions/subtec/SubtecConnector.cpp index 0cf4a4d9..8ae4ed6c 100644 --- a/closedcaptions/subtec/SubtecConnector.cpp +++ b/closedcaptions/subtec/SubtecConnector.cpp @@ -151,7 +151,8 @@ namespace ccMgrAPI { ((gsw_CcColor*)values[i])->rgb = pValues[i]; strncpy(((gsw_CcColor*)values[i])->name, pValuesNames[i], - GSW_MAX_CC_COLOR_NAME_LENGTH); + GSW_MAX_CC_COLOR_NAME_LENGTH - 1); + ((gsw_CcColor*)values[i])->name[GSW_MAX_CC_COLOR_NAME_LENGTH - 1] = '\0'; } break; } diff --git a/drm/helper/DrmHelper.h b/drm/helper/DrmHelper.h index f8df2cd0..65004616 100755 --- a/drm/helper/DrmHelper.h +++ b/drm/helper/DrmHelper.h @@ -92,7 +92,7 @@ class DrmHelper const std::string EMPTY_DRM_METADATA; const std::string EMPTY_STRING; - DrmHelper(const struct DrmInfo drmInfo) : mDrmInfo(drmInfo), TIMEOUT_SECONDS(5000U), EMPTY_DRM_METADATA(), EMPTY_STRING() ,bOutputProtectionEnabled(false), protectionScheme() {} + DrmHelper(const struct DrmInfo& drmInfo) : mDrmInfo(drmInfo), TIMEOUT_SECONDS(5000U), EMPTY_DRM_METADATA(), EMPTY_STRING() ,bOutputProtectionEnabled(false), protectionScheme() {} DrmHelper(const DrmHelper&) = delete; DrmHelper& operator=(const DrmHelper&) = delete; diff --git a/subtec/libsubtec/SubtecPacket.hpp b/subtec/libsubtec/SubtecPacket.hpp index 68f8f9c0..06959714 100644 --- a/subtec/libsubtec/SubtecPacket.hpp +++ b/subtec/libsubtec/SubtecPacket.hpp @@ -34,7 +34,7 @@ class Packet Packet() : m_buffer(), m_counter(std::numeric_limits::max()) {} Packet(std::uint32_t counter) : m_buffer(), m_counter(counter) {} - const uint32_t getType() + uint32_t getType() { uint32_t type = 0; @@ -54,7 +54,7 @@ class Packet return m_buffer; } - const std::uint32_t getCounter() + std::uint32_t getCounter() { return m_counter; }