summaryrefslogtreecommitdiff
path: root/filter.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2015-09-01 11:14:27 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2015-09-01 11:14:27 +0200
commit3cd5294d8a337ee5cd2ec894c9fbe04ad3a7690d (patch)
treeda57ce74189de9bfb27e1a747063c37cd62de501 /filter.c
parent8a7bc6a0bbf60cae8b6391a630880aad5cba3363 (diff)
downloadvdr-3cd5294d8a337ee5cd2ec894c9fbe04ad3a7690d.tar.gz
vdr-3cd5294d8a337ee5cd2ec894c9fbe04ad3a7690d.tar.bz2
Implemented strict locking of global lists
Diffstat (limited to 'filter.c')
-rw-r--r--filter.c41
1 files changed, 24 insertions, 17 deletions
diff --git a/filter.c b/filter.c
index 331983a8..aa91c1f1 100644
--- a/filter.c
+++ b/filter.c
@@ -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 -----------------------------------------------------------