summaryrefslogtreecommitdiffstats
path: root/libvideoeditor/osal
diff options
context:
space:
mode:
authorShyam Pallapothu <shyamp@google.com>2011-04-21 09:48:41 -0700
committerShyam Pallapothu <shyamp@google.com>2011-04-21 09:48:41 -0700
commit694816d7291f17364502ac5d3319684a0b180860 (patch)
tree21a35b57a0eb154a49999407f466b5fa148d224b /libvideoeditor/osal
parent32ed3f4dad00f8a65f7e6b38402c70d5341c57eb (diff)
downloadframeworks_av-694816d7291f17364502ac5d3319684a0b180860.zip
frameworks_av-694816d7291f17364502ac5d3319684a0b180860.tar.gz
frameworks_av-694816d7291f17364502ac5d3319684a0b180860.tar.bz2
Fix for issue 4133431 "Remove OSAL layer" in engine part
Change-Id: I98f98691048a5afc6f691b0cc3cec92e458e8f44
Diffstat (limited to 'libvideoeditor/osal')
-rwxr-xr-xlibvideoeditor/osal/inc/LV_Macros.h2
-rwxr-xr-xlibvideoeditor/osal/inc/LV_Types.h4
-rwxr-xr-xlibvideoeditor/osal/inc/M4OSA_Memory.h5
-rwxr-xr-xlibvideoeditor/osal/src/LVOSA_FileReader_optim.c15
-rwxr-xr-xlibvideoeditor/osal/src/M4OSA_CharStar.c4
-rwxr-xr-xlibvideoeditor/osal/src/M4OSA_FileCache.c30
-rwxr-xr-xlibvideoeditor/osal/src/M4OSA_FileCommon.c28
-rwxr-xr-xlibvideoeditor/osal/src/M4OSA_FileExtra.c16
-rwxr-xr-xlibvideoeditor/osal/src/M4OSA_FileReader_RAM.c6
-rwxr-xr-xlibvideoeditor/osal/src/M4OSA_FileWriter_RAM.c6
-rwxr-xr-xlibvideoeditor/osal/src/M4OSA_Mutex.c6
-rwxr-xr-xlibvideoeditor/osal/src/M4OSA_Semaphore.c6
-rwxr-xr-xlibvideoeditor/osal/src/M4OSA_String.c28
-rwxr-xr-xlibvideoeditor/osal/src/M4OSA_String_priv.c38
-rwxr-xr-xlibvideoeditor/osal/src/M4OSA_Thread.c10
-rwxr-xr-xlibvideoeditor/osal/src/M4PSW_MemoryInterface.c41
16 files changed, 144 insertions, 101 deletions
diff --git a/libvideoeditor/osal/inc/LV_Macros.h b/libvideoeditor/osal/inc/LV_Macros.h
index d6312cc..fa927b7 100755
--- a/libvideoeditor/osal/inc/LV_Macros.h
+++ b/libvideoeditor/osal/inc/LV_Macros.h
@@ -97,7 +97,7 @@
{ \
if(M4OSA_NULL != (p)) \
{ \
- M4OSA_free((M4OSA_MemAddr32)(p)) ; \
+ free((p)) ; \
(p) = M4OSA_NULL ; \
} \
}
diff --git a/libvideoeditor/osal/inc/LV_Types.h b/libvideoeditor/osal/inc/LV_Types.h
index 534ea3a..5a45182 100755
--- a/libvideoeditor/osal/inc/LV_Types.h
+++ b/libvideoeditor/osal/inc/LV_Types.h
@@ -43,7 +43,7 @@ extern "C"
* @note This function converts a string from UTF8 format which is the default
* encoding in the engines and application logics to the character encoding
* supported by the OS or platform. The memory will be allocated within this
-* function and then, caller will have to free *targetStart thanks to M4OSA_free.
+* function and then, caller will have to free *targetStart thanks to free.
* Both strings must be NULL-terminateed.
* @param pStart (IN): String to convert.
* @param pOut (OUT): This pointer will be filled by this function. It contains the
@@ -61,7 +61,7 @@ typedef M4OSA_UInt32 (*LV_fromUTF8ToNative_Fct)(const M4OSA_Char* pStart,
* @note This function converts a string in the character encoding supported by the
* OS or platform to from UTF8 format which is the default encoding in the
* engines and application logics. The memory will be allocated within this
-* function and then, caller will have to free *targetStart thanks to M4OSA_free.
+* function and then, caller will have to free *targetStart thanks to free.
* Both strings must be NULL-terminateed.
* @param pStart (IN): String to convert.
* @param pOut (OUT): This pointer will be filled by this function. It contains the
diff --git a/libvideoeditor/osal/inc/M4OSA_Memory.h b/libvideoeditor/osal/inc/M4OSA_Memory.h
index d060602..7cb3d91 100755
--- a/libvideoeditor/osal/inc/M4OSA_Memory.h
+++ b/libvideoeditor/osal/inc/M4OSA_Memory.h
@@ -39,13 +39,16 @@ extern "C"
{
#endif
+M4OSAL_MEMORY_EXPORT_TYPE extern M4OSA_MemAddr32 M4OSA_32bitAlignedMalloc (M4OSA_UInt32 size,
+ M4OSA_CoreID coreID,
+ M4OSA_Char* string);
+
M4OSAL_MEMORY_EXPORT_TYPE extern M4OSA_MemAddr32 M4OSA_malloc (M4OSA_UInt32 size,
M4OSA_CoreID coreID,
M4OSA_Char* string);
M4OSAL_MEMORY_EXPORT_TYPE extern M4OSA_Void M4OSA_free (M4OSA_MemAddr32 address);
-
M4OSAL_MEMORY_EXPORT_TYPE extern M4OSA_ERR M4OSA_randInit(void);
diff --git a/libvideoeditor/osal/src/LVOSA_FileReader_optim.c b/libvideoeditor/osal/src/LVOSA_FileReader_optim.c
index dd4d269..14da016 100755
--- a/libvideoeditor/osal/src/LVOSA_FileReader_optim.c
+++ b/libvideoeditor/osal/src/LVOSA_FileReader_optim.c
@@ -167,7 +167,8 @@ M4OSA_ERR M4OSA_FileReader_BufferInit(M4OSA_FileReader_Context_optim* apContext)
for(i=0; i<M4OSA_READBUFFER_NB; i++)
{
- apContext->buffer[i].data = (M4OSA_MemAddr8) M4OSA_malloc(M4OSA_READBUFFER_SIZE, M4OSA_FILE_READER, (M4OSA_Char *)"M4OSA_FileReader_BufferInit");
+ apContext->buffer[i].data = (M4OSA_MemAddr8) M4OSA_32bitAlignedMalloc(M4OSA_READBUFFER_SIZE,
+ M4OSA_FILE_READER, (M4OSA_Char *)"M4OSA_FileReader_BufferInit");
M4ERR_CHECK_NULL_RETURN_VALUE(M4ERR_ALLOC, apContext->buffer[i].data);
}
@@ -182,7 +183,7 @@ M4OSA_Void M4OSA_FileReader_BufferFree(M4OSA_FileReader_Context_optim* apContext
for(i=0; i<M4OSA_READBUFFER_NB; i++)
if(apContext->buffer[i].data != M4OSA_NULL)
- M4OSA_free((M4OSA_MemAddr32)apContext->buffer[i].data);
+ free(apContext->buffer[i].data);
}
/**************************************************************/
@@ -544,7 +545,7 @@ M4OSA_ERR M4OSA_FileReader_CalculateSize(M4OSA_FileReader_Context_optim* apConte
*pContext = M4OSA_NULL;
/* Allocate memory for the File reader context. */
- apContext = (M4OSA_FileReader_Context_optim *)M4OSA_malloc(sizeof(M4OSA_FileReader_Context_optim),
+ apContext = (M4OSA_FileReader_Context_optim *)M4OSA_32bitAlignedMalloc(sizeof(M4OSA_FileReader_Context_optim),
M4OSA_FILE_READER, (M4OSA_Char *)"M4OSA_FileReader_Context_optim");
M4ERR_CHECK_NULL_RETURN_VALUE(M4ERR_ALLOC, apContext);
@@ -554,7 +555,7 @@ M4OSA_ERR M4OSA_FileReader_CalculateSize(M4OSA_FileReader_Context_optim* apConte
/*Set the optimized functions, to be called by the user*/
- apContext->FS = (M4OSA_FileReadPointer*) M4OSA_malloc(sizeof(M4OSA_FileReadPointer),
+ apContext->FS = (M4OSA_FileReadPointer*) M4OSA_32bitAlignedMalloc(sizeof(M4OSA_FileReadPointer),
M4OSA_FILE_READER, (M4OSA_Char *)"M4OSA_FileReaderOptim_init");
if (M4OSA_NULL==apContext->FS)
{
@@ -661,7 +662,7 @@ cleanup:
M4OSA_FileReader_BufferFree(apContext);
}
- M4OSA_free((M4OSA_MemAddr32) apContext);
+ free( apContext);
*pContext = M4OSA_NULL;
}
@@ -976,12 +977,12 @@ M4OSA_ERR M4OSA_fileReadClose_optim(M4OSA_Context pContext)
//>>>> GLM20090212 : set the low level function statically
if (apContext->FS != M4OSA_NULL)
{
- M4OSA_free((M4OSA_MemAddr32) apContext->FS);
+ free( apContext->FS);
}
//<<<< GLM20090212 : set the low level function statically
/* Free the context */
- M4OSA_free((M4OSA_MemAddr32)apContext);
+ free(apContext);
/* Return without error */
return err;
diff --git a/libvideoeditor/osal/src/M4OSA_CharStar.c b/libvideoeditor/osal/src/M4OSA_CharStar.c
index 083e3f2..a9461e2 100755
--- a/libvideoeditor/osal/src/M4OSA_CharStar.c
+++ b/libvideoeditor/osal/src/M4OSA_CharStar.c
@@ -413,7 +413,7 @@ M4OSA_ERR M4OSA_chrSPrintf(M4OSA_Char *pStrOut, M4OSA_UInt32 strOutMaxLen,
return M4ERR_NOT_IMPLEMENTED;
#endif
- newFormat =(M4OSA_Char*)M4OSA_malloc(newFormatLength,
+ newFormat =(M4OSA_Char*)M4OSA_32bitAlignedMalloc(newFormatLength,
M4OSA_CHARSTAR,(M4OSA_Char*)"M4OSA_chrPrintf: newFormat");
if(M4OSA_NULL == newFormat)
return M4ERR_ALLOC;
@@ -522,7 +522,7 @@ M4OSA_ERR M4OSA_chrSPrintf(M4OSA_Char *pStrOut, M4OSA_UInt32 strOutMaxLen,
err = vsnprintf((char *)pStrOut, (size_t)strOutMaxLen + 1, (const char *)newFormat, marker);
va_end(marker);
- M4OSA_free((M4OSA_MemAddr32)newFormat);
+ free(newFormat);
if ((err<0) || ((M4OSA_UInt32)err>strOutMaxLen))
{
pStrOut[strOutMaxLen] = '\0';
diff --git a/libvideoeditor/osal/src/M4OSA_FileCache.c b/libvideoeditor/osal/src/M4OSA_FileCache.c
index 0f66f96..718c0fb 100755
--- a/libvideoeditor/osal/src/M4OSA_FileCache.c
+++ b/libvideoeditor/osal/src/M4OSA_FileCache.c
@@ -281,7 +281,7 @@ M4OSA_Void M4OSA_FileCache_internalQuicksort(M4OSA_Int32* const table,
M4OSA_Int32* cursor;
M4OSA_Int32* indexc;
- queue = (M4OSA_Int32*)M4OSA_malloc(capacity*sizeof(M4OSA_Int32), 0,
+ queue = (M4OSA_Int32*)M4OSA_32bitAlignedMalloc(capacity*sizeof(M4OSA_Int32), 0,
(M4OSA_Char*) "quicksort FIFO of FileCache");
if(queue == M4OSA_NULL)
@@ -334,7 +334,7 @@ M4OSA_Void M4OSA_FileCache_internalQuicksort(M4OSA_Int32* const table,
while(index<size);
cursor = NULL;
indexc = NULL;
- M4OSA_free(queue);
+ free(queue);
}
M4OSA_Void M4OSA_FileCache_internalQuicksort64(M4OSA_Int64* const table,
@@ -354,7 +354,7 @@ M4OSA_Void M4OSA_FileCache_internalQuicksort64(M4OSA_Int64* const table,
M4OSA_Int32* cursor;
M4OSA_Int32* indexc;
- queue = (M4OSA_Int32*)M4OSA_malloc(capacity*sizeof(M4OSA_Int32), 0,
+ queue = (M4OSA_Int32*)M4OSA_32bitAlignedMalloc(capacity*sizeof(M4OSA_Int32), 0,
(M4OSA_Char*) "quicksort FIFO of FileCache");
if(queue == M4OSA_NULL)
@@ -407,7 +407,7 @@ M4OSA_Void M4OSA_FileCache_internalQuicksort64(M4OSA_Int64* const table,
while(index<size);
cursor = NULL;
indexc = NULL;
- M4OSA_free(queue);
+ free(queue);
}
/* Sorts an array of size size */
@@ -454,7 +454,7 @@ M4OSA_ERR M4OSA_FileCache_BuffersInit(M4OSA_FileCache_Context* apContext)
for(i=0; i<M4OSA_CACHEBUFFER_NB; i++)
{
- apContext->buffer[i].data = (M4OSA_MemAddr8) M4OSA_malloc(M4OSA_CACHEBUFFER_SIZE,
+ apContext->buffer[i].data = (M4OSA_MemAddr8) M4OSA_32bitAlignedMalloc(M4OSA_CACHEBUFFER_SIZE,
M4OSA_FILE_READER, (M4OSA_Char*)"M4OSA_FileCache_BufferInit");
M4ERR_CHECK_NULL_RETURN_VALUE(M4ERR_ALLOC, apContext->buffer[i].data);
apContext->buffer[i].filepos = M4OSA_EOF;
@@ -474,7 +474,7 @@ M4OSA_Void M4OSA_FileCache_BuffersFree(M4OSA_FileCache_Context* apContext)
{
if(apContext->buffer[i].data != M4OSA_NULL)
{
- M4OSA_free((M4OSA_MemAddr32)apContext->buffer[i].data);
+ free(apContext->buffer[i].data);
apContext->buffer[i].data = M4OSA_NULL;
}
}
@@ -1563,7 +1563,7 @@ M4OSA_Void* M4OSA_FileSystem_FFS_Open_cache( M4OSA_Void* pFileDescriptor,
fp = fopen((const char *) pFileDescriptor, (const char *)mode); /* Open in rb or in r+b*/
if( fp != NULL )
{
- pC = (M4OSA_FileSystem_FFS_t_cache *) M4OSA_malloc(sizeof * pC, M4OSA_FILE_READER, (M4OSA_Char*)"M4OSA_FileSystem_FFS_Open_cache");
+ pC = (M4OSA_FileSystem_FFS_t_cache *) M4OSA_32bitAlignedMalloc(sizeof * pC, M4OSA_FILE_READER, (M4OSA_Char*)"M4OSA_FileSystem_FFS_Open_cache");
if (pC == M4OSA_NULL) return M4OSA_NULL; /*error occured => return NULL pointer*/
@@ -1776,7 +1776,7 @@ M4OSA_ERR M4OSA_fileOpen_cache(M4OSA_Context* pContext,
M4OSA_FileSystem_FctPtr_cache *FS;
/* Allocate memory for the File System interface */
- FS = (M4OSA_FileSystem_FctPtr_cache *)M4OSA_malloc(sizeof * FS,
+ FS = (M4OSA_FileSystem_FctPtr_cache *)M4OSA_32bitAlignedMalloc(sizeof * FS,
M4OSA_FILE_READER,(M4OSA_Char*)"M4OSA_FileSystem_FctPtr_cache");
if(M4OSA_NULL == FS)
@@ -1836,7 +1836,7 @@ M4OSA_ERR M4OSA_fileOpen_cache_internal(M4OSA_Context* pContext,
*pContext = M4OSA_NULL;
/* Allocate memory for the File reader context. */
- apContext = (M4OSA_FileCache_Context *)M4OSA_malloc(sizeof(M4OSA_FileCache_Context),
+ apContext = (M4OSA_FileCache_Context *)M4OSA_32bitAlignedMalloc(sizeof(M4OSA_FileCache_Context),
M4OSA_FILE_READER, (M4OSA_Char*)"M4OSA_FileCache_Context");
M4ERR_CHECK_NULL_RETURN_VALUE(M4ERR_ALLOC, apContext);
@@ -1879,10 +1879,10 @@ M4OSA_ERR M4OSA_fileOpen_cache_internal(M4OSA_Context* pContext,
{
if (M4OSA_NULL != apContext->FS) /*should never be null*/
{
- M4OSA_free((M4OSA_MemAddr32)apContext->FS);
+ free(apContext->FS);
}
- M4OSA_free((M4OSA_MemAddr32)apContext);
+ free(apContext);
apContext = M4OSA_NULL;
}
@@ -1961,7 +1961,7 @@ cleanup:
if (M4OSA_NULL != apContext)
{
- M4OSA_free((M4OSA_MemAddr32)apContext);
+ free(apContext);
apContext = M4OSA_NULL;
}
*pContext = M4OSA_NULL;
@@ -2669,8 +2669,8 @@ LOCK
apContext->IsOpened = M4OSA_FALSE;
/* Free the context */
- M4OSA_free((M4OSA_MemAddr32)apContext->FS);
- M4OSA_free((M4OSA_MemAddr32)apContext->aFileDesc);
+ free(apContext->FS);
+ free(apContext->aFileDesc);
#ifdef FILECACHE_STATS
{
@@ -2719,7 +2719,7 @@ LOCK
M4OSA_memset((M4OSA_MemAddr8)apContext, sizeof(M4OSA_FileCache_Context), 0);
- M4OSA_free((M4OSA_MemAddr32)apContext);
+ free(apContext);
M4OSA_TRACE2_1("M4OSA_fileClose_cache leaving with err = 0x%x", err);
diff --git a/libvideoeditor/osal/src/M4OSA_FileCommon.c b/libvideoeditor/osal/src/M4OSA_FileCommon.c
index 8731a3d..a012ec0 100755
--- a/libvideoeditor/osal/src/M4OSA_FileCommon.c
+++ b/libvideoeditor/osal/src/M4OSA_FileCommon.c
@@ -96,7 +96,7 @@ M4OSA_ERR M4OSA_fileCommonOpen(M4OSA_UInt16 core_id, M4OSA_Context* pContext,
M4OSA_Void* tempConversionBuf;
M4OSA_UInt32 tempConversionSize = 1000;
- tempConversionBuf = (M4OSA_Char*)M4OSA_malloc(tempConversionSize +1, 0, "conversion buf");
+ tempConversionBuf = (M4OSA_Char*)M4OSA_32bitAlignedMalloc(tempConversionSize +1, 0, "conversion buf");
if(tempConversionBuf == M4OSA_NULL)
{
M4OSA_TRACE1_0("Error when allocating conversion buffer\n");
@@ -140,7 +140,7 @@ M4OSA_ERR M4OSA_fileCommonOpen(M4OSA_UInt16 core_id, M4OSA_Context* pContext,
M4ERR_FILE_BAD_MODE_ACCESS, "M4OSA_fileCommonOpen: M4OSA_kFileWrite");
#ifdef FILE_LOWER_CASE
- tmpLowerCaseUrl = (M4OSA_Char*)M4OSA_malloc(strlen(pUrl) +1, 0, "conversion buf");
+ tmpLowerCaseUrl = (M4OSA_Char*)M4OSA_32bitAlignedMalloc(strlen(pUrl) +1, 0, "conversion buf");
for(i=0; i<strlen(pUrl); i++)
{
tmpLowerCaseUrl[i] = M4OSA_chrToLower(pUrl[i]);
@@ -187,11 +187,11 @@ M4OSA_ERR M4OSA_fileCommonOpen(M4OSA_UInt16 core_id, M4OSA_Context* pContext,
/*Open the converted path*/
pFileHandler = fopen((const char *)tempConversionBuf, (const char *)mode);
/*Free the temporary decoded buffer*/
- M4OSA_free((M4OSA_MemAddr32)tempConversionBuf);
+ free(tempConversionBuf);
#else /* UTF_CONVERSION */
#ifdef FILE_LOWER_CASE
pFileHandler = fopen((const char *)tmpLowerCaseUrl, (const char *)mode);
- M4OSA_free((M4OSA_MemAddr32)tmpLowerCaseUrl);
+ free(tmpLowerCaseUrl);
#else
pFileHandler = fopen((const char *)pUrl, (const char *)mode);
#endif
@@ -233,7 +233,7 @@ M4OSA_ERR M4OSA_fileCommonOpen(M4OSA_UInt16 core_id, M4OSA_Context* pContext,
}
/* Allocate the file context */
- pFileContext = (M4OSA_FileContext*) M4OSA_malloc(sizeof(M4OSA_FileContext),
+ pFileContext = (M4OSA_FileContext*) M4OSA_32bitAlignedMalloc(sizeof(M4OSA_FileContext),
core_id, (M4OSA_Char*)"M4OSA_fileCommonOpen: file context");
if (M4OSA_NULL == pFileContext)
{
@@ -272,12 +272,12 @@ M4OSA_ERR M4OSA_fileCommonOpen(M4OSA_UInt16 core_id, M4OSA_Context* pContext,
M4OSA_INT_TO_FILE_POSITION(0, pFileContext->write_position);
/* Allocate the memory to store the URL string */
- pFileContext->url_name = (M4OSA_Char*) M4OSA_malloc(strlen((const char *)pUrl)+1,
+ pFileContext->url_name = (M4OSA_Char*) M4OSA_32bitAlignedMalloc(strlen((const char *)pUrl)+1,
core_id, (M4OSA_Char*)"M4OSA_fileCommonOpen: URL name");
if (M4OSA_NULL == pFileContext->url_name)
{
fclose(pFileHandler);
- M4OSA_free((M4OSA_MemAddr32)pFileContext);
+ free(pFileContext);
M4OSA_DEBUG(M4ERR_ALLOC, "M4OSA_fileCommonOpen");
return M4ERR_ALLOC;
}
@@ -288,8 +288,8 @@ M4OSA_ERR M4OSA_fileCommonOpen(M4OSA_UInt16 core_id, M4OSA_Context* pContext,
if(M4NO_ERROR != err)
{
fclose(pFileHandler);
- M4OSA_free((M4OSA_MemAddr32)pFileContext->url_name);
- M4OSA_free((M4OSA_MemAddr32)pFileContext);
+ free(pFileContext->url_name);
+ free(pFileContext);
M4OSA_DEBUG(err, "M4OSA_fileCommonOpen");
return err;
}
@@ -509,10 +509,10 @@ M4OSA_ERR M4OSA_fileCommonClose(M4OSA_UInt16 core_id, M4OSA_Context pContext)
"M4OSA_fileCommonClose: semaphore_context is M4OSA_NULL");
#endif /* M4OSA_FILE_BLOCK_WITH_SEMAPHORE */
- M4OSA_free((M4OSA_MemAddr32)pFileContext->url_name);
+ free(pFileContext->url_name);
pFileContext->url_name = M4OSA_NULL;
- M4OSA_free((M4OSA_MemAddr32)pFileContext->file_name);
+ free(pFileContext->file_name);
pFileContext->file_name = M4OSA_NULL;
i32_err_code = fclose(pFileContext->file_desc);
@@ -523,7 +523,7 @@ M4OSA_ERR M4OSA_fileCommonClose(M4OSA_UInt16 core_id, M4OSA_Context pContext)
M4OSA_semaphoreClose(pFileContext->semaphore_context);/* free the semaphore */
#endif /* M4OSA_FILE_BLOCK_WITH_SEMAPHORE */
- M4OSA_free((M4OSA_MemAddr32)pFileContext);
+ free(pFileContext);
if (i32_err_code != 0)
{
@@ -611,7 +611,7 @@ M4OSA_ERR M4OSA_fileCommonGetURL(M4OSA_Context pContext, M4OSA_Char** pUrl)
uiLength = strlen((const char *)pFileContext->url_name)+1;
/* Allocate the memory to store the url_name */
- *pUrl = (M4OSA_Char*)M4OSA_malloc(uiLength, M4OSA_FILE_COMMON,
+ *pUrl = (M4OSA_Char*)M4OSA_32bitAlignedMalloc(uiLength, M4OSA_FILE_COMMON,
(M4OSA_Char*)"M4OSA_fileCommonGetURL: url");
if(M4OSA_NULL == *pUrl)
{
@@ -673,7 +673,7 @@ M4OSA_ERR M4OSA_fileCommonGetFilename(M4OSA_Char* pUrl, M4OSA_Char** pFileName)
}
}
- ptrFilename = (M4OSA_Char*) M4OSA_malloc(FileNameLen+1, M4OSA_FILE_COMMON,
+ ptrFilename = (M4OSA_Char*) M4OSA_32bitAlignedMalloc(FileNameLen+1, M4OSA_FILE_COMMON,
(M4OSA_Char*)"M4OSA_fileCommonGetFilename: Filename string");
if (ptrFilename == M4OSA_NULL)
{
diff --git a/libvideoeditor/osal/src/M4OSA_FileExtra.c b/libvideoeditor/osal/src/M4OSA_FileExtra.c
index 4a7b532..bcac97c 100755
--- a/libvideoeditor/osal/src/M4OSA_FileExtra.c
+++ b/libvideoeditor/osal/src/M4OSA_FileExtra.c
@@ -67,7 +67,7 @@ M4OSA_ERR M4OSA_fileExtraDelete(const M4OSA_Char* pUrl)
#ifdef UTF_CONVERSION
/*FB: to test the UTF16->UTF8 conversion into Video Artist*/
/*Convert the URL from UTF16 to UTF8*/
- tempConversionBuf = (M4OSA_Char*)M4OSA_malloc(tempConversionSize +1, 0,
+ tempConversionBuf = (M4OSA_Char*)M4OSA_32bitAlignedMalloc(tempConversionSize +1, 0,
(M4OSA_Char*)"conversion buf");
if(tempConversionBuf == M4OSA_NULL)
{
@@ -82,7 +82,7 @@ M4OSA_ERR M4OSA_fileExtraDelete(const M4OSA_Char* pUrl)
/*Open the converted path*/
err = remove (tempConversionBuf);
/*Free the temporary decoded buffer*/
- M4OSA_free((M4OSA_MemAddr32)tempConversionBuf);
+ free(tempConversionBuf);
#else
err = remove((const char *)pUrl);
#endif /* UTF_CONVERSION */
@@ -144,7 +144,7 @@ M4OSA_ERR M4OSA_fileExtraCopy(M4OSA_Char* pSrcUrl, M4OSA_Char* pDstUrl)
}
/* Allocate buffer */
- copy_buffer = M4OSA_malloc(BUFFER_COPY_SIZE, M4OSA_FILE_EXTRA,
+ copy_buffer = M4OSA_32bitAlignedMalloc(BUFFER_COPY_SIZE, M4OSA_FILE_EXTRA,
(M4OSA_Char*)"M4OSA_fileExtraCopy: copy buffer");
if(M4OSA_NULL == copy_buffer)
{
@@ -182,7 +182,7 @@ M4OSA_ERR M4OSA_fileExtraCopy(M4OSA_Char* pSrcUrl, M4OSA_Char* pDstUrl)
}
/* Free copy buffer */
- M4OSA_free(copy_buffer);
+ free(copy_buffer);
err = M4OSA_fileWriteClose(pOutputFileContext);
if(M4NO_ERROR != err)
@@ -238,7 +238,7 @@ M4OSA_ERR M4OSA_fileExtraRename(M4OSA_Char* pSrcUrl, M4OSA_Char* pDstUrl)
err = M4OSA_fileCommonGetFilename(pDstUrl, &pDstFilename);
if(M4NO_ERROR != err)
{
- M4OSA_free((M4OSA_MemAddr32)pSrcFilename);
+ free(pSrcFilename);
M4OSA_DEBUG(err, "M4OSA_fileExtraRename: M4OSA_fileCommonGetFilename");
return err;
}
@@ -263,8 +263,8 @@ M4OSA_ERR M4OSA_fileExtraRename(M4OSA_Char* pSrcUrl, M4OSA_Char* pDstUrl)
return M4ERR_PARAMETER;
}
- M4OSA_free((M4OSA_MemAddr32)pDstFilename);
- M4OSA_free((M4OSA_MemAddr32)pSrcFilename);
+ free(pDstFilename);
+ free(pSrcFilename);
return M4NO_ERROR;
}
@@ -317,7 +317,7 @@ M4OSA_ERR M4OSA_fileExtraChangeCurrentDir(const M4OSA_Char* pUrl)
return(M4ERR_PARAMETER);
}
- M4OSA_free((M4OSA_MemAddr32)pFileName);
+ free(pFileName);
return M4NO_ERROR;
}
diff --git a/libvideoeditor/osal/src/M4OSA_FileReader_RAM.c b/libvideoeditor/osal/src/M4OSA_FileReader_RAM.c
index 24acfaa..0cfc006 100755
--- a/libvideoeditor/osal/src/M4OSA_FileReader_RAM.c
+++ b/libvideoeditor/osal/src/M4OSA_FileReader_RAM.c
@@ -86,7 +86,7 @@ M4OSA_ERR M4OSA_fileReadRamOpen( M4OSA_Context* context,
}
/* Allocates memory for the context */
- pContext = (M4OSA_FileReaderRam_Context*)M4OSA_malloc(sizeof(M4OSA_FileReaderRam_Context),
+ pContext = (M4OSA_FileReaderRam_Context*)M4OSA_32bitAlignedMalloc(sizeof(M4OSA_FileReaderRam_Context),
M4OSA_FILE_READER, (M4OSA_Char*)"Context allocation");
if(pContext == M4OSA_NULL)
{
@@ -126,7 +126,7 @@ cleanup:
{
if(pContext != M4OSA_NULL)
{
- M4OSA_free((M4OSA_MemAddr32)pContext);
+ free(pContext);
*context = M4OSA_NULL;
}
}
@@ -310,7 +310,7 @@ M4OSA_ERR M4OSA_fileReadRamClose(M4OSA_Context context)
pContext->IsOpened = M4OSA_FALSE;
- M4OSA_free((M4OSA_MemAddr32)pContext);
+ free(pContext);
return M4NO_ERROR;
}
diff --git a/libvideoeditor/osal/src/M4OSA_FileWriter_RAM.c b/libvideoeditor/osal/src/M4OSA_FileWriter_RAM.c
index 9341ca9..4a8ff6f 100755
--- a/libvideoeditor/osal/src/M4OSA_FileWriter_RAM.c
+++ b/libvideoeditor/osal/src/M4OSA_FileWriter_RAM.c
@@ -80,7 +80,7 @@ M4OSA_ERR M4OSA_fileWriteRamOpen(M4OSA_Context* context, M4OSA_Void* fileDescrip
}
/* Allocate memory for the File writer context. */
- pContext = (M4OSA_FileWriterRam_Context *)M4OSA_malloc(sizeof(M4OSA_FileWriterRam_Context),
+ pContext = (M4OSA_FileWriterRam_Context *)M4OSA_32bitAlignedMalloc(sizeof(M4OSA_FileWriterRam_Context),
M4OSA_FILE_WRITER, (M4OSA_Char*)"Context allocation");
if(pContext == M4OSA_NULL)
{
@@ -103,7 +103,7 @@ M4OSA_ERR M4OSA_fileWriteRamOpen(M4OSA_Context* context, M4OSA_Void* fileDescrip
{
if (M4OSA_NULL != pContext)
{
- M4OSA_free((M4OSA_MemAddr32)pContext);
+ free(pContext);
}
*context=M4OSA_NULL;
}
@@ -301,7 +301,7 @@ M4OSA_ERR M4OSA_fileWriteRamClose(M4OSA_Context context)
pContext->IsOpened = M4OSA_FALSE;
/* Free the context */
- M4OSA_free((M4OSA_MemAddr32)pContext);
+ free(pContext);
/* Return error */
return err;
diff --git a/libvideoeditor/osal/src/M4OSA_Mutex.c b/libvideoeditor/osal/src/M4OSA_Mutex.c
index 0d857f6..8db3e2a 100755
--- a/libvideoeditor/osal/src/M4OSA_Mutex.c
+++ b/libvideoeditor/osal/src/M4OSA_Mutex.c
@@ -67,7 +67,7 @@ M4OSA_ERR M4OSA_mutexOpen(M4OSA_Context* pContext)
*pContext = M4OSA_NULL;
- pMutexContext = (M4OSA_MutexContext*)M4OSA_malloc(sizeof(M4OSA_MutexContext),
+ pMutexContext = (M4OSA_MutexContext*)M4OSA_32bitAlignedMalloc(sizeof(M4OSA_MutexContext),
M4OSA_MUTEX, (M4OSA_Char*)"M4OSA_mutexOpen: mutex context");
if(M4OSA_NULL == pMutexContext)
@@ -96,7 +96,7 @@ M4OSA_ERR M4OSA_mutexOpen(M4OSA_Context* pContext)
if(!opened)
{
M4OSA_DEBUG(M4ERR_CONTEXT_FAILED, "M4OSA_mutexOpen: OS mutex creation failed");
- M4OSA_free((M4OSA_MemAddr32)pMutexContext);
+ free(pMutexContext);
return M4ERR_CONTEXT_FAILED ;
}
@@ -269,7 +269,7 @@ M4OSA_ERR M4OSA_mutexClose(M4OSA_Context context)
pthread_mutex_destroy(&pMutexContext->mutex);
- M4OSA_free((M4OSA_MemAddr32) pMutexContext);
+ free( pMutexContext);
return M4NO_ERROR;
}
diff --git a/libvideoeditor/osal/src/M4OSA_Semaphore.c b/libvideoeditor/osal/src/M4OSA_Semaphore.c
index a99b136..aeac0a9 100755
--- a/libvideoeditor/osal/src/M4OSA_Semaphore.c
+++ b/libvideoeditor/osal/src/M4OSA_Semaphore.c
@@ -77,7 +77,7 @@ M4OSA_ERR M4OSA_semaphoreOpen(M4OSA_Context* context,
*context = M4OSA_NULL;
- semaphoreContext = (M4OSA_SemaphoreContext*) M4OSA_malloc(
+ semaphoreContext = (M4OSA_SemaphoreContext*) M4OSA_32bitAlignedMalloc(
sizeof(M4OSA_SemaphoreContext), M4OSA_SEMAPHORE,
(M4OSA_Char*)"M4OSA_semaphoreOpen: semaphore context");
@@ -90,7 +90,7 @@ M4OSA_ERR M4OSA_semaphoreOpen(M4OSA_Context* context,
if (0 != sem_init(&semaphoreContext->semaphore, 0, initial_count))
{
- M4OSA_free((M4OSA_MemAddr32)semaphoreContext);
+ free(semaphoreContext);
M4OSA_DEBUG(M4ERR_CONTEXT_FAILED,
"M4OSA_semaphoreOpen: OS semaphore creation failed");
@@ -257,7 +257,7 @@ M4OSA_ERR M4OSA_semaphoreClose(M4OSA_Context context)
sem_destroy(&semaphoreContext->semaphore);
- M4OSA_free((M4OSA_MemAddr32)semaphoreContext);
+ free(semaphoreContext);
return M4NO_ERROR;
}
diff --git a/libvideoeditor/osal/src/M4OSA_String.c b/libvideoeditor/osal/src/M4OSA_String.c
index af98b4b..7cf7801 100755
--- a/libvideoeditor/osal/src/M4OSA_String.c
+++ b/libvideoeditor/osal/src/M4OSA_String.c
@@ -49,7 +49,7 @@ M4OSA_ERR M4OSA_strCreate(M4OSA_String* pStrOut)
"M4OSA_strCreate");
/* Allocate the output M4OSA_String */
- pStr = (M4OSA_strStruct*)M4OSA_malloc(sizeof(M4OSA_strStruct), M4OSA_STRING,
+ pStr = (M4OSA_strStruct*)M4OSA_32bitAlignedMalloc(sizeof(M4OSA_strStruct), M4OSA_STRING,
(M4OSA_Char*)"M4OSA_strPrivCreate: output string");
/* Check memory allocation error */
@@ -98,7 +98,7 @@ M4OSA_ERR M4OSA_strReset(M4OSA_String str_in)
if(M4OSA_NULL != pBuffer)
{
- M4OSA_free((M4OSA_MemAddr32)pBuffer);
+ free(pBuffer);
pStr->pui8_buffer = M4OSA_NULL;
}
@@ -133,10 +133,10 @@ M4OSA_ERR M4OSA_strDestroy(M4OSA_String str_in)
/* Free M4OSA_String buffer */
- M4OSA_free((M4OSA_MemAddr32)(pStr->pui8_buffer));
+ free((pStr->pui8_buffer));
/* Free M4OSA_String structure memory */
- M4OSA_free((M4OSA_MemAddr32)pStr);
+ free(pStr);
return M4NO_ERROR;
@@ -1249,7 +1249,7 @@ M4OSA_ERR M4OSA_strCompare(M4OSA_String str_in1, M4OSA_String str_in2,
length = (length1 < length2) ? length1 : length2;
- pTmp1 = (M4OSA_Char*)M4OSA_malloc(2 * length * sizeof(M4OSA_Char),
+ pTmp1 = (M4OSA_Char*)M4OSA_32bitAlignedMalloc(2 * length * sizeof(M4OSA_Char),
M4OSA_STRING, (M4OSA_Char*)"M4OSA_strCompare");
M4OSA_CHECK_MALLOC(pTmp1, "M4OSA_strCompare");
@@ -1268,7 +1268,7 @@ M4OSA_ERR M4OSA_strCompare(M4OSA_String str_in1, M4OSA_String str_in2,
M4OSA_chrNCompare(pTmp1, pTmp2, length, &result);
- M4OSA_free((M4OSA_MemAddr32)pTmp1);
+ free(pTmp1);
if(result != 0)
{
@@ -1352,7 +1352,7 @@ M4OSA_ERR M4OSA_strCompareSubStr(M4OSA_String str_in1,
return_code = M4WAR_STR_OVERFLOW;
}
- pTmp1 = (M4OSA_Char*)M4OSA_malloc(2 * (*pui32_num) * sizeof(M4OSA_Char),
+ pTmp1 = (M4OSA_Char*)M4OSA_32bitAlignedMalloc(2 * (*pui32_num) * sizeof(M4OSA_Char),
M4OSA_STRING, (M4OSA_Char*)"M4OSA_strCompareSubStr");
M4OSA_CHECK_MALLOC(pTmp1, "M4OSA_strCompareSubStr");
@@ -1374,7 +1374,7 @@ M4OSA_ERR M4OSA_strCompareSubStr(M4OSA_String str_in1,
M4OSA_DEBUG_IF2((M4OSA_ERR)M4ERR_PARAMETER == err_code, M4ERR_PARAMETER,
"M4OSA_strCompareSubStr: M4OSA_chrNCompare");
- M4OSA_free((M4OSA_MemAddr32)pTmp1);
+ free(pTmp1);
return return_code;
}
@@ -2124,14 +2124,14 @@ M4OSA_ERR M4OSA_strReplaceSubStr(M4OSA_String str_in, M4OSA_String str_old,
if(ostr2free == M4OSA_TRUE)
{
- M4OSA_free((M4OSA_MemAddr32)pOstr->pui8_buffer);
- M4OSA_free((M4OSA_MemAddr32)pOstr);
+ free(pOstr->pui8_buffer);
+ free(pOstr);
}
if(nstr2free == M4OSA_TRUE)
{
- M4OSA_free((M4OSA_MemAddr32)pNstr->pui8_buffer);
- M4OSA_free((M4OSA_MemAddr32)pNstr);
+ free(pNstr->pui8_buffer);
+ free(pNstr);
}
return err_code;
@@ -2396,7 +2396,7 @@ M4OSA_ERR M4OSA_strSetMinAllocationSize(M4OSA_String str_in, M4OSA_UInt32 ui32_n
}
/* Allocate the actual M4OSA_String content */
- pBuffer = (M4OSA_Char*)M4OSA_malloc(ui32_size * sizeof(M4OSA_Char),
+ pBuffer = (M4OSA_Char*)M4OSA_32bitAlignedMalloc(ui32_size * sizeof(M4OSA_Char),
M4OSA_STRING, (M4OSA_Char*)"M4OSA_strSetMinAllocationSize");
M4OSA_CHECK_MALLOC(pBuffer, "M4OSA_strSetMinAllocationSize");
@@ -2405,7 +2405,7 @@ M4OSA_ERR M4OSA_strSetMinAllocationSize(M4OSA_String str_in, M4OSA_UInt32 ui32_n
{
M4OSA_memcpy(pBuffer, pIbuffer, pStr->ui32_length+1);
- M4OSA_free((M4OSA_MemAddr32)pIbuffer);
+ free(pIbuffer);
}
pStr->pui8_buffer = pBuffer;
diff --git a/libvideoeditor/osal/src/M4OSA_String_priv.c b/libvideoeditor/osal/src/M4OSA_String_priv.c
index 07cef33..79a26a0 100755
--- a/libvideoeditor/osal/src/M4OSA_String_priv.c
+++ b/libvideoeditor/osal/src/M4OSA_String_priv.c
@@ -65,11 +65,11 @@ M4OSA_ERR M4OSA_strPrivRealloc(M4OSA_strStruct* str,
if(buffer != M4OSA_NULL)
{
- M4OSA_free((M4OSA_MemAddr32)buffer);
+ free(buffer);
}
/* Allocate the actual M4OSA_String content */
- buffer = (M4OSA_Char*)M4OSA_malloc(ui32_size * sizeof(M4OSA_Char),
+ buffer = (M4OSA_Char*)M4OSA_32bitAlignedMalloc(ui32_size * sizeof(M4OSA_Char),
M4OSA_STRING, (M4OSA_Char*)"M4OSA_strPrivRealloc");
/* Check memory allocation error */
@@ -128,7 +128,7 @@ M4OSA_ERR M4OSA_strPrivReallocCopy(M4OSA_strStruct* str,
}
/* Allocate the actual M4OSA_String content */
- buffer = (M4OSA_Char*)M4OSA_malloc(ui32_size * sizeof(M4OSA_Char),
+ buffer = (M4OSA_Char*)M4OSA_32bitAlignedMalloc(ui32_size * sizeof(M4OSA_Char),
M4OSA_STRING, (M4OSA_Char*)"M4OSA_strPrivReallocCopy");
/* Check memory allocation error */
@@ -149,7 +149,7 @@ M4OSA_ERR M4OSA_strPrivReallocCopy(M4OSA_strStruct* str,
{
M4OSA_memcpy(buffer, pui8_buffer, str->ui32_length + 1);
- M4OSA_free((M4OSA_MemAddr32)pui8_buffer);
+ free(pui8_buffer);
}
str->pui8_buffer = buffer;
@@ -170,7 +170,7 @@ M4OSA_ERR M4OSA_strPrivDuplicate(M4OSA_strStruct** ostr,
"M4OSA_strStruct** 0x%x", ostr, istr);
/* Allocate the output M4OSA_String */
- str = (M4OSA_strStruct*)M4OSA_malloc(sizeof(M4OSA_strStruct), M4OSA_STRING,
+ str = (M4OSA_strStruct*)M4OSA_32bitAlignedMalloc(sizeof(M4OSA_strStruct), M4OSA_STRING,
(M4OSA_Char*)"M4OSA_strPrivDuplicate: output string");
/* Check memory allocation error */
@@ -372,13 +372,13 @@ M4OSA_ERR M4OSA_strPrivSetAndRepleceStr(M4OSA_strStruct* istr,
}
else
{
- buffer = (M4OSA_Char*)M4OSA_malloc(ui32_lend * sizeof(M4OSA_Char),
+ buffer = (M4OSA_Char*)M4OSA_32bitAlignedMalloc(ui32_lend * sizeof(M4OSA_Char),
M4OSA_STRING, (M4OSA_Char*)"M4OSA_strPrivSetAndRepleceStr");
M4OSA_CHECK_MALLOC(buffer, "M4OSA_strPrivSetAndRepleceStr");
M4OSA_memcpy(buffer, ibuffer + ui32_poso, ui32_lend);
M4OSA_memcpy(ibuffer + ui32_posn, buffer, ui32_lend);
- M4OSA_free((M4OSA_MemAddr32)buffer);
+ free(buffer);
}
}
/* string to replace is smaller that new string */
@@ -399,7 +399,7 @@ M4OSA_ERR M4OSA_strPrivSetAndRepleceStr(M4OSA_strStruct* istr,
ui32_size <<= 1;
}
- buffer = (M4OSA_Char*)M4OSA_malloc(ui32_size * sizeof(M4OSA_Char),
+ buffer = (M4OSA_Char*)M4OSA_32bitAlignedMalloc(ui32_size * sizeof(M4OSA_Char),
M4OSA_STRING, (M4OSA_Char*)"M4OSA_strPrivSetAndRepleceStr");
M4OSA_CHECK_MALLOC(buffer, "M4OSA_strPrivSetAndRepleceStr");
@@ -410,7 +410,7 @@ M4OSA_ERR M4OSA_strPrivSetAndRepleceStr(M4OSA_strStruct* istr,
M4OSA_memcpy(buffer + ui32_posn, ibuffer + ui32_poso, ui32_lend);
- M4OSA_free((M4OSA_MemAddr32)ibuffer);
+ free(ibuffer);
istr->pui8_buffer = buffer;
@@ -418,7 +418,7 @@ M4OSA_ERR M4OSA_strPrivSetAndRepleceStr(M4OSA_strStruct* istr,
}
else
{
- buffer = (M4OSA_Char*)M4OSA_malloc(ui32_lend * sizeof(M4OSA_Char),
+ buffer = (M4OSA_Char*)M4OSA_32bitAlignedMalloc(ui32_lend * sizeof(M4OSA_Char),
M4OSA_STRING, (M4OSA_Char*)"M4OSA_strPrivSetAndRepleceStr");
M4OSA_CHECK_MALLOC(buffer, "M4OSA_strPrivSetAndRepleceStr");
@@ -429,7 +429,7 @@ M4OSA_ERR M4OSA_strPrivSetAndRepleceStr(M4OSA_strStruct* istr,
M4OSA_memcpy(ibuffer + ui32_posn, buffer, ui32_lend);
- M4OSA_free((M4OSA_MemAddr32)buffer);
+ free(buffer);
}
}
}
@@ -574,7 +574,7 @@ M4OSA_ERR M4OSA_strPrivReplaceSmallerStr(M4OSA_strStruct* istr,
}
/* Allocate the actual M4OSA_String content */
- buffer = (M4OSA_Char*)M4OSA_malloc(istr->ui32_size * sizeof(M4OSA_Char),
+ buffer = (M4OSA_Char*)M4OSA_32bitAlignedMalloc(istr->ui32_size * sizeof(M4OSA_Char),
M4OSA_STRING, (M4OSA_Char*)"M4OSA_strPrivReplaceSmallerStr");
M4OSA_CHECK_MALLOC(buffer, "M4OSA_strPrivReplaceSmallerStr");
@@ -608,7 +608,7 @@ M4OSA_ERR M4OSA_strPrivReplaceSmallerStr(M4OSA_strStruct* istr,
M4OSA_memcpy(ptr_dest, ibuffer, size);
- M4OSA_free((M4OSA_MemAddr32)istr->pui8_buffer);
+ free(istr->pui8_buffer);
istr->ui32_length = length ;
@@ -704,7 +704,7 @@ M4OSA_ERR M4OSA_strPrivReplaceBiggerStr(M4OSA_strStruct* istr,
M4OSA_Char* dest;
/* Allocate the actual M4OSA_String content */
- patterns = (M4OSA_Int32*)M4OSA_malloc(max_pattern * sizeof(M4OSA_UInt32),
+ patterns = (M4OSA_Int32*)M4OSA_32bitAlignedMalloc(max_pattern * sizeof(M4OSA_UInt32),
M4OSA_STRING, (M4OSA_Char*)"M4OSA_strPrivReplaceBiggerStr");
M4OSA_CHECK_MALLOC(patterns, (M4OSA_Char*)"M4OSA_strPrivReplaceBiggerStr");
@@ -746,7 +746,7 @@ M4OSA_ERR M4OSA_strPrivReplaceBiggerStr(M4OSA_strStruct* istr,
}
/* Allocate the actual M4OSA_String content */
- buffer = (M4OSA_Char*)M4OSA_malloc(ui32_size * sizeof(M4OSA_Char),
+ buffer = (M4OSA_Char*)M4OSA_32bitAlignedMalloc(ui32_size * sizeof(M4OSA_Char),
M4OSA_STRING, (M4OSA_Char*)"M4OSA_strPrivReplaceBiggerStr");
M4OSA_CHECK_MALLOC(buffer, "M4OSA_strPrivReplaceBiggerStr");
@@ -775,9 +775,9 @@ M4OSA_ERR M4OSA_strPrivReplaceBiggerStr(M4OSA_strStruct* istr,
M4OSA_memcpy(dest, src, size);
- M4OSA_free((M4OSA_MemAddr32)patterns);
+ free(patterns);
- M4OSA_free((M4OSA_MemAddr32)ibuffer);
+ free(ibuffer);
istr->ui32_length = length;
@@ -975,7 +975,7 @@ M4OSA_ERR M4OSA_strPrivSPrintf(M4OSA_strStruct* str,
return M4ERR_NOT_IMPLEMENTED;
#endif
- newFormat =(M4OSA_Char*)M4OSA_malloc(newFormatLength,
+ newFormat =(M4OSA_Char*)M4OSA_32bitAlignedMalloc(newFormatLength,
M4OSA_CHARSTAR, (M4OSA_Char*)"M4OSA_chrPrintf: newFormat");
if(newFormat == M4OSA_NULL) return M4ERR_ALLOC;
newFormat[newFormatLength-1] = '\0';
@@ -1122,7 +1122,7 @@ M4OSA_ERR M4OSA_strPrivSPrintf(M4OSA_strStruct* str,
err = M4OSA_chrSPrintf(strOut,strOutMaxLen,newFormat,marker);
- M4OSA_free((M4OSA_MemAddr32)newFormat);
+ free(newFormat);
if (M4ERR_CHR_STR_OVERFLOW == err)
{
diff --git a/libvideoeditor/osal/src/M4OSA_Thread.c b/libvideoeditor/osal/src/M4OSA_Thread.c
index c17ddf4..aa7666c 100755
--- a/libvideoeditor/osal/src/M4OSA_Thread.c
+++ b/libvideoeditor/osal/src/M4OSA_Thread.c
@@ -141,7 +141,7 @@ M4OSA_ERR M4OSA_threadSyncOpen(M4OSA_Context* context,
*context = M4OSA_NULL;
threadContext =
- (M4OSA_ThreadContext*)M4OSA_malloc(sizeof(M4OSA_ThreadContext),
+ (M4OSA_ThreadContext*)M4OSA_32bitAlignedMalloc(sizeof(M4OSA_ThreadContext),
M4OSA_THREAD, (M4OSA_Char*)"M4OSA_threadSyncOpen: thread context");
if(threadContext == M4OSA_NULL)
@@ -475,10 +475,10 @@ M4OSA_ERR M4OSA_threadSyncClose(M4OSA_Context context)
if(threadContext->name != M4OSA_NULL)
{
- M4OSA_free((M4OSA_MemAddr32)threadContext->name);
+ free(threadContext->name);
}
- M4OSA_free((M4OSA_MemAddr32)threadContext);
+ free(threadContext);
return M4NO_ERROR;
}
@@ -629,7 +629,7 @@ M4OSA_ERR M4OSA_SetThreadSyncName(M4OSA_Context context,
if(threadContext->name != NULL)
{
- M4OSA_free((M4OSA_MemAddr32)threadContext->name);
+ free(threadContext->name);
threadContext->name = M4OSA_NULL;
}
@@ -638,7 +638,7 @@ M4OSA_ERR M4OSA_SetThreadSyncName(M4OSA_Context context,
nameSize = strlen((const char *)name)+1;
threadContext->name =
- (M4OSA_Char*)M4OSA_malloc(nameSize, M4OSA_THREAD,
+ (M4OSA_Char*)M4OSA_32bitAlignedMalloc(nameSize, M4OSA_THREAD,
(M4OSA_Char*)"M4OSA_SetThreadSyncName: thread name");
if(threadContext == M4OSA_NULL)
diff --git a/libvideoeditor/osal/src/M4PSW_MemoryInterface.c b/libvideoeditor/osal/src/M4PSW_MemoryInterface.c
index 3128de2..a069b9b 100755
--- a/libvideoeditor/osal/src/M4PSW_MemoryInterface.c
+++ b/libvideoeditor/osal/src/M4PSW_MemoryInterface.c
@@ -30,6 +30,46 @@
#ifndef M4VPS_ADVANCED_MEMORY_MANAGER
/**
************************************************************************
+ * @fn M4OSA_MemAddr32 M4OSA_32bitAlignedMalloc(M4OSA_UInt32 size,
+ * M4OSA_CoreID coreID,
+ * M4OSA_Char* string)
+ * @brief this function allocates a memory block (at least 32 bits aligned)
+ * @note
+ * @param size (IN): size of allocated block in bytes
+ * @param coreID (IN): identification of the caller component
+ * @param string (IN): description of the allocated block (null terminated)
+ * @return address of the allocated block, M4OSA_NULL if no memory available
+ ************************************************************************
+*/
+
+M4OSA_MemAddr32 M4OSA_32bitAlignedMalloc(M4OSA_UInt32 size,
+ M4OSA_CoreID coreID,
+ M4OSA_Char* string)
+{
+ M4OSA_MemAddr32 Address = M4OSA_NULL;
+
+ /**
+ * If size is 0, malloc on WIN OS allocates a zero-length item in
+ * the heap and returns a valid pointer to that item.
+ * On other platforms, malloc could returns an invalid pointer
+ * So, DON'T allocate memory of 0 byte */
+ if (size == 0)
+ {
+ return Address;
+ }
+
+ if (size%4 != 0)
+ {
+ size = size + 4 - (size%4);
+ }
+
+ Address = (M4OSA_MemAddr32) malloc(size);
+
+ return Address;
+}
+
+/**
+ ************************************************************************
* @fn M4OSA_MemAddr32 M4OSA_malloc(M4OSA_UInt32 size,
* M4OSA_CoreID coreID,
* M4OSA_Char* string)
@@ -83,6 +123,5 @@ M4OSA_Void M4OSA_free (M4OSA_MemAddr32 address)
{
free(address);
}
-
#endif