projects
/
vuplus_dvbapp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
add endianess check to epg.dat
[vuplus_dvbapp]
/
lib
/
dvb
/
epgcache.cpp
diff --git
a/lib/dvb/epgcache.cpp
b/lib/dvb/epgcache.cpp
index
59b8810
..
716033e
100644
(file)
--- a/
lib/dvb/epgcache.cpp
+++ b/
lib/dvb/epgcache.cpp
@@
-725,9
+725,17
@@
void eEPGCache::load()
if ( md5ok )
#endif
{
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);
char text1[13];
fread( text1, 13, 1, f);
- if ( !strncmp( text1, "ENIGMA_EPG_V
4
", 13) )
+ if ( !strncmp( text1, "ENIGMA_EPG_V
5
", 13) )
{
fread( &size, sizeof(int), 1, f);
while(size--)
{
fread( &size, sizeof(int), 1, f);
while(size--)
@@
-823,7
+831,9
@@
void eEPGCache::save()
int cnt=0;
if ( f )
{
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 );
fwrite( text, 13, 1, f );
int size = eventDB.size();
fwrite( &size, sizeof(int), 1, f );