summaryrefslogtreecommitdiff
path: root/maps.cpp
diff options
context:
space:
mode:
authorJochen Dolze <vdr@dolze.de>2011-08-05 14:02:47 +0200
committerJochen Dolze <vdr@dolze.de>2011-08-05 14:02:47 +0200
commit8f13f082303ae844d8408b78c8c8fa4c5c9b1d26 (patch)
tree2c169bdcef39d35dc4f60b7dab1004c727ffb973 /maps.cpp
parentfd38b68561f3c2b0bf2cf369cc3cc48dbca60fc8 (diff)
downloadvdr-plugin-xmltv2vdr-8f13f082303ae844d8408b78c8c8fa4c5c9b1d26.tar.gz
vdr-plugin-xmltv2vdr-8f13f082303ae844d8408b78c8c8fa4c5c9b1d26.tar.bz2
Prevent mapping deletion of an disabled channel
Added proper thread cleanup
Diffstat (limited to 'maps.cpp')
-rw-r--r--maps.cpp42
1 files changed, 39 insertions, 3 deletions
diff --git a/maps.cpp b/maps.cpp
index 884a23f..be92a4c 100644
--- a/maps.cpp
+++ b/maps.cpp
@@ -187,7 +187,41 @@ void cEPGMapping::ReplaceChannels(int NumChannelIDs, tChannelID *ChannelIDs)
}
}
-void cEPGMapping::RemoveChannel(int ChannelNumber)
+void cEPGMapping::RemoveInvalidChannels()
+{
+ qsort(channelids,numchannelids,sizeof(tChannelID),compare);
+ for (int i=0; i<numchannelids; i++)
+ {
+ if (channelids[i]==tChannelID::InvalidID)
+ {
+ numchannelids--;
+ }
+ }
+}
+
+void cEPGMapping::RemoveChannel(tChannelID ChannelID, bool MarkOnly)
+{
+ bool found=false;
+ int i;
+ for (i=0; i<numchannelids; i++)
+ {
+ if (channelids[i]==ChannelID)
+ {
+ found=true;
+ break;
+ }
+ }
+ if (found)
+ {
+ channelids[i]=tChannelID::InvalidID;
+ if (!MarkOnly) {
+ qsort(channelids,numchannelids,sizeof(tChannelID),compare);
+ numchannelids--;
+ }
+ }
+}
+
+void cEPGMapping::RemoveChannel(int ChannelNumber, bool MarkOnly)
{
if (!ChannelNumber) return;
cChannel *chan=Channels.GetByNumber(ChannelNumber);
@@ -206,7 +240,9 @@ void cEPGMapping::RemoveChannel(int ChannelNumber)
if (found)
{
channelids[i]=tChannelID::InvalidID;
- qsort(channelids,numchannelids,sizeof(tChannelID),compare);
- numchannelids--;
+ if (!MarkOnly) {
+ qsort(channelids,numchannelids,sizeof(tChannelID),compare);
+ numchannelids--;
+ }
}
}