mirror of https://git.ffmpeg.org/ffmpeg.git
Avoid void*-arithmetic.
Patch by mvplayer: ffmpeg gmail com Originally committed as revision 11932 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
7eeebcc5de
commit
90d30570d8
|
@ -55,7 +55,7 @@ void *av_malloc(unsigned int size)
|
||||||
if(!ptr)
|
if(!ptr)
|
||||||
return ptr;
|
return ptr;
|
||||||
diff= ((-(long)ptr - 1)&15) + 1;
|
diff= ((-(long)ptr - 1)&15) + 1;
|
||||||
ptr += diff;
|
ptr = (char*)ptr + diff;
|
||||||
((char*)ptr)[-1]= diff;
|
((char*)ptr)[-1]= diff;
|
||||||
#elif defined (HAVE_MEMALIGN)
|
#elif defined (HAVE_MEMALIGN)
|
||||||
ptr = memalign(16,size);
|
ptr = memalign(16,size);
|
||||||
|
@ -105,7 +105,7 @@ void *av_realloc(void *ptr, unsigned int size)
|
||||||
//FIXME this isn't aligned correctly, though it probably isn't needed
|
//FIXME this isn't aligned correctly, though it probably isn't needed
|
||||||
if(!ptr) return av_malloc(size);
|
if(!ptr) return av_malloc(size);
|
||||||
diff= ((char*)ptr)[-1];
|
diff= ((char*)ptr)[-1];
|
||||||
return realloc(ptr - diff, size + diff) + diff;
|
return (char*)realloc((char*)ptr - diff, size + diff) + diff;
|
||||||
#else
|
#else
|
||||||
return realloc(ptr, size);
|
return realloc(ptr, size);
|
||||||
#endif
|
#endif
|
||||||
|
@ -116,7 +116,7 @@ void av_free(void *ptr)
|
||||||
/* XXX: this test should not be needed on most libcs */
|
/* XXX: this test should not be needed on most libcs */
|
||||||
if (ptr)
|
if (ptr)
|
||||||
#ifdef CONFIG_MEMALIGN_HACK
|
#ifdef CONFIG_MEMALIGN_HACK
|
||||||
free(ptr - ((char*)ptr)[-1]);
|
free((char*)ptr - ((char*)ptr)[-1]);
|
||||||
#else
|
#else
|
||||||
free(ptr);
|
free(ptr);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue