From 659916cb16d6613b6ecca5b2fb57ec64cef1d994 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 16 Jun 2014 09:57:02 -0500 Subject: [PATCH] Fix Windows build - no math with void* pointers --- src/ioc/db/dbConvert.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/ioc/db/dbConvert.c b/src/ioc/db/dbConvert.c index 00a87c896..6ec76e407 100644 --- a/src/ioc/db/dbConvert.c +++ b/src/ioc/db/dbConvert.c @@ -43,19 +43,20 @@ * nRequest, no_bytes, and offset should be given in bytes. */ static void copyNoConvert(const void *pfrom, - void *pto, - long nRequest, - long no_bytes, - long offset) + void *pto, long nRequest, long no_bytes, long offset) { - if(offset>0 && offset < no_bytes && offset+nRequest > no_bytes) { + const void *pfrom_offset = (const char *) pfrom + offset; + + if (offset > 0 && offset < no_bytes && offset + nRequest > no_bytes) { const size_t N = no_bytes - offset; + void *pto_N = (char *) pto + N; + /* copy with wrap */ - memmove(pto, pfrom + offset, N); - memmove(pto + N, pfrom, nRequest - N); + memmove(pto, pfrom_offset, N); + memmove(pto_N, pfrom, nRequest - N); } else { /* no wrap, just copy */ - memmove(pto, pfrom + offset, nRequest); + memmove(pto, pfrom_offset, nRequest); } } #define COPYNOCONVERT(N, FROM, TO, NREQ, NO_ELEM, OFFSET) \