From 5234e05843941a6ba1dac2aec09a7592acd1fe60 Mon Sep 17 00:00:00 2001 From: Hardening Date: Wed, 21 May 2014 18:17:39 +0200 Subject: [PATCH] Make ringbuffer C89 aware for VC --- libfreerdp/utils/ringbuffer.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libfreerdp/utils/ringbuffer.c b/libfreerdp/utils/ringbuffer.c index 04dcffef1..493445705 100644 --- a/libfreerdp/utils/ringbuffer.c +++ b/libfreerdp/utils/ringbuffer.c @@ -135,6 +135,9 @@ static BOOL ringbuffer_realloc(RingBuffer *rb, size_t targetSize) */ BOOL ringbuffer_write(RingBuffer *rb, const void *ptr, size_t sz) { + size_t toWrite; + size_t remaining; + if ((rb->freeSize <= sz) && !ringbuffer_realloc(rb, rb->size + sz)) return FALSE; @@ -144,8 +147,8 @@ BOOL ringbuffer_write(RingBuffer *rb, const void *ptr, size_t sz) * v v * [ ################ ] */ - size_t toWrite = sz; - size_t remaining = sz; + toWrite = sz; + remaining = sz; if (rb->size - rb->writePtr < sz) toWrite = rb->size - rb->writePtr;