Fix for issue 4133431 "Remove OSAL layer" in JNI part"

Fix for issue 4133431

Change-Id: I5879b740e7104abca7f4e1e831629997a6eec781
diff --git a/media/jni/mediaeditor/VideoEditorJava.cpp b/media/jni/mediaeditor/VideoEditorJava.cpp
index 884256a..13f6350 100755
--- a/media/jni/mediaeditor/VideoEditorJava.cpp
+++ b/media/jni/mediaeditor/VideoEditorJava.cpp
@@ -339,7 +339,7 @@
             {
                 // Determine the length of the path
                 // (add one extra character for the zero terminator).
-                length = M4OSA_chrLength(pLocal) + 1;
+                length = strlen((const char *)pLocal) + 1;
 
                 // Allocate memory for the string.
                 pString = videoEditOsal_alloc(pResult, pEnv, length, "String");
diff --git a/media/jni/mediaeditor/VideoEditorMain.cpp b/media/jni/mediaeditor/VideoEditorMain.cpp
index 11e2a5e..47b334f 100755
--- a/media/jni/mediaeditor/VideoEditorMain.cpp
+++ b/media/jni/mediaeditor/VideoEditorMain.cpp
@@ -780,7 +780,7 @@
         {
             M4OSA_Context fileContext;
             M4OSA_Char* fileName = (M4OSA_Char*)"/mnt/sdcard/FirstRGB565.raw";
-            M4OSA_fileExtraDelete((const M4OSA_Char *)fileName);
+            remove((const char *)fileName);
             M4OSA_fileWriteOpen(&fileContext, (M4OSA_Void*) fileName,\
                 M4OSA_kFileWrite|M4OSA_kFileCreate);
             M4OSA_fileWriteData(fileContext, (M4OSA_MemAddr8) pixelArray,
@@ -826,7 +826,7 @@
         {
             M4OSA_Context fileContext;
             M4OSA_Char* fileName = (M4OSA_Char*)"/mnt/sdcard/ConvertedYuv.yuv";
-            M4OSA_fileExtraDelete((const M4OSA_Char *)fileName);
+            remove((const char *)fileName);
             M4OSA_fileWriteOpen(&fileContext, (M4OSA_Void*) fileName,\
                 M4OSA_kFileWrite|M4OSA_kFileCreate);
             M4OSA_fileWriteData(fileContext,
@@ -1188,19 +1188,19 @@
 
     // generate the path for temp 3gp output file
     pTemp3gpFilePath = (M4OSA_Char*) M4OSA_malloc (
-        (M4OSA_chrLength((M4OSA_Char*)pContext->initParams.pTempPath)
-        + M4OSA_chrLength ((M4OSA_Char*)TEMP_MCS_OUT_FILE_PATH)) + 1 /* for null termination */ , 0x0,
-        (M4OSA_Char*) "Malloc for temp 3gp file");
-    if ( pTemp3gpFilePath != M4OSA_NULL )
+        (strlen((const char*)pContext->initParams.pTempPath)
+        + strlen((const char*)TEMP_MCS_OUT_FILE_PATH)) + 1 /* for null termination */ , 0x0,
+        (M4OSA_Char*)"Malloc for temp 3gp file");
+    if (pTemp3gpFilePath != M4OSA_NULL)
     {
         M4OSA_memset(pTemp3gpFilePath  ,
-            M4OSA_chrLength((M4OSA_Char*)pContext->initParams.pTempPath)
-            + M4OSA_chrLength((M4OSA_Char*)TEMP_MCS_OUT_FILE_PATH) + 1, 0);
-        M4OSA_chrNCat ( (M4OSA_Char*)pTemp3gpFilePath,
-            (M4OSA_Char*)pContext->initParams.pTempPath  ,
-            M4OSA_chrLength ((M4OSA_Char*)pContext->initParams.pTempPath));
-        M4OSA_chrNCat ( pTemp3gpFilePath , (M4OSA_Char*)TEMP_MCS_OUT_FILE_PATH,
-            M4OSA_chrLength ((M4OSA_Char*)TEMP_MCS_OUT_FILE_PATH));
+            strlen((const char*)pContext->initParams.pTempPath)
+            + strlen((const char*)TEMP_MCS_OUT_FILE_PATH) + 1,0);
+        strncat((char *)pTemp3gpFilePath,
+            (const char *)pContext->initParams.pTempPath  ,
+            (size_t) ((M4OSA_Char*)pContext->initParams.pTempPath));
+        strncat((char *)pTemp3gpFilePath , (const char *)TEMP_MCS_OUT_FILE_PATH,
+            (size_t)strlen ((const char*)TEMP_MCS_OUT_FILE_PATH));
     }
     else {
          M4MCS_abort(mcsContext);
@@ -1219,7 +1219,7 @@
     pInputFileType = (M4VIDEOEDITING_FileType)pContext->mAudioSettings->fileType;
 
     VIDEOEDIT_LOG_API(ANDROID_LOG_INFO, "VIDEO_EDITOR", "TEMP_MCS_OUT_FILE_PATH len %d",
-        M4OSA_chrLength ((M4OSA_Char*)TEMP_MCS_OUT_FILE_PATH));
+        strlen ((const char*)TEMP_MCS_OUT_FILE_PATH));
     VIDEOEDIT_LOG_API(ANDROID_LOG_INFO, "VIDEO_EDITOR", "pTemp3gpFilePath %s",
         pOutputFile);
 
@@ -1395,7 +1395,7 @@
         (M4NO_ERROR != result), result);
 
     //pContext->mAudioSettings->pFile = pOutputParams->pOutputPCMfile;
-    M4OSA_fileExtraDelete((const M4OSA_Char *) pTemp3gpFilePath);
+    remove((const char *) pTemp3gpFilePath);
     VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR", "videoEditor_generateAudio() EXIT ");
 
     if (pTemp3gpFilePath != M4OSA_NULL) {
@@ -2237,7 +2237,7 @@
     // Determine the length of the input buffer.
     if (M4OSA_NULL != pBufferIn)
     {
-        length = M4OSA_chrLength((M4OSA_Char *)pBufferIn);
+        length = strlen((const char *)pBufferIn);
     }
 
     // Check if the output buffer is large enough to hold the input buffer.
@@ -2282,7 +2282,7 @@
     // Determine the length of the input buffer.
     if (M4OSA_NULL != pBufferIn)
     {
-        length = M4OSA_chrLength((M4OSA_Char *)pBufferIn);
+        length = strlen((const char *)pBufferIn);
     }
 
     // Check if the output buffer is large enough to hold the input buffer.
@@ -2498,13 +2498,14 @@
                 (M4OSA_Char *)videoEditJava_getString(&initialized, pEnv, tempPath,
                 NULL, M4OSA_NULL);
             pContext->initParams.pTempPath = (M4OSA_Char *)
-                 M4OSA_malloc(M4OSA_chrLength(tmpString) + 1, 0x0,
+                 M4OSA_malloc(strlen((const char *)tmpString) + 1, 0x0,
                                                  (M4OSA_Char *)"tempPath");
             //initialize the first char. so that strcat works.
             M4OSA_Char *ptmpChar = (M4OSA_Char*)pContext->initParams.pTempPath;
             ptmpChar[0] = 0x00;
-            M4OSA_chrNCat((M4OSA_Char*)pContext->initParams.pTempPath, tmpString, M4OSA_chrLength(tmpString));
-            M4OSA_chrNCat((M4OSA_Char*)pContext->initParams.pTempPath, (M4OSA_Char*)"/", 1);
+            strncat((char *)pContext->initParams.pTempPath, (const char *)tmpString, 
+                (size_t)strlen((const char *)tmpString));
+            strncat((char *)pContext->initParams.pTempPath, (const char *)"/", (size_t)1);
             M4OSA_free((M4OSA_MemAddr32)tmpString);
             pContext->mIsUpdateOverlay = false;
             pContext->mOverlayFileName = NULL;
diff --git a/media/jni/mediaeditor/VideoEditorPropertiesMain.cpp b/media/jni/mediaeditor/VideoEditorPropertiesMain.cpp
index 3b795ce..39221f3 100755
--- a/media/jni/mediaeditor/VideoEditorPropertiesMain.cpp
+++ b/media/jni/mediaeditor/VideoEditorPropertiesMain.cpp
@@ -147,8 +147,8 @@
     if (gotten)
     {
         // Retrieve the extension.
-        result = M4OSA_chrReverseFindChar(pFile, '.', &pExtension);
-        if ((M4NO_ERROR == result) && (M4OSA_NULL != pExtension))
+        pExtension = (M4OSA_Char *)strrchr((const char *)pFile, (int)'.');
+        if (M4OSA_NULL != pExtension)
         {
             // Skip the dot.
             pExtension++;
@@ -341,7 +341,7 @@
     M4OSA_UInt32 index = 0;
     M4OSA_ERR result = M4NO_ERROR;
     M4OSA_Int32 cmpResult = 0;
-    M4OSA_UInt32  extLength = M4OSA_chrLength(pExtension);
+    M4OSA_UInt32  extLength = strlen((const char *)pExtension);
 
     // Assign default
     *pFileType = VideoEditClasses_kFileType_Unsupported;
@@ -353,7 +353,7 @@
         // Convert the extension to lowercase.
         for (index = 0; index < extLength ; index++)
         {
-            extension[index] = M4OSA_chrToLower(pExtension[index]);
+            extension[index] = tolower((int)pExtension[index]);
         }
 
         // Check if the extension is ".mp3".
@@ -539,7 +539,7 @@
                      M4OSA_Char* pStrIn2,
                       M4OSA_Int32* pCmpResult)
 {
-    M4OSA_chrCompare(pStrIn1, pStrIn2, pCmpResult);
+    *pCmpResult = strcmp((const char *)pStrIn1, (const char *)pStrIn2);
     return *pCmpResult;
 }