aboutsummaryrefslogtreecommitdiff
path: root/lib/dvb/epgcache.cpp
diff options
context:
space:
mode:
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>2006-01-23 16:32:45 +0000
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>2006-01-23 16:32:45 +0000
commit9cd2284f3e08f856860adcf6ac54943e664b27c3 (patch)
treef7070aaa47780dbe05e7583a2273f6fa0959f04f /lib/dvb/epgcache.cpp
parent10bcb34f8993ecc000f027ecc8ce7fc89f0bda2b (diff)
downloadenigma2-9cd2284f3e08f856860adcf6ac54943e664b27c3.tar.gz
enigma2-9cd2284f3e08f856860adcf6ac54943e664b27c3.zip
add endianess check to epg.dat
Diffstat (limited to 'lib/dvb/epgcache.cpp')
-rw-r--r--lib/dvb/epgcache.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/dvb/epgcache.cpp b/lib/dvb/epgcache.cpp
index 59b88107..716033ee 100644
--- a/lib/dvb/epgcache.cpp
+++ b/lib/dvb/epgcache.cpp
@@ -725,9 +725,17 @@ void eEPGCache::load()
if ( md5ok )
#endif
{
+ int magic;
+ fread( &magic, sizeof(int), 1, f);
+ if (magic != 0x98765432)
+ {
+ eDebug("epg file has incorrect byte order.. dont read it");
+ fclose(f);
+ return;
+ }
char text1[13];
fread( text1, 13, 1, f);
- if ( !strncmp( text1, "ENIGMA_EPG_V4", 13) )
+ if ( !strncmp( text1, "ENIGMA_EPG_V5", 13) )
{
fread( &size, sizeof(int), 1, f);
while(size--)
@@ -823,7 +831,9 @@ void eEPGCache::save()
int cnt=0;
if ( f )
{
- const char *text = "ENIGMA_EPG_V4";
+ int magic = 0x98765432;
+ fwrite( &magic, sizeof(int), 1, f);
+ const char *text = "ENIGMA_EPG_V5";
fwrite( text, 13, 1, f );
int size = eventDB.size();
fwrite( &size, sizeof(int), 1, f );