diff options
author | Andrey Nazarov <skuller@skuller.net> | 2012-07-25 21:43:09 +0400 |
---|---|---|
committer | Andrey Nazarov <skuller@skuller.net> | 2012-07-25 21:43:09 +0400 |
commit | 7305a6a670c6c1af511b8b8ff18d10d61ee8516c (patch) | |
tree | 377b285315baf5e774ad4f418f53ee26471b050f | |
parent | cd26dea31185e2f9ba0989ce5fef092bd35460b2 (diff) |
Fix arithmetic on void pointers.
-rw-r--r-- | src/baseq2/g_save.c | 2 | ||||
-rw-r--r-- | src/unix/hunk.c | 2 | ||||
-rw-r--r-- | src/unix/system.c | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/src/baseq2/g_save.c b/src/baseq2/g_save.c index 3e71587..f8106b0 100644 --- a/src/baseq2/g_save.c +++ b/src/baseq2/g_save.c @@ -489,7 +489,7 @@ static void write_index(FILE *f, void *p, size_t size, void *start, int max_inde gi.error("%s: pointer out of range: %p", __func__, p); } - diff = p - start; + diff = (byte *)p - (byte *)start; if (diff % size) { gi.error("%s: misaligned pointer: %p", __func__, p); } diff --git a/src/unix/hunk.c b/src/unix/hunk.c index c4d1fcb..ebd0d20 100644 --- a/src/unix/hunk.c +++ b/src/unix/hunk.c @@ -66,7 +66,7 @@ void Hunk_End(memhunk_t *hunk) #else void *unmap_base = (byte *)hunk->base + newsize; size_t unmap_len = hunk->maxsize - newsize; - void *buf = munmap(unmap_base, unmap_len) + hunk->base; + void *buf = munmap(unmap_base, unmap_len) + (byte *)hunk->base; #endif if (buf != hunk->base) Com_Error(ERR_FATAL, "%s: could not remap virtual block: %s", diff --git a/src/unix/system.c b/src/unix/system.c index f2c4a3d..481f1f8 100644 --- a/src/unix/system.c +++ b/src/unix/system.c @@ -83,7 +83,7 @@ static int stdout_sleep(void) // handles partial writes correctly, but never spins too much // blocks for 100 ms before giving up and losing data -static void stdout_write(const void *buf, size_t len) +static void stdout_write(const char *buf, size_t len) { const char *what; int ret, spins; |