diff options
author | Jochen Dolze <vdr@dolze.de> | 2010-03-22 00:57:51 +0100 |
---|---|---|
committer | Jochen Dolze <vdr@dolze.de> | 2010-03-22 00:57:51 +0100 |
commit | 072a7fa407d109a8c87365bbf2e9c164fbb116fc (patch) | |
tree | 58fa27d27353e1ff8f8e6c76cdb6583081ade321 /marks.cpp | |
parent | e221a9a6cdb4afe17f9c26228aa66aada85ef86a (diff) | |
download | vdr-plugin-markad-072a7fa407d109a8c87365bbf2e9c164fbb116fc.tar.gz vdr-plugin-markad-072a7fa407d109a8c87365bbf2e9c164fbb116fc.tar.bz2 |
Another CheckIndex fix ;)
Diffstat (limited to 'marks.cpp')
-rw-r--r-- | marks.cpp | 47 |
1 files changed, 35 insertions, 12 deletions
@@ -213,11 +213,10 @@ char *clMarks::IndexToHMSF(int Index, double FramesPerSecond) bool clMarks::CheckIndex(const char *Directory, bool isTS, bool *IndexError) { if (!IndexError) return false; - if (!first) - { - *IndexError=false; - return true; - } + *IndexError=false; + + if (!first) return true; + char *ipath=NULL; if (asprintf(&ipath,"%s/index%s",Directory,isTS ? "" : ".vdr")==-1) return false; @@ -229,20 +228,44 @@ bool clMarks::CheckIndex(const char *Directory, bool isTS, bool *IndexError) while (mark) { if (isTS) - { + { off_t offset = mark->position * sizeof(struct tIndexTS); - if (lseek(fd,offset,SEEK_SET)!=offset) return true; + if (lseek(fd,offset,SEEK_SET)!=offset) + { + *IndexError=true; + break; + } struct tIndexTS IndexTS; - if (read(fd,&IndexTS,sizeof(IndexTS))!=sizeof(IndexTS)) return true; - if (IndexTS.independent) return false; + if (read(fd,&IndexTS,sizeof(IndexTS))!=sizeof(IndexTS)) + { + *IndexError=true; + break; + } + if (!IndexTS.independent) + { + *IndexError=true; + break; + } } else { off_t offset = mark->position * sizeof(struct tIndexVDR); - if (lseek(fd,offset,SEEK_SET)!=offset) return true; + if (lseek(fd,offset,SEEK_SET)!=offset) + { + *IndexError=true; + break; + } struct tIndexVDR IndexVDR; - if (read(fd,&IndexVDR,sizeof(IndexVDR))!=sizeof(IndexVDR)) return true; - if (IndexVDR.type==1) return false; + if (read(fd,&IndexVDR,sizeof(IndexVDR))!=sizeof(IndexVDR)) + { + *IndexError=true; + break; + } + if (IndexVDR.type!=1) + { + *IndexError=true; + break; + } } mark=mark->Next(); } |