Skip to content

Commit

Permalink
Check source validity also in server assign (Thanks to Patrick Boettc…
Browse files Browse the repository at this point in the history
…her).
  • Loading branch information
rofafor committed Jul 31, 2016
1 parent c2fe2b7 commit 7a84ba7
Showing 1 changed file with 22 additions and 20 deletions.
42 changes: 22 additions & 20 deletions server.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]) {
Expand All @@ -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)) {
Expand Down

0 comments on commit 7a84ba7

Please sign in to comment.