From 782f2683d9476d227c67cff7db0bb392a0bf5f09 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Fri, 8 Sep 2006 15:06:09 +0200 Subject: [PATCH] Fixed cTimer::operator=() in case a cTimer variable is assigned to itself; implemented a copy constructor for cTimer --- CONTRIBUTORS | 2 ++ HISTORY | 7 +++++++ config.h | 8 ++++---- timers.c | 48 +++++++++++++++++++++++++++++------------------- timers.h | 3 ++- 5 files changed, 44 insertions(+), 24 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 2315e54d..78413683 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -1465,6 +1465,7 @@ Udo Richter for fixing getting the next active timer when shutting down for reporting a problem with cPlugin::ConfigDirectory() in case a plugin calls it from a separate thread + for reporting that an assignment in svdrp.c didn't use the cTimer::operator=()) Sven Kreiensen for his help in keeping 'channels.conf.terr' up to date @@ -1741,6 +1742,7 @@ Alexander Rieger message clears all messages that have been previously queued by that thread for reporting that the cTimer::operator=() messes up the cListObject's pointers for reporting a memory leak in the cTimer::operator=() when using the 'aux' string + for fixing cTimer::operator=() in case a cTimer variable is assigned to itself Philip Prindeville for updates to 'sources.conf' diff --git a/HISTORY b/HISTORY index 9fcbe450..ec461fa2 100644 --- a/HISTORY +++ b/HISTORY @@ -4907,3 +4907,10 @@ Video Disk Recorder Revision History Martin Ostermann). - Fixed handling relative volume settings that unmute the audio in the call to cStatus::MsgSetVolume() (reported by Oliver Endriss). + +2006-09-04: Version 1.4.2-2 + +- Fixed cTimer::operator=() in case a cTimer variable is assigned to itself (thanks + to Alexander Rieger). +- Implemented a copy constructor for cTimer (thanks to Udo Richter for reporting that + an assignment in svdrp.c didn't use the cTimer::operator=()). diff --git a/config.h b/config.h index d1d4e2e1..8e3ec8d0 100644 --- a/config.h +++ b/config.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: config.h 1.268 2006/09/01 12:59:35 kls Exp $ + * $Id: config.h 1.269 2006/09/04 17:44:12 kls Exp $ */ #ifndef __CONFIG_H @@ -21,13 +21,13 @@ // VDR's own version number: -#define VDRVERSION "1.4.2-1" +#define VDRVERSION "1.4.2-2" #define VDRVERSNUM 10402 // Version * 10000 + Major * 100 + Minor // The plugin API's version number: -#define APIVERSION "1.4.2" -#define APIVERSNUM 10402 // Version * 10000 + Major * 100 + Minor +#define APIVERSION "1.4.3" +#define APIVERSNUM 10403 // Version * 10000 + Major * 100 + Minor // When loading plugins, VDR searches them by their APIVERSION, which // may be smaller than VDRVERSION in case there have been no changes to diff --git a/timers.c b/timers.c index d8d00168..18dab0ff 100644 --- a/timers.c +++ b/timers.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: timers.c 1.63 2006/09/02 10:20:36 kls Exp $ + * $Id: timers.c 1.64 2006/09/08 15:06:09 kls Exp $ */ #include "timers.h" @@ -83,6 +83,14 @@ cTimer::cTimer(const cEvent *Event) event = NULL; // let SetEvent() be called to get a log message } +cTimer::cTimer(const cTimer &Timer) +{ + channel = NULL; + aux = NULL; + event = NULL; + *this = Timer; +} + cTimer::~cTimer() { free(aux); @@ -90,24 +98,26 @@ cTimer::~cTimer() cTimer& cTimer::operator= (const cTimer &Timer) { - startTime = Timer.startTime; - stopTime = Timer.stopTime; - lastSetEvent = 0; - recording = Timer.recording; - pending = Timer.pending; - inVpsMargin = Timer.inVpsMargin; - flags = Timer.flags; - channel = Timer.channel; - day = Timer.day; - weekdays = Timer.weekdays; - start = Timer.start; - stop = Timer.stop; - priority = Timer.priority; - lifetime = Timer.lifetime; - strncpy(file, Timer.file, sizeof(file)); - free(aux); - aux = Timer.aux ? strdup(Timer.aux) : NULL; - event = NULL; + if (&Timer != this) { + startTime = Timer.startTime; + stopTime = Timer.stopTime; + lastSetEvent = 0; + recording = Timer.recording; + pending = Timer.pending; + inVpsMargin = Timer.inVpsMargin; + flags = Timer.flags; + channel = Timer.channel; + day = Timer.day; + weekdays = Timer.weekdays; + start = Timer.start; + stop = Timer.stop; + priority = Timer.priority; + lifetime = Timer.lifetime; + strncpy(file, Timer.file, sizeof(file)); + free(aux); + aux = Timer.aux ? strdup(Timer.aux) : NULL; + event = NULL; + } return *this; } diff --git a/timers.h b/timers.h index 8abc5238..e3d5450a 100644 --- a/timers.h +++ b/timers.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: timers.h 1.28 2006/04/08 12:41:44 kls Exp $ + * $Id: timers.h 1.29 2006/09/04 17:07:39 kls Exp $ */ #ifndef __TIMERS_H @@ -44,6 +44,7 @@ private: public: cTimer(bool Instant = false, bool Pause = false, cChannel *Channel = NULL); cTimer(const cEvent *Event); + cTimer(const cTimer &Timer); virtual ~cTimer(); cTimer& operator= (const cTimer &Timer); virtual int Compare(const cListObject &ListObject) const;