From c03e69a64f3243ce275701933460ea11e41b4cf0 Mon Sep 17 00:00:00 2001 From: Rolf Ahrenberg Date: Mon, 24 Sep 2007 21:25:53 +0000 Subject: [PATCH] Fixed DeleteFilter() and commented some debug outputs. --- device.c | 14 ++++++++------ sectionfilter.c | 6 +++--- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/device.c b/device.c index 610348b..cc8baf8 100644 --- a/device.c +++ b/device.c @@ -3,7 +3,7 @@ * * See the README file for copyright information and how to reach the author. * - * $Id: device.c,v 1.39 2007/09/24 17:20:58 rahrenbe Exp $ + * $Id: device.c,v 1.40 2007/09/24 21:25:53 rahrenbe Exp $ */ #include "common.h" @@ -155,9 +155,10 @@ bool cIptvDevice::SetPid(cPidHandle *Handle, int Type, bool On) bool cIptvDevice::DeleteFilter(unsigned int Index) { if ((Index < eMaxSecFilterCount) && secfilters[Index]) { - debug("cIptvDevice::DeleteFilter(%d) Index=%d\n", deviceIndex, Index); - delete secfilters[Index]; + //debug("cIptvDevice::DeleteFilter(%d) Index=%d\n", deviceIndex, Index); + cIptvSectionFilter *tmp = secfilters[Index]; secfilters[Index] = NULL; + delete tmp; return true; } return false; @@ -168,7 +169,7 @@ int cIptvDevice::OpenFilter(u_short Pid, u_char Tid, u_char Mask) // Search the next free filter slot for (unsigned int i = 0; i < eMaxSecFilterCount; ++i) { if (!secfilters[i]) { - debug("cIptvDevice::OpenFilter(%d): Pid=%d Tid=%02X Mask=%02X Index=%d\n", deviceIndex, Pid, Tid, Mask, i); + //debug("cIptvDevice::OpenFilter(%d): Pid=%d Tid=%02X Mask=%02X Index=%d\n", deviceIndex, Pid, Tid, Mask, i); secfilters[i] = new cIptvSectionFilter(i, deviceIndex, Pid, Tid, Mask); return secfilters[i]->GetReadDesc(); } @@ -179,10 +180,11 @@ int cIptvDevice::OpenFilter(u_short Pid, u_char Tid, u_char Mask) bool cIptvDevice::CloseFilter(int Handle) { - debug("cIptvDevice::CloseFilter(%d): %d\n", deviceIndex, Handle); for (unsigned int i = 0; i < eMaxSecFilterCount; ++i) { - if (secfilters[i] && Handle == secfilters[i]->GetReadDesc()) + if (secfilters[i] && (Handle == secfilters[i]->GetReadDesc())) { + //debug("cIptvDevice::CloseFilter(%d): %d\n", deviceIndex, Handle); return DeleteFilter(i); + } } return false; } diff --git a/sectionfilter.c b/sectionfilter.c index c29b1a6..2d0ac2c 100644 --- a/sectionfilter.c +++ b/sectionfilter.c @@ -3,7 +3,7 @@ * * See the README file for copyright information and how to reach the author. * - * $Id: sectionfilter.c,v 1.3 2007/09/24 17:20:58 rahrenbe Exp $ + * $Id: sectionfilter.c,v 1.4 2007/09/24 21:25:54 rahrenbe Exp $ */ #include "sectionfilter.h" @@ -23,7 +23,7 @@ cIptvSectionFilter::cIptvSectionFilter(int Index, int devInd, pid(Pid), id(Index) { - debug("cIptvSectionFilter::cIptvSectionFilter(%d)\n", Index); + //debug("cIptvSectionFilter::cIptvSectionFilter(%d)\n", Index); memset(secbuf_base, '\0', sizeof(secbuf_base)); memset(filter_value, '\0', sizeof(filter_value)); memset(filter_mask, '\0', sizeof(filter_mask)); @@ -64,7 +64,7 @@ cIptvSectionFilter::cIptvSectionFilter(int Index, int devInd, cIptvSectionFilter::~cIptvSectionFilter() { - debug("cIptvSectionFilter::~cIptvSectionfilter(%d)\n", id); + //debug("cIptvSectionFilter::~cIptvSectionfilter(%d)\n", id); close(fifoDescriptor); close(readDescriptor); unlink(pipeName);