Revision 90d30570

View differences:

libavutil/mem.c
55 55
    if(!ptr)
56 56
        return ptr;
57 57
    diff= ((-(long)ptr - 1)&15) + 1;
58
    ptr += diff;
58
    ptr = (char*)ptr + diff;
59 59
    ((char*)ptr)[-1]= diff;
60 60
#elif defined (HAVE_MEMALIGN)
61 61
    ptr = memalign(16,size);
......
105 105
    //FIXME this isn't aligned correctly, though it probably isn't needed
106 106
    if(!ptr) return av_malloc(size);
107 107
    diff= ((char*)ptr)[-1];
108
    return realloc(ptr - diff, size + diff) + diff;
108
    return (char*)realloc((char*)ptr - diff, size + diff) + diff;
109 109
#else
110 110
    return realloc(ptr, size);
111 111
#endif
......
116 116
    /* XXX: this test should not be needed on most libcs */
117 117
    if (ptr)
118 118
#ifdef CONFIG_MEMALIGN_HACK
119
        free(ptr - ((char*)ptr)[-1]);
119
        free((char*)ptr - ((char*)ptr)[-1]);
120 120
#else
121 121
        free(ptr);
122 122
#endif

Also available in: Unified diff