summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-10-09 23:00:47 +0000
committerDavid Robillard <d@drobilla.net>2011-10-09 23:00:47 +0000
commitdc02039e446f90323b295cd78b7993617beafd7e (patch)
treef50365a55da6bb75a1875149c089d1ff016d3885
parentb3af6f000f23cdc0e3fafdfa407d4cf592c946f4 (diff)
downloadzix-dc02039e446f90323b295cd78b7993617beafd7e.tar.gz
zix-dc02039e446f90323b295cd78b7993617beafd7e.tar.bz2
zix-dc02039e446f90323b295cd78b7993617beafd7e.zip
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
-rw-r--r--src/ring.c2
-rw-r--r--test/ring_test.c2
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;