void HXRecordControl::Cleanup() { OnEndOfPackets(); for(UINT16 nStream = 0; nStream < m_PendingGetPackets.GetSize(); nStream++) { IHXPacket* pPacket = (IHXPacket*)m_PendingGetPackets.GetAt(nStream); m_PendingGetPackets.SetAt(nStream, NULL); HX_RELEASE(pPacket); } if(m_pRecordService) m_pRecordService->CloseRecordSource(m_pRecordSource); HX_RELEASE(m_pRecordService); HX_RELEASE(m_pRecordSource); HX_VECTOR_DELETE(m_pStreamInfo); #if defined(HELIX_FEATURE_RECORDCONTROL_MERGESORT) HX_DELETE(m_pMergeSorter); #endif /* #if defined(HELIX_FEATURE_RECORDCONTROL_MERGESORT) */ while(!m_PendingPutPackets.IsEmpty()) { PendingPutPacket* pPutPacket = (PendingPutPacket*)m_PendingPutPackets.RemoveHead(); HX_ASSERT(pPutPacket); HX_RELEASE(pPutPacket->pPacket); HX_DELETE(pPutPacket); } }
CAudioOutOpenwave::~CAudioOutOpenwave() { //We must assume that _Imp_Close has already been called. If not, we are //in big trouble. if ( m_wState != RA_AOS_CLOSED ) { HX_ASSERT( "Device not closed in dtor." == NULL ); } //Clean up the scheduler. HX_RELEASE( m_pScheduler ); HX_DELETE(m_pPlaybackCountCBTime); HX_RELEASE(m_pCallback); //OpDPRINTF("dtor: Freeing sample buffer, expect an exception\n"); for (int i=0; i<10; i++) HX_DELETE(m_SndBuf[i].fSampleBuffer); //OpDPRINTF("dtor: Done freeing sample buffers \n"); if (m_pSndDev) { //OpDPRINTF("dtor : before freeing the channel\n"); op_sound_unregister_callback(m_pSndDev, iodone_callback); op_sound_freechan(m_pSndDev); //OpDPRINTF("dtor : freeing the channel\n"); } HX_DELETE(m_pWriteList); // Remove all elements in the list, if any }
void HXOverlayManager::Close() { CSiteStats* pStats; CStatPoint* pPoint; while (m_ListOfSiteStats.GetCount()) { pStats = (CSiteStats*) m_ListOfSiteStats.RemoveHead(); while(pStats->samples.GetCount()) { pPoint = (CStatPoint*) pStats->samples.RemoveHead(); HX_DELETE(pPoint); } HX_DELETE(pStats); } if (m_CallbackHandle) { m_pScheduler->Remove(m_CallbackHandle); m_CallbackHandle = 0; } HX_RELEASE(m_pContext); HX_RELEASE(m_pScheduler); HX_RELEASE(m_pMutex); }
CHTTPDemux::~CHTTPDemux(void) { if (!m_bClosed) { m_proc->pc->error_handler->Report(HXLOG_DEBUG, 0, 0, "CHTTPDemux deleted before closing!", 0); } Close(HXR_FAIL); HX_DELETE(m_pSavedMessage); HX_DELETE(m_pParser); HX_RELEASE(m_pSock); }
HX_RESULT HXAudioConfiguratorAAC::ValidateDecoderConfig(UINT32 cfgType, const void* config, UINT32 nBytes) { HX_RESULT result = HXR_OK; // decode the configuration bytes into the CAudioSpecificConfig structure CAudioSpecificConfig* pASConfig = new CAudioSpecificConfig(); result = ExtractDecoderInfo(cfgType, config, nBytes, pASConfig); if(SUCCEEDED(result)) { // store Symbian-based decoder info from CAudioSpecificConfig result = StoreDecoderInfo(pASConfig); } HX_DELETE(pASConfig); if(SUCCEEDED(result)) { result = ValidateDecoderInfo(); } return result; }
void CHXIUnknownObserverManagerBase::RemoveIUnknownFromList( IUnknown* pIUnknown ) { HX_ASSERT( pIUnknown ); HXCOMPtr<IUnknown> spIUnkToRemove(pIUnknown); IUnknownObserverManagerEntry *pIUnknownObserverManagerEntry = FindIUnknownListEntry(spIUnkToRemove.Ptr()); HX_ASSERT(pIUnknownObserverManagerEntry); if (pIUnknownObserverManagerEntry) { InterlockedDecrement(&pIUnknownObserverManagerEntry->ulCount); //as usual, when our refcount gets to 0, delete the entry from the list. If //the list count goes to 0, then delete the list too. if (0 == pIUnknownObserverManagerEntry->ulCount) { LISTPOSITION thePositionToRemove = m_ListElements.Find( ( void* ) pIUnknownObserverManagerEntry ); HX_ASSERT( thePositionToRemove ); if ( thePositionToRemove ) { m_ListElements.RemoveAt( thePositionToRemove ); } HX_RELEASE( pIUnknownObserverManagerEntry->pIUnknown ); HX_DELETE( pIUnknownObserverManagerEntry ); } } }
CloakedGUIDDictEntry::~CloakedGUIDDictEntry() { HX_DELETE(_key); HX_RELEASE(_obj); _key_len = 0; // fprintf(stderr, "cgde::~cgde(%p)\n", this); }
HX_RESULT HXAudioConfiguratorAAC::SetFourCC() { HX_RESULT result = HXR_OK; // first check for EAACP codec CMMFCodec* pCodec = NULL; m_FourCC = KMMFFourCCCodeEAACP; TRAPD(exit, pCodec = CMMFCodec::NewL(m_FourCC, KMMFFourCCCodePCM16)); if(KErrNone != exit) { // fall back to AAC codec m_FourCC = KMMFFourCCCodeAAC; // undo eAAC+ settings if(m_ulOutSamplesPerSecond == (2 * m_ulSamplesPerSecond)) { m_ulOutSamplesPerSecond = m_ulSamplesPerSecond; m_uSamplesPerFrame /= 2; m_ulCodecDelayInSamples = m_uSamplesPerFrame; } } HX_DELETE(pCodec); return result; }
CHXAudioDeviceDS::~CHXAudioDeviceDS() { HX_DELETE(m_pWaveFormat); if (m_hSoundDll) { FreeLibrary(m_hSoundDll); m_hSoundDll = NULL; } if (m_hwnd) { #if defined(_WIN32) if (m_ulOriginalThreadId == GetCurrentThreadId()) { SendMessage(m_hwnd, zm_uDestroyMessage, 0, 0); } else { PostMessage(m_hwnd, zm_uDestroyMessage, 0, 0); Sleep(0); } #else SendMessage(m_hwnd, zm_uDestroyMessage, 0, 0); #endif m_hwnd = NULL; } }
void CUTServerRTPUDPTransportTestDriver::tearDown () { HX_DELETE(m_spTransport->m_pReportHandler); m_spTransport->Done(); m_spTransportResponse.Clear(); }
/* RIFFFindChunkDone is called when a FindChunk completes. * len is the length of the data in the chunk (i.e. Read(len) * would read the whole chunk) */ STDMETHODIMP CAVIIndex::RIFFFindChunkDone(HX_RESULT status, UINT32 len) { //HX_TRACE("CAVIFileFormat::CAVIIndex::RIFFFindChunkDone()\n"); HX_ASSERT(m_state == eIdx1Find); if (FAILED(status) || len == 0) { // No index; release reader: HX_DELETE(m_pReader); m_state = eReady; m_pOuter->IOEvent(); return HXR_OK; } if (m_pReader->GetChunkType() == AVI_INDEX_CHUNK) { m_state = eIdx1Descend; m_ulIndexOffset = m_pReader->GetOffset(); m_ulIndexLength = len; for (UINT16 i = 0; i < m_usStreamCount; ++i) { StreamSlice* pStream = (StreamSlice*) m_sliceArray[i]; pStream->ulSliceEndOffset = m_ulIndexOffset; } // Scan index for preroll, bitrate values: HX_ASSERT(m_scanState == eInitial); m_pReader->Descend(); } return HXR_OK; }
HXExternalResourceManager::~HXExternalResourceManager() { delete[] m_pExternalResDir; if(m_pResourceList) { CHXSimpleList::Iterator i = m_pResourceList->Begin(); for (; i != m_pResourceList->End(); ++i) { IHXXResFile* pRes = (IHXXResFile*)(*i); pRes->Close(); pRes->Release(); } } HX_DELETE(m_pResourceList); HX_RELEASE(m_pPrefs); HX_RELEASE(m_pRegistry); HX_RELEASE(m_pContext); HX_RELEASE(m_pHXXResPlugin); #if defined(HELIX_CONFIG_NOSTATICS) HXExternalResourceManager*& m_pResourceManager = (HXExternalResourceManager*&)HXGlobalPtr::Get( &HXExternalResourceManager::m_pResourceManager); #endif m_pResourceManager = NULL; }
void SymbianDLLMapImp::OnUnload(void* pDLLEntryPoint) { DLLMapInfo* pInfo = FindInfo(pDLLEntryPoint); HX_ASSERT(pInfo); if (pInfo) { if (pInfo->OnUnload()) { // This was the last unload for this DLL. // Remove it from our list and destroy the info LISTPOSITION pos = m_libList.GetHeadPosition(); while(pInfo && pos) { if (pInfo == (DLLMapInfo*)m_libList.GetAt(pos)) { m_libList.RemoveAt(pos); HX_DELETE(pInfo); } else { m_libList.GetNext(pos); } } } } }
CMacAsyncFile::~CMacAsyncFile() { if (m_DeferredTaskStruct.dtAddr != NULL) { #ifdef _CARBON DisposeDeferredTaskUPP(m_DeferredTaskStruct.dtAddr); #else DisposeRoutineDescriptor(m_DeferredTaskStruct.dtAddr); #endif m_DeferredTaskStruct.dtAddr = NULL; } Close(); HX_DELETE(mAsyncQueue); HX_DELETE(m_pPendingCallbackList); HX_DELETE(m_pTimedPQList); HX_DELETE(m_pLocationPQList); HX_DELETE(mReadQueue); #if defined(_DEBUG) && defined(LOG_MULTIPLE_DEFERRED_TASKS) HXBOOL bWaitedForDeferred = FALSE; if ( m_bDeferredTaskPending ) { bWaitedForDeferred = TRUE; DebugStr("\pCMacAsyncFile dtor -- a deferred task is pending!;g"); } #endif UINT32 timeout = TickCount() + 300L; m_bIsQuitting = TRUE; while ( m_bDeferredTaskPending && timeout - TickCount() > 0 ) { // sit-n-spin, awaiting completion of callbacks. } #if defined(_DEBUG) && defined(LOG_MULTIPLE_DEFERRED_TASKS) if ( bWaitedForDeferred ) { if ( m_bDeferredTaskPending ) { DebugStr("\pdeferred task STILL pending! This is gonna hurt;g"); } else { DebugStr( "\pDeferred tasks were successfully purged;g" ); } }
void FunctionalityTest::cleanup() { HX_DELETE(m_pBRD); HX_RELEASE(m_pSHdr); HX_RELEASE(m_pBufA); HX_RELEASE(m_pBufB); }
void GetTypeTest::cleanup() { HX_DELETE(m_pBRD); HX_RELEASE(m_pSHdr); HX_RELEASE(m_pBufA); HX_RELEASE(m_pBufB); }
STDMETHODIMP HXOverlayManager::RemoveOverlayRequest(THIS_ IHXOverlayResponse* pResp ) { m_pMutex->Lock(); HX_RESULT res = HXR_FAIL; if (pResp == m_pNewOverlaySite && m_CallbackHandle) { m_pScheduler->Remove(m_CallbackHandle); m_CallbackHandle = 0; m_pNewOverlaySite = NULL; m_pOldOverlaySite = NULL; } if (m_pCurrentOverlayOwner == pResp) { m_pCurrentOverlayOwner = NULL; } CSiteStats* pStats; CStatPoint* pPoint; LISTPOSITION pos = NULL; pos = m_ListOfSiteStats.GetHeadPosition(); while (pos) { pStats = (CSiteStats*)m_ListOfSiteStats.GetAt(pos); if (pStats->pResp == pResp) { res = HXR_OK; while(pStats->samples.GetCount()) { pPoint = (CStatPoint*) pStats->samples.RemoveHead(); HX_DELETE(pPoint); } HX_DELETE(pStats); m_ListOfSiteStats.RemoveAt(pos); break; } m_ListOfSiteStats.GetNext(pos); } m_pMutex->Unlock(); return res; }
CHXAudioDevice::~CHXAudioDevice() { Close(TRUE); m_iTimer.Close(); HX_DELETE(m_pPrioritySettings); HX_RELEASE(m_pContext); HX_RELEASE(m_pErrorMessages); }
void CHXPrefList::Clear() { while(!m_prefInfo.IsEmpty()) { CHXPrefInfo* pInfo = (CHXPrefInfo*)m_prefInfo.RemoveHead(); HX_DELETE(pInfo); } }
SockGlobals::~SockGlobals() { while (m_DNSQueue.GetCount()) { DNS_REQUEST* pDNSRequest = (DNS_REQUEST*) m_DNSQueue.RemoveHead(); HX_DELETE(pDNSRequest); } m_DNSQueue.RemoveAll(); }
HXBOOL CAsyncSockN::ProcessDNSQueue(void) { HXBOOL bResult = TRUE; DNS_REQUEST* pDNSRequest = NULL; HANDLE hAsyncHandle = NULL; int nCount = 0; if (sockGlobals.m_DNSQueue.GetCount()) { if (sockGlobals.m_bWinSock2Suck) { nCount = m_ClientHandlesMap->GetCount(); if (!nCount) { pDNSRequest = (DNS_REQUEST*)sockGlobals.m_DNSQueue.GetHead(); } else { goto cleanup; } } else { pDNSRequest = (DNS_REQUEST*)sockGlobals.m_DNSQueue.RemoveHead(); } // Start the async DNS hAsyncHandle = sockObj->HXWSAAsyncGetHostByName(m_hWnd, PWM_ASYNC_DNS, pDNSRequest->lpHostName, pDNSRequest->lpBuffer, pDNSRequest->cbBufferSize); // Create a mapping from the async handle to the win_net object pointer m_ClientHandlesMap->SetAt((void*)hAsyncHandle, pDNSRequest->fpSock); // You shouldn't already have an async operation active on this socket! HX_ASSERT(pDNSRequest->fpSock->m_hAsyncHandle == NULL); // Remember this in case we need to cancel! pDNSRequest->fpSock->m_hAsyncHandle = hAsyncHandle; // Bump our client count up IncrementHandlesClientCount(); } cleanup: if (!sockGlobals.m_bWinSock2Suck) { HX_DELETE(pDNSRequest); } return bResult; }
HXASMStream::~HXASMStream() { #ifndef GOLD HX_RELEASE(m_pEM); #endif if (m_ulLossCBHandle) { m_pScheduler->Remove(m_ulLossCBHandle); m_ulLossCBHandle = 0; } HX_RELEASE(m_pLossCB); HX_VECTOR_DELETE(m_pSubInfo); HX_VECTOR_DELETE(m_ulRuleBw); HX_VECTOR_DELETE(m_ulRulePreData); HX_VECTOR_DELETE(m_bRuleTimeStampDelivery); HX_VECTOR_DELETE(m_pRuleSubscribeStatus); HX_VECTOR_DELETE(m_pRuleEnableState); HX_RELEASE(m_pASMSource); HX_RELEASE(m_pAtomicRuleChange); HX_RELEASE(m_pSource); HX_RELEASE(m_pHeader); HX_RELEASE(m_pRegistry); HX_RELEASE(m_pScheduler); HX_RELEASE(m_pCCF); CHXMapPtrToPtr::Iterator lIterator = m_pStreamSinkMap->Begin(); for (; lIterator != m_pStreamSinkMap->End(); ++lIterator) { IHXASMStreamSink* pASMStreamSink = (IHXASMStreamSink*) *lIterator; pASMStreamSink->Release(); } m_pStreamSinkMap->RemoveAll(); HX_DELETE(m_pASMRuleState); HX_DELETE(m_pRuleBook); HX_RELEASE(m_pSubscriptionVariables); HX_DELETE(m_pStreamSinkMap); }
HXSymbianTCPSocket::~HXSymbianTCPSocket() { DPRINTF(D_TCPSOCKET, ("HXSymbianTCPSocket::~HXSymbianTCPSocket()\n")); HX_RELEASE(m_pResponse); HX_RELEASE(m_pResolver); if (m_state != tcpNotInitialized) { CloseConnection(HXR_OK); m_socket.Close(); m_socketServ.Close(); } HX_DELETE(m_pConnector); HX_DELETE(m_pWriter); HX_DELETE(m_pReader); }
SymbianDLLMapImp::~SymbianDLLMapImp() { HX_ASSERT(m_libList.IsEmpty()); while(!m_libList.IsEmpty()) { DLLMapInfo* pTmp = (DLLMapInfo*)m_libList.RemoveHead(); HX_DELETE(pTmp); } }
void CHXPrefList::Add(const char* pKey, const char* pValue) { CHXPrefInfo* pInfo = new CHXPrefInfo(pKey, pValue); if (pInfo) { if (!m_prefInfo.AddTail(pInfo)) { // We failed to insert the preference. HX_DELETE(pInfo); } } }
/* Starts enumeration process. */ CHXDirectory::FSOBJ CHXDirectory::FindFirst(const char* szPattern, char* szPath, UINT16 nSize) { FSOBJ RetVal = FSOBJ_NOTVALID; char* szMatch = NULL; char* szMatchPath = NULL; HXBOOL bDone = FALSE; struct stat statbuf; // Find the first file that matches the specified pattern HX_DELETE(m_pFileFinder); m_pFileFinder = CFindFile::CreateFindFile(m_strPath, 0, szPattern); if (!m_pFileFinder) { return RetVal; } szMatch = m_pFileFinder->FindFirst(); while (szMatch && !bDone) { szMatchPath = m_pFileFinder->GetCurFilePath(); if (lstat(szMatchPath, &statbuf) < 0) { return RetVal; } if (S_ISDIR(statbuf.st_mode) != 0 && IsValidFileDirName(szMatch)) { RetVal = FSOBJ_DIRECTORY; bDone = TRUE; } else if (IsValidFileDirName(szMatch)) { RetVal = FSOBJ_FILE; bDone = TRUE; } else { // If we couldn't use this one, find another szMatch = m_pFileFinder->FindNext(); } if (RetVal != FSOBJ_NOTVALID) { SafeStrCpy(szPath, szMatchPath, nSize); } } return RetVal; }
HX_RESULT CHXMediaPlatformKicker::Close(void) { CHXMapLongToObj::Iterator i; CHXSimpleList::Iterator j; HX_LOCK(m_pMutex); if (m_pSchedulerMap) { for (i = m_pSchedulerMap->Begin(); i != m_pSchedulerMap->End(); ++i) { CHXSimpleList* pSchedulerPerThreadList = (CHXSimpleList*) (*i); for (j = pSchedulerPerThreadList->Begin(); j != pSchedulerPerThreadList->End(); ++j) { CHXMediaPlatformScheduler* pScheduler = (CHXMediaPlatformScheduler*) (*j); pScheduler->DetachKicker(this); } HX_DELETE(pSchedulerPerThreadList); } HX_DELETE(m_pSchedulerMap); } for( i=m_SchedTimerMap.Begin() ; i!=m_SchedTimerMap.End() ; ++i ) { HXSchedulerTimer* pTmp = (HXSchedulerTimer*)(*i); HX_DELETE(pTmp); } m_bClosed = TRUE; HX_UNLOCK(m_pMutex); HX_RELEASE(m_pMutex); HX_RELEASE(m_pContext); return HXR_OK; }
void MulticastRuleChain::_clearRules() { MulticastACRule* rule = 0; // clean out all the access rules for (int i = 0; i < m_numRules; i++) { rule = m_rules[i]; if (rule) HX_DELETE(rule); } }
CSapManager::~CSapManager() { if (m_pSAPSock && m_bListenEnabled) { m_pSAPSock->LeaveMulticastGroup(SDP_MULTICAST_ADDR, HXR_INADDR_ANY); } if (0 != m_hResetCBHandle) { m_pScheduler->Remove(m_hResetCBHandle); m_hResetCBHandle = 0; } // clean up the map CHXMapLongToObj::Iterator i; for (i = m_SourceIdMap.Begin(); i != m_SourceIdMap.End(); ++i) { CHXMapLongToObj::Iterator j; CHXMapLongToObj* pMap = (CHXMapLongToObj*)(*i); for (j = pMap->Begin(); j != pMap->End(); ++j) { m_ulNumAds--; CHXPtrArray* prgAddrs = (CHXPtrArray*)(*j); ReleaseAddrs(prgAddrs); HX_DELETE(prgAddrs); // no need to remove a key. delete pMap will take care of it } delete pMap; } HX_ASSERT(0 == m_ulNumAds); HX_RELEASE(m_pStreamDesc); HX_RELEASE(m_pMulticast); HX_RELEASE(m_pSAPSock); HX_RELEASE(m_pSAPResp); HX_RELEASE(m_pContext); HX_RELEASE(m_pAddrPool); HX_RELEASE(m_pScheduler); HX_RELEASE(m_pClassFactory); }
void CHXIUnknownObserverManagerBase::RemoveAllIUnknowns( void ) { while(!m_ListElements.IsEmpty()) { IUnknownObserverManagerEntry* pIUnknownObserverManagerEntry = (IUnknownObserverManagerEntry *)m_ListElements.RemoveTail(); HX_ASSERT( pIUnknownObserverManagerEntry ); if (pIUnknownObserverManagerEntry) { HX_RELEASE( pIUnknownObserverManagerEntry->pIUnknown ); HX_DELETE( pIUnknownObserverManagerEntry ); } } }