Skip to content

Commit

Permalink
Avoid pointer arithmetic with (void *) pointers.
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephan Mühlstrasser committed Oct 21, 2015
1 parent 540aa58 commit b7a1623
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/openjp2/opj_malloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit b7a1623

Please sign in to comment.