From 2d42b91c7bd6212f6fcc6b69267f787ea259b94e Mon Sep 17 00:00:00 2001 From: Yasuyuki Tanaka Date: Wed, 11 Jan 2017 21:44:29 +0100 Subject: [PATCH] ringbufindex: fix bugs of ringbufindex_peek_{put,get} --- core/lib/ringbufindex.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/lib/ringbufindex.c b/core/lib/ringbufindex.c index 0b2149ff7..a30e85f74 100644 --- a/core/lib/ringbufindex.c +++ b/core/lib/ringbufindex.c @@ -83,7 +83,7 @@ ringbufindex_peek_put(const struct ringbufindex *r) if(((r->put_ptr - r->get_ptr) & r->mask) == r->mask) { return -1; } - return (r->put_ptr + 1) & r->mask; + return r->put_ptr; } /* Remove the first element and return its index */ int @@ -118,7 +118,7 @@ ringbufindex_peek_get(const struct ringbufindex *r) first one. If there are no bytes left, we return -1. */ if(((r->put_ptr - r->get_ptr) & r->mask) > 0) { - return (r->get_ptr + 1) & r->mask; + return r->get_ptr; } else { return -1; }