Merge pull request #644 from smuehlst/opj_aligned_malloc

Avoid pointer arithmetic with (void *) pointers
This commit is contained in:
Matthieu Darbois 2015-10-21 10:10:38 +02:00
commit b06bed7b7b
1 changed files with 1 additions and 1 deletions

View File

@ -166,7 +166,7 @@ static INLINE void *opj_aligned_realloc_n(void *ptr, size_t alignment, size_t ne
size_t new_offset;
/* realloc created a new copy, realign the copied memory block */
old_offset = (size_t)(ptr - oldmem);
old_offset = (size_t)((OPJ_UINT8*)ptr - (OPJ_UINT8*)oldmem);
/* offset = ((alignment + 1U) - ((size_t)(mem + sizeof(void*)) & alignment)) & alignment; */
/* Use the fact that alignment + 1U is a power of 2 */