From 91488f0f607391d3735a2a7ae8b138881e5659a2 Mon Sep 17 00:00:00 2001 From: kamel5 Date: Sun, 1 Apr 2018 14:06:43 +0200 Subject: [PATCH] Changes in cRecManager::SaveTimer --- recmanager.c | 30 ++++++++---------------------- 1 file changed, 8 insertions(+), 22 deletions(-) diff --git a/recmanager.c b/recmanager.c index 32ac3e8..8bf94c3 100644 --- a/recmanager.c +++ b/recmanager.c @@ -264,13 +264,18 @@ void cRecManager::DeleteRemoteTimer(const cEvent *event) { } #if VDRVERSNUM >= 20301 -void cRecManager::SaveTimer(const cTimer *timer, cTimer newTimerSettings) { +void cRecManager::SaveTimer(const cTimer *t, cTimer newTimerSettings) { + if (!t) #else void cRecManager::SaveTimer(cTimer *timer, cTimer newTimerSettings) { -#endif if (!timer) +#endif return; +#if VDRVERSNUM >= 20301 + LOCK_TIMERS_WRITE; + cTimer *timer = Timers->GetTimer(t); +#endif bool active = newTimerSettings.HasFlags(tfActive); int prio = newTimerSettings.Priority(); int lifetime = newTimerSettings.Lifetime(); @@ -279,48 +284,29 @@ void cRecManager::SaveTimer(cTimer *timer, cTimer newTimerSettings) { int stop = newTimerSettings.Stop(); std::string fileName = newTimerSettings.File(); -#if VDRVERSNUM >= 20301 - ((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()); -#else timer->SetDay(day); timer->SetStart(start); timer->SetStop(stop); timer->SetPriority(prio); timer->SetLifetime(lifetime); timer->SetFile(fileName.c_str()); -#endif if (timer->HasFlags(tfActive) && !active) -#if VDRVERSNUM >= 20301 - ((cTimer*)timer)->ClrFlags(tfActive); - else if (!timer->HasFlags(tfActive) && active) - ((cTimer*)timer)->SetFlags(tfActive); - -#else timer->ClrFlags(tfActive); else if (!timer->HasFlags(tfActive) && active) timer->SetFlags(tfActive); +#if VDRVERSNUM < 20300 timer->SetEventFromSchedule(); #endif if (tvguideConfig.useRemoteTimers && pRemoteTimers) { RemoteTimers_Timer_v1_0 rt; -#if VDRVERSNUM >= 20301 - rt.timer = (cTimer*)timer; -#else rt.timer = timer; -#endif if (!pRemoteTimers->Service("RemoteTimers::ModTimer-v1.0", &rt)) rt.timer = NULL; RefreshRemoteTimers(); } else { #if VDRVERSNUM >= 20301 - LOCK_TIMERS_WRITE; Timers->SetModified(); #else Timers.SetModified();