changeset 451:c2e1ba46b27c libavutil

Avoid void*-arithmetic. Patch by mvplayer: ffmpeg gmail com
author benoit
date Thu, 14 Feb 2008 08:16:07 +0000
parents dd654d025ed5
children 4b2cd7e98d58
files mem.c
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mem.c	Wed Feb 13 08:36:04 2008 +0000
+++ b/mem.c	Thu Feb 14 08:16:07 2008 +0000
@@ -55,7 +55,7 @@
     if(!ptr)
         return ptr;
     diff= ((-(long)ptr - 1)&15) + 1;
-    ptr += diff;
+    ptr = (char*)ptr + diff;
     ((char*)ptr)[-1]= diff;
 #elif defined (HAVE_MEMALIGN)
     ptr = memalign(16,size);
@@ -105,7 +105,7 @@
     //FIXME this isn't aligned correctly, though it probably isn't needed
     if(!ptr) return av_malloc(size);
     diff= ((char*)ptr)[-1];
-    return realloc(ptr - diff, size + diff) + diff;
+    return (char*)realloc((char*)ptr - diff, size + diff) + diff;
 #else
     return realloc(ptr, size);
 #endif
@@ -116,7 +116,7 @@
     /* XXX: this test should not be needed on most libcs */
     if (ptr)
 #ifdef CONFIG_MEMALIGN_HACK
-        free(ptr - ((char*)ptr)[-1]);
+        free((char*)ptr - ((char*)ptr)[-1]);
 #else
         free(ptr);
 #endif