1 /* 2 ** Copyright 2003-2010, VisualOn, Inc. 3 ** 4 ** Licensed under the Apache License, Version 2.0 (the "License"); 5 ** you may not use this file except in compliance with the License. 6 ** You may obtain a copy of the License at 7 ** 8 ** http://www.apache.org/licenses/LICENSE-2.0 9 ** 10 ** Unless required by applicable law or agreed to in writing, software 11 ** distributed under the License is distributed on an "AS IS" BASIS, 12 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 ** See the License for the specific language governing permissions and 14 ** limitations under the License. 15 */ 16 /******************************************************************************* 17 File: cmnMemory.c 18 19 Content: sample code for memory operator implementation 20 21 *******************************************************************************/ 22 #include "cmnMemory.h" 23 24 #include <stdlib.h> 25 #include <string.h> 26 27 //VO_MEM_OPERATOR g_memOP; 28 29 VO_U32 cmnMemAlloc (VO_S32 uID, VO_MEM_INFO * pMemInfo) 30 { 31 if (!pMemInfo) 32 return VO_ERR_INVALID_ARG; 33 34 pMemInfo->VBuffer = malloc (pMemInfo->Size); 35 return 0; 36 } 37 38 VO_U32 cmnMemFree (VO_S32 uID, VO_PTR pMem) 39 { 40 free (pMem); 41 return 0; 42 } 43 44 VO_U32 cmnMemSet (VO_S32 uID, VO_PTR pBuff, VO_U8 uValue, VO_U32 uSize) 45 { 46 memset (pBuff, uValue, uSize); 47 return 0; 48 } 49 50 VO_U32 cmnMemCopy (VO_S32 uID, VO_PTR pDest, VO_PTR pSource, VO_U32 uSize) 51 { 52 memcpy (pDest, pSource, uSize); 53 return 0; 54 } 55 56 VO_U32 cmnMemCheck (VO_S32 uID, VO_PTR pBuffer, VO_U32 uSize) 57 { 58 return 0; 59 } 60 61 VO_S32 cmnMemCompare (VO_S32 uID, VO_PTR pBuffer1, VO_PTR pBuffer2, VO_U32 uSize) 62 { 63 return memcmp(pBuffer1, pBuffer2, uSize); 64 } 65 66 VO_U32 cmnMemMove (VO_S32 uID, VO_PTR pDest, VO_PTR pSource, VO_U32 uSize) 67 { 68 memmove (pDest, pSource, uSize); 69 return 0; 70 } 71 72