diff --git a/HISTORY b/HISTORY index f804c927..50470824 100644 --- a/HISTORY +++ b/HISTORY @@ -7312,3 +7312,6 @@ Video Disk Recorder Revision History start up to twice as fast as before. - Updated the Romanian OSD texts (thanks to Lucian Muresan). - Fixed handling the very last entry in a recording index. +- The return type of cMarks::Add() has been changed to void, since due to the sorting + of the list of marks the returned pointer might have pointed to a totally different + mark. Besides, the return value was never actually used. diff --git a/recording.c b/recording.c index 2955cb34..79db1c74 100644 --- a/recording.c +++ b/recording.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: recording.c 2.71 2012/11/12 14:48:12 kls Exp $ + * $Id: recording.c 2.72 2012/11/12 14:51:09 kls Exp $ */ #include "recording.h" @@ -1423,14 +1423,10 @@ void cMarks::Sort(void) } } -cMark *cMarks::Add(int Position) +void cMarks::Add(int Position) { - cMark *m = Get(Position); - if (!m) { - cConfig::Add(m = new cMark(Position, NULL, framesPerSecond)); - Sort(); - } - return m; + cConfig::Add(new cMark(Position, NULL, framesPerSecond)); + Sort(); } cMark *cMarks::Get(int Position) diff --git a/recording.h b/recording.h index 22c5d3a7..7118e783 100644 --- a/recording.h +++ b/recording.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: recording.h 2.38 2012/10/15 10:22:27 kls Exp $ + * $Id: recording.h 2.39 2012/11/12 14:51:09 kls Exp $ */ #ifndef __RECORDING_H @@ -234,7 +234,7 @@ public: bool Update(void); void Align(void); void Sort(void); - cMark *Add(int Position); + void Add(int Position); cMark *Get(int Position); cMark *GetPrev(int Position); cMark *GetNext(int Position); @@ -301,6 +301,7 @@ public: ///< If there is no actual index data available, 0 is returned. int Get(uint16_t FileNumber, off_t FileOffset); int Last(void) { CatchUp(); return last; } + ///< Returns the index of the last entry in this file, or -1 if the file is empty. int GetResume(void) { return resumeFile.Read(); } bool StoreResume(int Index) { return resumeFile.Save(Index); } bool IsStillRecording(void);