summaryrefslogtreecommitdiff
path: root/timers.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <kls (at) cadsoft (dot) de>2006-09-09 18:00:00 +0200
committerKlaus Schmidinger <kls (at) cadsoft (dot) de>2006-09-09 18:00:00 +0200
commit0b99b3aac10e38d624488978641d66fae3f41a28 (patch)
treef178a06e8f4436fc2bc203777b7eb65ba508cedb /timers.c
parentc49ca5abb73cbc11447da5d961e106025dc927d0 (diff)
downloadvdr-patch-lnbsharing-0b99b3aac10e38d624488978641d66fae3f41a28.tar.gz
vdr-patch-lnbsharing-0b99b3aac10e38d624488978641d66fae3f41a28.tar.bz2
Version 1.4.2-2vdr-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=()).
Diffstat (limited to 'timers.c')
-rw-r--r--timers.c48
1 files changed, 29 insertions, 19 deletions
diff --git a/timers.c b/timers.c
index d8d0016..18dab0f 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;
}