summaryrefslogtreecommitdiff
path: root/marks.cpp
diff options
context:
space:
mode:
authorJochen Dolze <vdr@dolze.de>2010-03-22 00:57:51 +0100
committerJochen Dolze <vdr@dolze.de>2010-03-22 00:57:51 +0100
commit072a7fa407d109a8c87365bbf2e9c164fbb116fc (patch)
tree58fa27d27353e1ff8f8e6c76cdb6583081ade321 /marks.cpp
parente221a9a6cdb4afe17f9c26228aa66aada85ef86a (diff)
downloadvdr-plugin-markad-072a7fa407d109a8c87365bbf2e9c164fbb116fc.tar.gz
vdr-plugin-markad-072a7fa407d109a8c87365bbf2e9c164fbb116fc.tar.bz2
Another CheckIndex fix ;)
Diffstat (limited to 'marks.cpp')
-rw-r--r--marks.cpp47
1 files changed, 35 insertions, 12 deletions
diff --git a/marks.cpp b/marks.cpp
index a4ae4b6..5a59b2e 100644
--- a/marks.cpp
+++ b/marks.cpp
@@ -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();
}