From d6f57259fa570f706fc412f9c0de925097edda09 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Fri, 31 Mar 2017 15:24:35 +0200 Subject: The function cEpgHandlers::BeginSegmentTransfer() is now boolean --- CONTRIBUTORS | 1 + HISTORY | 4 +++- eit.c | 9 +++++++-- epg.c | 9 +++++---- epg.h | 7 +++++-- 5 files changed, 21 insertions(+), 9 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index dac5059f..e489cfca 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -2618,6 +2618,7 @@ J for adding HandledExternally() to the EPG handler interface for adding IsUpdate() to the EPG handler interface for adding Begin/EndSegmentTransfer() to the EPG handler interface + for making cEpgHandlers::BeginSegmentTransfer() boolean Peter Pinnau for reporting that 'uint32_t' requires including stdint.h in font.h on some systems diff --git a/HISTORY b/HISTORY index b142d45c..6af603f5 100644 --- a/HISTORY +++ b/HISTORY @@ -8925,8 +8925,10 @@ Video Disk Recorder Revision History - Now stopping any ongoing recordings before stopping the plugins, to avoid a crash when stopping VDR while recording. -2017-03-30: Version 2.3.4 +2017-03-31: Version 2.3.4 - The functionality of HandleRemoteModifications(), which synchronizes changes to timers between peer VDR machines, has been moved to timers.[ch] and renamed to HandleRemoteTimerModifications(). It now also handles deleting remote timers. +- The function cEpgHandlers::BeginSegmentTransfer() is now boolean (thanks to + Jörg Wendel). See the description in epg.h for the meaning of the return value. diff --git a/eit.c b/eit.c index b5c671d2..cfed4d08 100644 --- a/eit.c +++ b/eit.c @@ -8,7 +8,7 @@ * Robert Schneider and Rolf Hakenes . * Adapted to 'libsi' for VDR 1.3.0 by Marcel Wiesweg . * - * $Id: eit.c 4.1 2015/08/23 10:43:36 kls Exp $ + * $Id: eit.c 4.2 2017/03/31 15:16:46 kls Exp $ */ #include "eit.h" @@ -67,8 +67,13 @@ cEIT::cEIT(cSectionSyncerHash &SectionSyncerHash, int Source, u_char Tid, const return; } + if (!EpgHandlers.BeginSegmentTransfer(Channel)) { + SchedulesStateKey.Remove(false); + ChannelsStateKey.Remove(false); + return; + } + bool ChannelsModified = false; - EpgHandlers.BeginSegmentTransfer(Channel); bool handledExternally = EpgHandlers.HandledExternally(Channel); cSchedule *pSchedule = (cSchedule *)Schedules->GetSchedule(Channel, true); diff --git a/epg.c b/epg.c index 4297350e..7cf7cdbc 100644 --- a/epg.c +++ b/epg.c @@ -7,7 +7,7 @@ * Original version (as used in VDR before 1.3.0) written by * Robert Schneider and Rolf Hakenes . * - * $Id: epg.c 4.2 2015/09/10 10:58:19 kls Exp $ + * $Id: epg.c 4.3 2017/03/31 15:16:46 kls Exp $ */ #include "epg.h" @@ -1527,12 +1527,13 @@ void cEpgHandlers::DropOutdated(cSchedule *Schedule, time_t SegmentStart, time_t Schedule->DropOutdated(SegmentStart, SegmentEnd, TableID, Version); } -void cEpgHandlers::BeginSegmentTransfer(const cChannel *Channel) +bool cEpgHandlers::BeginSegmentTransfer(const cChannel *Channel) { for (cEpgHandler *eh = First(); eh; eh = Next(eh)) { - if (eh->BeginSegmentTransfer(Channel, false)) - return; + if (!eh->BeginSegmentTransfer(Channel, false)) + return false; } + return true; } void cEpgHandlers::EndSegmentTransfer(bool Modified) diff --git a/epg.h b/epg.h index b6f7d68e..024aac24 100644 --- a/epg.h +++ b/epg.h @@ -7,7 +7,7 @@ * Original version (as used in VDR before 1.3.0) written by * Robert Schneider and Rolf Hakenes . * - * $Id: epg.h 4.1 2015/08/09 11:25:04 kls Exp $ + * $Id: epg.h 4.2 2017/03/31 15:24:35 kls Exp $ */ #ifndef __EPG_H @@ -284,6 +284,9 @@ public: virtual bool BeginSegmentTransfer(const cChannel *Channel, bool Dummy) { return false; } // TODO remove obsolete Dummy ///< Called directly after IgnoreChannel() before any other handler method is called. ///< Designed to give handlers the possibility to prepare a database transaction. + ///< If any EPG handler returns false in this function, it is assumed that + ///< the EPG for the given Channel has to be handled later due to some transaction problems, + ///> therefore the processing will aborted. ///< Dummy is for backward compatibility and may be removed in a future version. virtual bool EndSegmentTransfer(bool Modified, bool Dummy) { return false; } // TODO remove obsolete Dummy ///< Called after the segment data has been processed. @@ -311,7 +314,7 @@ public: void HandleEvent(cEvent *Event); void SortSchedule(cSchedule *Schedule); void DropOutdated(cSchedule *Schedule, time_t SegmentStart, time_t SegmentEnd, uchar TableID, uchar Version); - void BeginSegmentTransfer(const cChannel *Channel); + bool BeginSegmentTransfer(const cChannel *Channel); void EndSegmentTransfer(bool Modified); }; -- cgit v1.2.3