From db0c18ba33af6e554f845198e306afaab3ac6d45 Mon Sep 17 00:00:00 2001 From: Rolf Ahrenberg Date: Sun, 31 Jul 2016 12:00:55 +0300 Subject: [PATCH] Check source validity also in server assign (Thanks to Patrick Boettcher). --- server.c | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/server.c b/server.c index 1e89fd9..ad2af5c 100644 --- a/server.c +++ b/server.c @@ -204,26 +204,6 @@ int cSatipServer::Compare(const cListObject &listObjectP) const return result; } -bool cSatipServer::Assign(int deviceIdP, int sourceP, int systemP, int transponderP) -{ - bool result = false; - if (cSource::IsType(sourceP, 'S')) - result = frontendsM[eSatipFrontendDVBS2].Assign(deviceIdP, transponderP); - else if (cSource::IsType(sourceP, 'T')) { - if (systemP) - result = frontendsM[eSatipFrontendDVBT2].Assign(deviceIdP, transponderP); - else - result = frontendsM[eSatipFrontendDVBT].Assign(deviceIdP, transponderP) || frontendsM[eSatipFrontendDVBT2].Assign(deviceIdP, transponderP); - } - else if (cSource::IsType(sourceP, 'C')) { - if (systemP) - result = frontendsM[eSatipFrontendDVBC2].Assign(deviceIdP, transponderP); - else - result = frontendsM[eSatipFrontendDVBC].Assign(deviceIdP, transponderP) || frontendsM[eSatipFrontendDVBC2].Assign(deviceIdP, transponderP); - } - return result; -} - bool cSatipServer::IsValidSource(int sourceP) { if (sourceFiltersM[0]) { @@ -237,6 +217,28 @@ bool cSatipServer::IsValidSource(int sourceP) return true; } +bool cSatipServer::Assign(int deviceIdP, int sourceP, int systemP, int transponderP) +{ + bool result = false; + if (IsValidSource(sourceP)) { + if (cSource::IsType(sourceP, 'S')) + result = frontendsM[eSatipFrontendDVBS2].Assign(deviceIdP, transponderP); + else if (cSource::IsType(sourceP, 'T')) { + if (systemP) + result = frontendsM[eSatipFrontendDVBT2].Assign(deviceIdP, transponderP); + else + result = frontendsM[eSatipFrontendDVBT].Assign(deviceIdP, transponderP) || frontendsM[eSatipFrontendDVBT2].Assign(deviceIdP, transponderP); + } + else if (cSource::IsType(sourceP, 'C')) { + if (systemP) + result = frontendsM[eSatipFrontendDVBC2].Assign(deviceIdP, transponderP); + else + result = frontendsM[eSatipFrontendDVBC].Assign(deviceIdP, transponderP) || frontendsM[eSatipFrontendDVBC2].Assign(deviceIdP, transponderP); + } + } + return result; +} + bool cSatipServer::Matches(int sourceP) { if (IsValidSource(sourceP)) {