On 10/27/16 9:45 AM, Sebastian Lackner wrote:
Signed-off-by: Sebastian Lackner sebastian@fds-team.de
Depending on the buffer size, we might get a huge amount of old reports otherwise.
@ Aric: I believe there are some more things wrong with the ringbuffer implementation. We shouldn't really need a ->start pointer, this is exactly what the ring->pointers[] are used for. Also, the current implementation never uses all slots.
Reviews on the ringbuffer code is very welcome! Thanks!
It has been a while since I did that implementation but if I recall the purpose for start and end is about tracking the writing positions, It was more important before this patch, but after this patch you are correct that start is no longer needed. 2
-aric
dlls/hidclass.sys/buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/hidclass.sys/buffer.c b/dlls/hidclass.sys/buffer.c index 14e83e4..0b29f97 100644 --- a/dlls/hidclass.sys/buffer.c +++ b/dlls/hidclass.sys/buffer.c @@ -170,7 +170,7 @@ UINT RingBuffer_AddPointer(struct ReportRingBuffer *ring) for( ;count < ring->pointer_alloc; count++) ring->pointers[count] = POINTER_UNUSED; }
- ring->pointers[idx] = ring->start;
- ring->pointers[idx] = ring->end; LeaveCriticalSection(&ring->lock); return idx;
}