From 8e9d44524830c290f2fc83f08e188ba37a7740d4 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Tue, 9 May 2017 08:39:19 +0200 Subject: [PATCH] cListObject now implements a private copy constructor and assignment operator, to keep derived objects from calling them implicitly --- HISTORY | 2 ++ filter.c | 11 ++++++++++- filter.h | 3 ++- tools.h | 4 +++- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/HISTORY b/HISTORY index 9523a98e..05247763 100644 --- a/HISTORY +++ b/HISTORY @@ -9007,3 +9007,5 @@ Video Disk Recorder Revision History - Fixed a memory leak in cSectionSyncerHash. The cSectionSyncerEntry objects put into the hash were never explicitly deleted. Now the cSectionSyncerHash takes ownership of these objects. +- cListObject now implements a private copy constructor and assignment operator, to keep + derived objects from calling them implicitly. diff --git a/filter.c b/filter.c index aa91c1f1..742041a7 100644 --- a/filter.c +++ b/filter.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: filter.c 4.2 2015/07/25 10:59:57 kls Exp $ + * $Id: filter.c 4.3 2017/05/09 08:37:23 kls Exp $ */ #include "filter.h" @@ -71,6 +71,15 @@ cFilterData::cFilterData(u_short Pid, u_char Tid, u_char Mask, bool Sticky) sticky = Sticky; } +cFilterData& cFilterData::operator= (const cFilterData &FilterData) +{ + pid = FilterData.pid; + tid = FilterData.tid; + mask = FilterData.mask; + sticky = FilterData.sticky; + return *this; +} + bool cFilterData::Is(u_short Pid, u_char Tid, u_char Mask) { return pid == Pid && tid == Tid && mask == Mask; diff --git a/filter.h b/filter.h index 7cc3ec32..b8198345 100644 --- a/filter.h +++ b/filter.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: filter.h 4.2 2015/07/25 10:03:44 kls Exp $ + * $Id: filter.h 4.3 2017/05/09 08:37:23 kls Exp $ */ #ifndef __FILTER_H @@ -38,6 +38,7 @@ public: bool sticky; cFilterData(void); cFilterData(u_short Pid, u_char Tid, u_char Mask, bool Sticky); + cFilterData& operator= (const cFilterData &FilterData); bool Is(u_short Pid, u_char Tid, u_char Mask); bool Matches(u_short Pid, u_char Tid); }; diff --git a/tools.h b/tools.h index 7941da5d..3bd7f9d2 100644 --- a/tools.h +++ b/tools.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: tools.h 4.7 2017/05/09 08:33:37 kls Exp $ + * $Id: tools.h 4.8 2017/05/09 08:37:23 kls Exp $ */ #ifndef __TOOLS_H @@ -479,6 +479,8 @@ class cListObject { friend class cListGarbageCollector; private: cListObject *prev, *next; + cListObject(const cListObject &ListObject) { abort(); } // no copy constructor! + cListObject& operator= (const cListObject &ListObject) { abort(); return *this; } // no assignment operator! public: cListObject(void); virtual ~cListObject();