From 13e925c3f49bc29514064ce52e3fa0ba0ca6c8ab Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Fri, 11 Nov 2005 13:31:02 +0100 Subject: [PATCH] Fixed initializing the day index when editing the weekday parameter of a repeating timer --- CONTRIBUTORS | 2 ++ HISTORY | 2 ++ menuitems.c | 12 ++++++++++-- menuitems.h | 3 ++- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 19482e0f..42a76a92 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -1245,6 +1245,8 @@ Marco Schl for reporting that the FATALERRNO macro needs to check for a non-zero errno value for reporting missing mutex locks in cCiMenu::Abort() and cCiEnquiry::Abort() for fixing a race condition in the SPU decoder + for fixing initializing the day index when editing the weekday parameter of a + repeating timer Jürgen Schmitz for reporting a bug in displaying the current channel when switching via the SVDRP diff --git a/HISTORY b/HISTORY index e2b9824e..6d417c75 100644 --- a/HISTORY +++ b/HISTORY @@ -3943,3 +3943,5 @@ Video Disk Recorder Revision History 2005-11-11: Version 1.3.37 - Added compiler options "-fPIC -g" to all plugins (thanks to Rolf Ahrenberg). +- Fixed initializing the day index when editing the weekday parameter of a + repeating timer (thanks to Marco Schlüßler). diff --git a/menuitems.c b/menuitems.c index 1f2cc14a..01fd6b3b 100644 --- a/menuitems.c +++ b/menuitems.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: menuitems.c 1.23 2005/09/17 09:36:31 kls Exp $ + * $Id: menuitems.c 1.24 2005/11/11 13:26:00 kls Exp $ */ #include "menuitems.h" @@ -578,10 +578,18 @@ cMenuEditDateItem::cMenuEditDateItem(const char *Name, time_t *Value, int *WeekD value = Value; weekdays = WeekDays; oldvalue = 0; - dayindex = 0; + dayindex = weekdays ? FindDayIndex(*weekdays) : 0; Set(); } +int cMenuEditDateItem::FindDayIndex(int WeekDays) +{ + for (unsigned int i = 0; i < sizeof(days) / sizeof(int); i++) + if (WeekDays == days[i]) + return i; + return 0; +} + void cMenuEditDateItem::Set(void) { #define DATEBUFFERSIZE 32 diff --git a/menuitems.h b/menuitems.h index b45fc960..f9afc151 100644 --- a/menuitems.h +++ b/menuitems.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: menuitems.h 1.11 2005/03/19 15:02:57 kls Exp $ + * $Id: menuitems.h 1.12 2005/11/11 13:26:51 kls Exp $ */ #ifndef __MENUITEMS_H @@ -125,6 +125,7 @@ private: int *weekdays; time_t oldvalue; int dayindex; + int FindDayIndex(int WeekDays); virtual void Set(void); public: cMenuEditDateItem(const char *Name, time_t *Value, int *WeekDays = NULL);