First public contribution.
1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #include <3gplibrary/mp4config.h>
24 * void *mp4malloc(size_t size)
28 * This is a wrapper for standard C library function calloc.
32 * size Size of memory block to be allocated.
39 void *mp4malloc(size_t size)
43 if ( sizex <= 0 || sizex >= KMaxTInt/2 )
45 return NULL; // calloc will panic with negative values or size >= KMaxTInt / 2
49 return calloc(size, 1);
57 * void *mp4realloc(void *memblock,
63 * This is a wrapper for standard C library function realloc.
67 * memblock Allocated memory pointer
69 * oldsize Size of memblock
76 void *mp4realloc(void *memblock, size_t size, size_t oldsize)
80 p = realloc(memblock, size);
84 memset(((mp4_u8 *)p) + oldsize, 0, size - oldsize);
93 * void mp4free(void *mem)
97 * This is a wrapper for standard C library function free.
101 * mem Pointer to allocated memory
108 void mp4free(void *mem)
117 * void *mp4memcpy(void *dest,
123 * This is a wrapper for standard C library function memcpy.
127 * dest Destination of copy
129 * count Number of nytes to copy
136 void *mp4memcpy(void *dest, void *src, mp4_u32 count)
138 memcpy(dest, src, count);