Skip to content

Commit 1323964

Browse files
slkanthiarjunbinu
authored andcommitted
RDK-54413: Correct the usage of array of pointers param in GetTVSupported APIs
1 parent 7644da8 commit 1323964

File tree

2 files changed

+20
-7
lines changed

2 files changed

+20
-7
lines changed

AVOutput/AVOutputTV.cpp

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2204,13 +2204,16 @@ namespace Plugin {
22042204
{
22052205
LOGINFO("Entry\n");
22062206
tvDolbyMode_t dvModes[tvMode_Max];
2207-
tvDolbyMode_t *dvModesPtr = dvModes; // Pointer to statically allocated tvDolbyMode_t array
2207+
tvDolbyMode_t *dvModesPtr[tvMode_Max];
22082208
unsigned short totalAvailable = 0;
2209-
2209+
for (int i = 0; i < tvMode_Max; i++)
2210+
{
2211+
dvModesPtr[i] = &dvModes[i];
2212+
}
22102213
// Set an initial value to indicate the mode type
22112214
dvModes[0] = tvDolbyMode_Dark;
22122215

2213-
tvError_t ret = GetTVSupportedDolbyVisionModes(&dvModesPtr, &totalAvailable);
2216+
tvError_t ret = GetTVSupportedDolbyVisionModes(dvModesPtr, &totalAvailable);
22142217
if(ret != tvERROR_NONE) {
22152218
returnResponse(false);
22162219
}
@@ -2423,9 +2426,14 @@ namespace Plugin {
24232426
uint32_t AVOutputTV::getSupportedPictureModes(const JsonObject& parameters, JsonObject& response)
24242427
{
24252428
LOGINFO("Entry\n");
2426-
pic_modes_t *pictureModes;
2429+
pic_modes_t pictureModes[PIC_MODES_SUPPORTED_MAX];
2430+
pic_modes_t *pictureModesPtr[PIC_MODES_SUPPORTED_MAX];
24272431
unsigned short totalAvailable = 0;
2428-
tvError_t ret = GetTVSupportedPictureModes(&pictureModes,&totalAvailable);
2432+
for (int i = 0; i < PIC_MODES_SUPPORTED_MAX; i++)
2433+
{
2434+
pictureModesPtr[i] = &pictureModes[i];
2435+
}
2436+
tvError_t ret = GetTVSupportedPictureModes(pictureModesPtr,&totalAvailable);
24292437
if(ret != tvERROR_NONE) {
24302438
returnResponse(false);
24312439
}

AVOutput/AVOutputTVHelper.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,13 +266,18 @@ namespace Plugin {
266266
{
267267
int mode = 0;
268268
tvDolbyMode_t dolbyModes[tvMode_Max];
269-
tvDolbyMode_t *dolbyModesPtr = dolbyModes; // Pointer to statically allocated tvDolbyMode_t array
269+
tvDolbyMode_t *dolbyModesPtr[tvMode_Max];
270270
unsigned short totalAvailable = 0;
271271

272+
for (int i = 0; i < tvMode_Max; i++)
273+
{
274+
dolbyModesPtr[i] = &dolbyModes[i];
275+
}
276+
272277
// Set an initial value to indicate the mode type
273278
dolbyModes[0] = tvDolbyMode_Dark;
274279

275-
tvError_t ret = GetTVSupportedDolbyVisionModes(&dolbyModesPtr, &totalAvailable);
280+
tvError_t ret = GetTVSupportedDolbyVisionModes(dolbyModesPtr, &totalAvailable);
276281
if (ret == tvERROR_NONE) {
277282
for (int count = 0; count < totalAvailable; count++) {
278283
if(strncasecmp(dolbyMode, getDolbyModeStringFromEnum(dolbyModes[count]).c_str(), strlen(dolbyMode))==0) {

0 commit comments

Comments
 (0)