Implemented strict locking of global lists

This commit is contained in:
Klaus Schmidinger
2015-09-01 11:14:27 +02:00
parent 8a7bc6a0bb
commit 3cd5294d8a
41 changed files with 3512 additions and 2402 deletions

View File

@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: filter.c 4.1 2015/03/17 15:04:39 kls Exp $
* $Id: filter.c 4.2 2015/07/25 10:59:57 kls Exp $
*/
#include "filter.h"
@@ -19,31 +19,38 @@ cSectionSyncer::cSectionSyncer(void)
void cSectionSyncer::Reset(void)
{
lastVersion = thisVersion = 0xFF;
nextNumber = 0;
currentVersion = -1;
currentSection = -1;
synced = false;
complete = false;
memset(sections, 0x00, sizeof(sections));
}
void cSectionSyncer::Repeat(void)
{
lastVersion = 0xFF;
nextNumber--;
SetSectionFlag(currentSection, false);
synced = false;
complete = false;
}
bool cSectionSyncer::Sync(uchar Version, int Number, int LastNumber)
{
if (Version != lastVersion) {
if (Version != thisVersion) {
thisVersion = Version;
nextNumber = 0;
}
if (Number == nextNumber) {
if (Number == LastNumber)
lastVersion = Version;
nextNumber++;
return true;
}
if (Version != currentVersion) {
Reset();
currentVersion = Version;
}
return false;
if (!synced) {
if (Number != 0)
return false;
else
synced = true;
}
currentSection = Number;
bool Result = !GetSectionFlag(Number);
SetSectionFlag(Number, true);
if (Number == LastNumber)
complete = true;
return Result;
}
// --- cFilterData -----------------------------------------------------------