From a20f952f705e18394db26bf1121363c3529f6c05 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sat, 19 Jun 2004 12:33:03 +0200 Subject: [PATCH] Fixed cRingBufferLinear::Get() in case the buffer wraps around --- CONTRIBUTORS | 1 + HISTORY | 2 ++ ringbuffer.c | 3 ++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 28f618a5..ace8e91a 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -735,6 +735,7 @@ Ludwig Nussel 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 for his support in keeping the Premiere World channels up to date in 'channels.conf' diff --git a/HISTORY b/HISTORY index 2f4aff57..1c67855f 100644 --- a/HISTORY +++ b/HISTORY @@ -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). diff --git a/ringbuffer.c b/ringbuffer.c index 6f26748a..b52c37e5 100644 --- a/ringbuffer.c +++ b/ringbuffer.c @@ -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;