From eb44800641ed5e60e23d173e027688f67c1981cc Mon Sep 17 00:00:00 2001 From: Dimitar Petrovski Date: Sat, 2 Jun 2012 11:52:32 +0200 Subject: fix compile fix sortEquivalents modify loging --- equivhandler.c | 48 ++++++++++++++++++++++++------------------------ setupeepg.h | 6 +++++- util.c | 1 + util.h | 1 + 4 files changed, 31 insertions(+), 25 deletions(-) diff --git a/equivhandler.c b/equivhandler.c index c2846f7..b10c004 100644 --- a/equivhandler.c +++ b/equivhandler.c @@ -114,9 +114,9 @@ void cEquivHandler::loadEquivalentChannelMap (void) } //while fclose (File); equiChanFileTime = st.st_mtim.tv_nsec; - LogD(3, prep("Loaded %i equivalents."), equiChanMap.size()); + LogD(2, prep("Loaded %i equivalents."), equiChanMap.size()); for ( it2=equiChanMap.begin() ; it2 != equiChanMap.end(); it2++ ) - LogD(3, prep("Original ID %s <-> Equivalent ID %s"), (*it2).first.c_str(), it2->second.c_str()); + LogD(2, prep("Original ID %s <-> Equivalent ID %s"), (*it2).first.c_str(), it2->second.c_str()); } //if file } @@ -124,24 +124,24 @@ void cEquivHandler::updateEquivalent(cSchedules * Schedules, tChannelID channelI multimap::iterator it; pair::iterator,multimap::iterator> ret; - LogD(3, prep("Start updateEquivalent %s"), *channelID.ToString()); + LogD(2, prep("Start updateEquivalent %s"), *channelID.ToString()); ret = equiChanMap.equal_range(*channelID.ToString()); for (it=ret.first; it!=ret.second; ++it) { - LogD(1, prep("equivalent channel exists")); + LogD(2, prep("equivalent channel exists")); tChannelID equChannelID (tChannelID::FromString((*it).second.c_str())); cChannel *equChannel = GetChannelByID (equChannelID, false); if (equChannel) { - LogD(3, prep("found Equivalent channel %s"), *equChannelID.ToString()); + LogD(2, prep("found Equivalent channel %s"), *equChannelID.ToString()); cSchedule *pSchedule = (cSchedule *) Schedules->GetSchedule (equChannel, true); cEvent *pEqvEvent = (cEvent *) pSchedule->GetEvent (pEvent->EventID(), pEvent->StartTime()); if (pEqvEvent) { - LogD(1, prep("equivalent event exists")); + LogD(3, prep("equivalent event exists")); if (pEqvEvent == pEvent) { - LogD(1, prep("equal event exists")); + LogD(3, prep("equal event exists")); } else { - LogD(1, prep("remove equivalent")); + LogD(2, prep("remove equivalent")); pSchedule->DelEvent(pEqvEvent); cEvent* newEvent = new cEvent (pEvent->EventID()); newEvent->SetTableID (pEvent->TableID()); @@ -162,7 +162,7 @@ void cEquivHandler::updateEquivalent(cSchedules * Schedules, tChannelID channelI } } else { - LogD(1, prep("equivalent event does not exist")); + LogD(3, prep("equivalent event does not exist")); cEvent* newEvent = new cEvent (pEvent->EventID()); newEvent->SetTableID (pEvent->TableID()); newEvent->SetStartTime (pEvent->StartTime()); @@ -188,11 +188,11 @@ void cEquivHandler::updateEquivalent(tChannelID channelID, cEvent *pEvent){ multimap::iterator it; pair::iterator,multimap::iterator> ret; - LogD(3, prep("Start updateEquivalent %s"), *channelID.ToString()); + LogD(2, prep("Start updateEquivalent %s"), *channelID.ToString()); ret = equiChanMap.equal_range(*channelID.ToString()); for (it=ret.first; it!=ret.second; ++it) { - LogD(1, prep("equivalent channel exists")); + LogD(2, prep("equivalent channel exists")); tChannelID equChannelID (tChannelID::FromString((*it).second.c_str())); cEvent* newEvent = new cEvent (pEvent->EventID()); newEvent->SetTableID (pEvent->TableID()); @@ -245,21 +245,21 @@ void cEquivHandler::sortEquivalents(tChannelID channelID, cSchedules* Schedules) multimap::iterator it; pair < multimap < string, string > ::iterator, multimap < string, string > ::iterator > ret; - ret = cEquivHandler::getEquiChanMap().equal_range(*channelID.ToString()); + LogD(2, prep("sortEquivalents for channel %s count: %d"), *channelID.ToString(), cEquivHandler::getEquiChanMap().count(*channelID.ToString())); + + ret = equiChanMap.equal_range(*channelID.ToString()); for (it = ret.first; it != ret.second; ++it) + { + LogD(3, prep("equivalent channel exists")); + tChannelID equChannelID(tChannelID::FromString((*it).second.c_str())); + cChannel* pChannel = GetChannelByID(equChannelID, false); + if (pChannel) { - LogD(3, prep("equivalent channel exists")); - tChannelID equChannelID(tChannelID::FromString((*it).second.c_str())); - cChannel* pChannel = GetChannelByID(equChannelID, false); - if (pChannel) - { - LogD(3, prep("found Equivalent channel %s"), - *equChannelID.ToString()); - cSchedule* pSchedule = (cSchedule *) Schedules->GetSchedule(pChannel, - true); + LogD(2, prep("found Equivalent channel %s"), *equChannelID.ToString()); + cSchedule* pSchedule = (cSchedule *) Schedules->GetSchedule(pChannel, true); - pSchedule->Sort(); - Schedules->SetModified(pSchedule); - } + pSchedule->Sort(); + Schedules->SetModified(pSchedule); } + } } diff --git a/setupeepg.h b/setupeepg.h index ffd9eb8..4c30ede 100644 --- a/setupeepg.h +++ b/setupeepg.h @@ -7,6 +7,7 @@ #ifndef SETUPEEPG_H_ #define SETUPEEPG_H_ +#include class cSetupEEPG { @@ -31,7 +32,10 @@ public: void setConfDir(char* confDir) { - ConfDir = confDir; + if (ConfDir) + delete ConfDir; + ConfDir = new char[strlen(confDir)+1]; + strcpy(ConfDir, confDir); } private: diff --git a/util.c b/util.c index bbfffb2..3d92dda 100644 --- a/util.c +++ b/util.c @@ -7,6 +7,7 @@ #include "util.h" #include #include +#include namespace util { diff --git a/util.h b/util.h index be2c3d0..230f44c 100644 --- a/util.h +++ b/util.h @@ -10,6 +10,7 @@ #include class cChannel; struct tChannelID; +class cEvent; namespace util { -- cgit v1.2.3