diff options
author | Jochen Dolze <vdr@dolze.de> | 2011-08-05 14:02:47 +0200 |
---|---|---|
committer | Jochen Dolze <vdr@dolze.de> | 2011-08-05 14:02:47 +0200 |
commit | 8f13f082303ae844d8408b78c8c8fa4c5c9b1d26 (patch) | |
tree | 2c169bdcef39d35dc4f60b7dab1004c727ffb973 /maps.cpp | |
parent | fd38b68561f3c2b0bf2cf369cc3cc48dbca60fc8 (diff) | |
download | vdr-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.cpp | 42 |
1 files changed, 39 insertions, 3 deletions
@@ -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--; + } } } |