1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Fixed selecting delivery system names in case of undefined indexes

This commit is contained in:
Klaus Schmidinger 2017-05-09 09:43:25 +02:00
parent dbcea07600
commit 4591dcad2c
3 changed files with 16 additions and 4 deletions

View File

@ -3417,6 +3417,7 @@ Jasmin Jessich <jasmin@anw.at>
assigned to any devices
for writing the ddci2 plugin and for valuable input and help with testing and
debugging MTD support
for fixing selecting delivery system names in case of undefined indexes
Martin Schirrmacher <schirrmie@gmail.com>
for suggesting to provide a way for skin plugins to get informed about the currently

View File

@ -9015,3 +9015,5 @@ Video Disk Recorder Revision History
- Changed the default return value of cEpgHandler::BeginSegmentTransfer() to true, to
avoid problems with derived classes that don't implement this function (reported by
Frank Neumann).
- Fixed selecting delivery system names in case of undefined indexes (thanks to Jasmin
Jessich).

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: dvbdevice.c 4.10 2017/05/01 12:48:55 kls Exp $
* $Id: dvbdevice.c 4.11 2017/05/09 09:42:40 kls Exp $
*/
#include "dvbdevice.h"
@ -1299,6 +1299,15 @@ const char *DeliverySystemNames[] = {
NULL
};
static const int DeliverySystemNamesMax = sizeof(DeliverySystemNames) / sizeof(DeliverySystemNames[0]) - 2; // -1 to get the maximum allowed index & -1 for the NULL => -2
static const char *GetDeliverySystemName(int Index)
{
if (Index > DeliverySystemNamesMax)
Index = 0;
return DeliverySystemNames[Index];
};
cDvbDevice::cDvbDevice(int Adapter, int Frontend)
{
adapter = Adapter;
@ -1396,9 +1405,9 @@ cString cDvbDevice::DeviceType(void) const
{
if (dvbTuner) {
if (dvbTuner->FrontendType() != SYS_UNDEFINED)
return DeliverySystemNames[dvbTuner->FrontendType()];
return GetDeliverySystemName(dvbTuner->FrontendType());
if (numDeliverySystems)
return DeliverySystemNames[deliverySystems[0]]; // to have some reasonable default
return GetDeliverySystemName(deliverySystems[0]); // to have some reasonable default
}
return "";
}
@ -1529,7 +1538,7 @@ bool cDvbDevice::QueryDeliverySystems(int fd_frontend)
if (numDeliverySystems > 0) {
cString ds("");
for (int i = 0; i < numDeliverySystems; i++)
ds = cString::sprintf("%s%s%s", *ds, i ? "," : "", DeliverySystemNames[deliverySystems[i]]);
ds = cString::sprintf("%s%s%s", *ds, i ? "," : "", GetDeliverySystemName(deliverySystems[i]));
cString ms("");
if (frontendInfo.caps & FE_CAN_QPSK) { numModulations++; ms = cString::sprintf("%s%s%s", *ms, **ms ? "," : "", MapToUserString(QPSK, ModulationValues)); }
if (frontendInfo.caps & FE_CAN_QAM_16) { numModulations++; ms = cString::sprintf("%s%s%s", *ms, **ms ? "," : "", MapToUserString(QAM_16, ModulationValues)); }