diff options
| author | randomdan <randomdan@localhost> | 2011-03-23 11:30:19 +0000 | 
|---|---|---|
| committer | randomdan <randomdan@localhost> | 2011-03-23 11:30:19 +0000 | 
| commit | 983e2e7e1da7dd1e44b28ec2db04a4ef08607e3b (patch) | |
| tree | 14087f553526deb33ca142c20464a68d08e047aa | |
| parent | Tweaks to make things more generic (diff) | |
| download | p2pvr-983e2e7e1da7dd1e44b28ec2db04a4ef08607e3b.tar.bz2 p2pvr-983e2e7e1da7dd1e44b28ec2db04a4ef08607e3b.tar.xz p2pvr-983e2e7e1da7dd1e44b28ec2db04a4ef08607e3b.zip | |
Don't use global seen lists and clear them after use
| -rw-r--r-- | p2pvr/scanner/eitRows.cpp | 26 | ||||
| -rw-r--r-- | p2pvr/scanner/eitRows.h | 10 | ||||
| -rw-r--r-- | p2pvr/scanner/serviceRows.cpp | 16 | ||||
| -rw-r--r-- | p2pvr/scanner/serviceRows.h | 3 | 
4 files changed, 36 insertions, 19 deletions
| diff --git a/p2pvr/scanner/eitRows.cpp b/p2pvr/scanner/eitRows.cpp index bdc46f0..f5bcf51 100644 --- a/p2pvr/scanner/eitRows.cpp +++ b/p2pvr/scanner/eitRows.cpp @@ -393,26 +393,17 @@ static bool validateDescription(const u_char *data, size_t len) {  	return false;  } /*}}}*/ -class SeenProgram { -	public: -		SeenProgram(int sid, int eid); -		bool operator<(const SeenProgram &) const; -		const int sid; -		const int eid; -}; -SeenProgram::SeenProgram(int s, int e) : +EitRows::SeenProgram::SeenProgram(int s, int e) :  	sid(s),  	eid(e)  {  }  bool -SeenProgram::operator<(const SeenProgram & o) const +EitRows::SeenProgram::operator<(const SeenProgram & o) const  {  	return ((this->sid < o.sid) || ((this->sid == o.sid) && (this->eid < o.eid)));  } -typedef std::set<SeenProgram> SeenPrograms; -SeenPrograms seenPrograms;  bool  EitRows::parseInfoTable(const u_char *data, size_t len, const RowProcessor * rp) const {  	const struct eit *e = reinterpret_cast<const struct eit *>(data); @@ -486,8 +477,15 @@ EitRows::filterInput(int fd) const  void  EitRows::execute(const RowProcessor * rp) const  { -	openInput(); -	readTables(rp); -	closeInput(); +	try { +		openInput(); +		readTables(rp); +		closeInput(); +		seenPrograms.clear(); +	} +	catch (...) { +		seenPrograms.clear(); +		throw; +	}  } diff --git a/p2pvr/scanner/eitRows.h b/p2pvr/scanner/eitRows.h index 255f52b..bc44568 100644 --- a/p2pvr/scanner/eitRows.h +++ b/p2pvr/scanner/eitRows.h @@ -25,6 +25,16 @@ class EitRows : public RowSet, DvbSiReaderHelper {  		RowAttribute resolveAttr(const Glib::ustring & attrName) const;  	private: +		class SeenProgram { +			public: +				SeenProgram(int sid, int eid); +				bool operator<(const SeenProgram &) const; +				const int sid; +				const int eid; +		}; +		typedef std::set<SeenProgram> SeenPrograms; +		mutable SeenPrograms seenPrograms; +  		void filterInput(int fd) const;  		bool parseInfoTable(const u_char *data, size_t len, const RowProcessor *) const;  		void parseEventDescription(const u_char *data) const; diff --git a/p2pvr/scanner/serviceRows.cpp b/p2pvr/scanner/serviceRows.cpp index 474d1e5..3489f72 100644 --- a/p2pvr/scanner/serviceRows.cpp +++ b/p2pvr/scanner/serviceRows.cpp @@ -24,6 +24,7 @@ class Service {  		VariableType defaultAuthority;  		VariableType transportID;  }; +  void  ServiceRows::loadComplete(const CommonObjects *)  { @@ -115,13 +116,18 @@ ServiceRows::filterInput(int fd) const  void  ServiceRows::execute(const RowProcessor * rp) const  { -	openInput(); -	readTables(rp); -	closeInput(); +	try { +		openInput(); +		readTables(rp); +		closeInput(); +		seenServices.clear(); +	} +	catch (...) { +		seenServices.clear(); +		throw; +	}  } -typedef std::set<int> SeenServices; -SeenServices seenServices;  bool  ServiceRows::parseInfoTable(const u_char * data, size_t len, const RowProcessor * rp) const {  	const struct sit *e = reinterpret_cast<const struct sit *>(data); diff --git a/p2pvr/scanner/serviceRows.h b/p2pvr/scanner/serviceRows.h index 0a048a0..7ad2457 100644 --- a/p2pvr/scanner/serviceRows.h +++ b/p2pvr/scanner/serviceRows.h @@ -25,6 +25,9 @@ class ServiceRows : public RowSet, DvbSiReaderHelper {  		RowAttribute resolveAttr(const Glib::ustring & attrName) const;  	private: +		typedef std::set<int> SeenServices; +		mutable SeenServices seenServices; +  		void filterInput(int fd) const;  		bool parseInfoTable(const u_char *data, size_t len, const RowProcessor *) const;  		void parseServiceDescriptor(const u_char *data, size_t len) const; | 
