diff options
author | kamel5 <vdr.kamel5 (at) gmx (dot) net> | 2019-07-06 12:15:38 +0200 |
---|---|---|
committer | kamel5 <vdr.kamel5 (at) gmx (dot) net> | 2019-07-06 14:10:31 +0200 |
commit | a0e63f5941a69d4a40d0399656171788da28a83c (patch) | |
tree | 61ba763929bcd4926bf3193fc7e83071f7575830 /recmanager.c | |
parent | e96911dfac925247c4f70e50fa96c4741ab01e67 (diff) | |
download | vdr-plugin-tvguideng-a0e63f5941a69d4a40d0399656171788da28a83c.tar.gz vdr-plugin-tvguideng-a0e63f5941a69d4a40d0399656171788da28a83c.tar.bz2 |
Fixed a compiler error for VDR < 2.3.0 and Cosmetic changes
Diffstat (limited to 'recmanager.c')
-rw-r--r-- | recmanager.c | 78 |
1 files changed, 42 insertions, 36 deletions
diff --git a/recmanager.c b/recmanager.c index 092f942..387ac31 100644 --- a/recmanager.c +++ b/recmanager.c @@ -175,16 +175,15 @@ void cRecManager::SetTimerPath(cTimer *timer, const cEvent *event, std::string p } void cRecManager::DeleteTimer(int timerID) { + const cTimer *t; #if defined (APIVERSNUM) && (APIVERSNUM >= 20301) - const cTimer *t; - { - LOCK_TIMERS_READ; - t = Timers->Get(timerID); - } + { + LOCK_TIMERS_READ; + t = Timers->Get(timerID); + } #else - t = Timers.Get(timerID); + t = Timers.Get(timerID); #endif - if (!t) return; DeleteTimer(t); @@ -201,8 +200,8 @@ void cRecManager::DeleteTimer(const cEvent *event) { } void cRecManager::DeleteLocalTimer(const cEvent *event) { -#if defined (APIVERSNUM) && (APIVERSNUM >= 20301) const cTimer *t; +#if defined (APIVERSNUM) && (APIVERSNUM >= 20301) { LOCK_TIMERS_READ; t = Timers->GetMatch(event); @@ -221,12 +220,13 @@ void cRecManager::DeleteTimer(const cTimer *timer) { #if defined (APIVERSNUM) && (APIVERSNUM >= 20301) LOCK_TIMERS_WRITE; cTimers* timers = Timers; + cTimer* t = timers->GetTimer(timer); #else cTimers* timers = &Timers; + cTimer* t = timers->GetTimer((cTimer*)timer); #endif - - cTimer* t = timers->GetTimer((cTimer*)timer); // #TODO dirty cast - + if (!t) + return; if (t->Recording()) { t->Skip(); #if defined (APIVERSNUM) && (APIVERSNUM >= 20301) @@ -254,10 +254,17 @@ void cRecManager::DeleteRemoteTimer(const cEvent *event) { } } -void cRecManager::SaveTimer(const cTimer *timer, cTimer newTimerSettings) { - if (!timer) +void cRecManager::SaveTimer(const cTimer *t, cTimer newTimerSettings) { + if (!t) return; - + +#if VDRVERSNUM >= 20301 + LOCK_TIMERS_WRITE; + cTimer *timer = Timers->GetTimer(t); +#else + cTimer *timer = Timers.GetTimer((cTimer*)t); +#endif + bool active = newTimerSettings.HasFlags(tfActive); int prio = newTimerSettings.Priority(); int lifetime = newTimerSettings.Lifetime(); @@ -266,37 +273,36 @@ void cRecManager::SaveTimer(const cTimer *timer, cTimer newTimerSettings) { int stop = newTimerSettings.Stop(); std::string fileName = newTimerSettings.File(); - // #TODO - very dirty cast from const !! - ((cTimer*)timer)->SetDay(day); - ((cTimer*)timer)->SetStart(start); - ((cTimer*)timer)->SetStop(stop); - ((cTimer*)timer)->SetPriority(prio); - ((cTimer*)timer)->SetLifetime(lifetime); - ((cTimer*)timer)->SetFile(fileName.c_str()); + timer->SetDay(day); + timer->SetStart(start); + timer->SetStop(stop); + timer->SetPriority(prio); + timer->SetLifetime(lifetime); + timer->SetFile(fileName.c_str()); if (timer->HasFlags(tfActive) && !active) - ((cTimer*)timer)->ClrFlags(tfActive); + timer->ClrFlags(tfActive); else if (!timer->HasFlags(tfActive) && active) - ((cTimer*)timer)->SetFlags(tfActive); - -// #TODO to be implemented timer->SetEventFromSchedule(); + timer->SetFlags(tfActive); + +#if VDRVERSNUM < 20300 + timer->SetEventFromSchedule(); +#endif if (config.useRemoteTimers && pRemoteTimers) { RemoteTimers_Timer_v1_0 rt; - rt.timer = (cTimer*)timer; // #TODO - dirty cast + rt.timer = timer; if (!pRemoteTimers->Service("RemoteTimers::ModTimer-v1.0", &rt)) rt.timer = NULL; RefreshRemoteTimers(); } else { #if defined (APIVERSNUM) && (APIVERSNUM >= 20301) - LOCK_TIMERS_WRITE; - Timers->SetModified(); + Timers->SetModified(); #else - Timers.SetModified(); + Timers.SetModified(); #endif } } - bool cRecManager::IsRecorded(const cEvent *event) { #if defined (APIVERSNUM) && (APIVERSNUM >= 20301) LOCK_TIMERS_WRITE; @@ -330,7 +336,9 @@ cTVGuideTimerConflicts *cRecManager::CheckTimerConflict(void) { } void cRecManager::CreateSeriesTimer(cTimer *seriesTimer) { -// #TOSO seriesTimer->SetEventFromSchedule(); +#if VDRVERSNUM < 20300 + seriesTimer->SetEventFromSchedule(); +#endif if (config.useRemoteTimers && pRemoteTimers) { RemoteTimers_Timer_v1_0 rt; rt.timer = seriesTimer; @@ -411,17 +419,15 @@ const cEvent **cRecManager::PerformSearchTimerSearch(std::string epgSearchString int eventID = atoi(flds[1].c_str()); std::string channelID = flds[7]; tChannelID chanID = tChannelID::FromString(channelID.c_str()); - const cChannels* channels; + const cChannel *channel; #if defined (APIVERSNUM) && (APIVERSNUM >= 20301) { LOCK_CHANNELS_READ; - channels = Channels; + channel = Channels->GetByChannelID(chanID); } #else - channels = &Channels; + channel = Channels.GetByChannelID(chanID); #endif - - const cChannel *channel = channels->GetByChannelID(chanID); if (channel) { const cSchedule *Schedule = NULL; Schedule = schedules->GetSchedule(channel); |