OMX_ERRORTYPE PlatformResourceMgr::RemoveHwBuffer( OMX_PTR pVirtualAddr) { PLATFORM_DATA *pData = NULL; fsl_osal_mutex_lock(lock); pData = (PLATFORM_DATA*) SearchData(pVirtualAddr); if(pData == NULL) { fsl_osal_mutex_unlock(lock); return OMX_ErrorUndefined; } PlatformDataList->Remove(pData); FSL_FREE(pData); fsl_osal_mutex_unlock(lock); return OMX_ErrorNone; }
OMX_PTR PlatformResourceMgr::GetHwBuffer( OMX_PTR pVirtualAddr) { PLATFORM_DATA *pData = NULL; OMX_PTR ptr = NULL; fsl_osal_mutex_lock(lock); pData = (PLATFORM_DATA*) SearchData(pVirtualAddr); if(pData == NULL) { fsl_osal_mutex_unlock(lock); return NULL; } ptr = pData->pPhyiscAddr; fsl_osal_mutex_unlock(lock); return ptr; }
void main(void) { char choice; //Declare Variables int i = 0; BOOLEAN quit = FALSE; FIRST = NULL; //Initialize variables LAST = NULL; for(i = 0; i < 256; i++) InitializeRec(&array[i]); filename[0] = '\0'; i = 0; do //menu open until quit = TRUE { choice = DisplayMainMenu(); //Display Main Menu and Get Main Menu Choice switch(choice) //Menu swithc { case 'o': OpenData(); break; case 'a': AddRec(); break; case 's': SearchData(); break; case 'b': BrowseData(); break; case 'd': printf("\nDelete Record\n"); break; case 'c': CloseData(); break; case 'q': quit = QuitProgram(); break; default: printf("\nError\nPlease enter a valid response.\n"); break; } }while(!quit); return; //Exit the program. }
void TestSingleLink() { Node* head = CreateSingleLink(0); PrintSingleLink(head); int len = GetSingleLinkLength(head); cout << "the list's length is: " << len << endl; Node* psearch = SearchPosition(head, 0); if (psearch) { cout << "The pos 0 node in the list, the data is: " << psearch->data << endl; } psearch = SearchPosition(head, 1); if (psearch) { cout << "The pos 1 node in the list, the data is: " << psearch->data << endl; } psearch = SearchData(head, 1); if (psearch) { cout << "The data 1 exists in the list, the data is: " << psearch->data << endl; } InsertNode(head, 0, 1); cout << "after InsertNode 1, the list is: " << endl; PrintSingleLink(head); head = DeleteNode(head, 0); cout << "after DeleteNode 0, the list is: " << endl; PrintSingleLink(head); cout << endl; // avoid memory leak DestroySingleLink(head); head = CreateSingleLink(10); PrintSingleLink(head); len = GetSingleLinkLength(head); cout << "the list's length is: " << len << endl; psearch = SearchPosition(head, 10); if (psearch) { cout << "The pos 10 node in the list, the data is: " << psearch->data << endl; } psearch = SearchData(head, 9); if (psearch) { cout << "The data 9 exists in the list, the data is: " << psearch->data << endl; } InsertNode(head, 5, 55); cout << "after InsertNode 55, the list is: " << endl; PrintSingleLink(head); head = DeleteNode(head, 11); cout << "after DeleteNode 11, the list is: " << endl; PrintSingleLink(head); head = DeleteNode(head, 6); cout << "after DeleteNode 6, the list is: " << endl; PrintSingleLink(head); head = DeleteNode(head, 0); cout << "after DeleteNode 0, the list is: " << endl; PrintSingleLink(head); cout << endl; // avoid memory leak DestroySingleLink(head); }