OSDN Git Service

stagefright amrwbenc: Make the mem_malloc function 64-bit safe
authorMartin Storsjo <martin@martin.st>
Wed, 22 Dec 2010 21:09:51 +0000 (22:09 +0100)
committerMartin Storsjo <martin@martin.st>
Fri, 13 Jan 2012 18:57:09 +0000 (20:57 +0200)
Change-Id: Iab0dbfdc6be09c62d353bee46596635686b784a6

media/libstagefright/codecs/amrwbenc/src/mem_align.c

index a29baf3..3b7853f 100644 (file)
 
 
 #include       "mem_align.h"
+#ifdef _MSC_VER
+#include       <stddef.h>
+#else
+#include       <stdint.h>
+#endif
 
 /*****************************************************************************
 *
@@ -66,8 +71,8 @@ mem_malloc(VO_MEM_OPERATOR *pMemop, unsigned int size, unsigned char alignment,
                pMemop->Set(CodecID, tmp, 0, size + alignment);
 
                mem_ptr =
-                       (unsigned char *) ((unsigned int) (tmp + alignment - 1) &
-                                       (~((unsigned int) (alignment - 1))));
+                       (unsigned char *) ((intptr_t) (tmp + alignment - 1) &
+                                       (~((intptr_t) (alignment - 1))));
 
                if (mem_ptr == tmp)
                        mem_ptr += alignment;