diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2015-09-01 11:14:27 +0200 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2015-09-01 11:14:27 +0200 |
commit | 3cd5294d8a337ee5cd2ec894c9fbe04ad3a7690d (patch) | |
tree | da57ce74189de9bfb27e1a747063c37cd62de501 /filter.c | |
parent | 8a7bc6a0bbf60cae8b6391a630880aad5cba3363 (diff) | |
download | vdr-3cd5294d8a337ee5cd2ec894c9fbe04ad3a7690d.tar.gz vdr-3cd5294d8a337ee5cd2ec894c9fbe04ad3a7690d.tar.bz2 |
Implemented strict locking of global lists
Diffstat (limited to 'filter.c')
-rw-r--r-- | filter.c | 41 |
1 files changed, 24 insertions, 17 deletions
@@ -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 ----------------------------------------------------------- |