Fixed cRingBufferLinear::Get() in case the buffer wraps around

This commit is contained in:
Klaus Schmidinger 2004-06-19 12:33:03 +02:00
parent c4e0e6a54a
commit a20f952f70
3 changed files with 5 additions and 1 deletions

View File

@ -735,6 +735,7 @@ Ludwig Nussel <ludwig.nussel@web.de>
for making the plugin library directory configurable via Make.config
for reporting a problem on systems that have UTF-8 enabled
for pointing out a flaw in the the description of cRingBufferLinear
for reporting a bug in cRingBufferLinear::Get() in case the buffer wraps around
Thomas Koch <tom@harhar.net>
for his support in keeping the Premiere World channels up to date in 'channels.conf'

View File

@ -2932,3 +2932,5 @@ Video Disk Recorder Revision History
Cedric for reporting this one).
- Fixed the description of cRingBufferLinear (thanks to Ludwig Nussel for pointing
out this one).
- Fixed cRingBufferLinear::Get() in case the buffer wraps around (thanks to Ludwig
Nussel for reporting this one).

View File

@ -7,7 +7,7 @@
* Parts of this file were inspired by the 'ringbuffy.c' from the
* LinuxDVB driver (see linuxtv.org).
*
* $Id: ringbuffer.c 1.19 2004/03/07 13:46:51 kls Exp $
* $Id: ringbuffer.c 1.20 2004/06/19 12:27:56 kls Exp $
*/
#include "ringbuffer.h"
@ -181,6 +181,7 @@ uchar *cRingBufferLinear::Get(int &Count)
int t = margin - rest;
memcpy(buffer + t, buffer + tail, rest);
tail = t;
rest = head - tail;
}
int diff = head - tail;
int cont = (diff >= 0) ? diff : Size() + diff - margin;