From dc02039e446f90323b295cd78b7993617beafd7e Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 9 Oct 2011 23:00:47 +0000 Subject: Fix ZixRing error when reading split/wrapped messages. Use a non-power-of-two message size in ZixRing test to test this. git-svn-id: http://svn.drobilla.net/zix/trunk@43 df6676b4-ccc9-40e5-b5d6-7c4628a128e3 --- src/ring.c | 2 +- test/ring_test.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ring.c b/src/ring.c index 4dadcf2..5edc200 100644 --- a/src/ring.c +++ b/src/ring.c @@ -153,7 +153,7 @@ peek_internal(const ZixRing* ring, uint32_t r, uint32_t w, } else { const uint32_t first_size = ring->size - r; memcpy(dst, &ring->buf[r], first_size); - memcpy(dst, &ring->buf[0], size - first_size); + memcpy((char*)dst + first_size, &ring->buf[0], size - first_size); } return size; diff --git a/test/ring_test.c b/test/ring_test.c index ede0bac..7cde650 100644 --- a/test/ring_test.c +++ b/test/ring_test.c @@ -23,7 +23,7 @@ #include "zix/ring.h" -#define MSG_SIZE 4 +#define MSG_SIZE 20 ZixRing* ring = 0; size_t n_writes = 0; -- cgit v1.2.1