static void Close(vlc_object_t *object) { vout_display_t *vd = (vout_display_t *)object; Clean(vd); CommonClean(vd); free(vd->sys); }
/***************************************************************************** * CloseFilter: clean up the filter *****************************************************************************/ static void CloseScaler( vlc_object_t *p_this ) { filter_t *p_filter = (filter_t*)p_this; filter_sys_t *p_sys = p_filter->p_sys; Clean( p_filter ); if( p_sys->p_src_filter ) sws_freeFilter( p_sys->p_src_filter ); free( p_sys ); }
bool trpgPageManager::LodPageInfo::Init(trpgr_Archive *archive, int myLod, double scale, int freeListDivider) { Clean(); lod = myLod; // In theory we could have a negative scale, but I don't // really want to deal with that. if (scale < 0) scale = 0.0; tileTable = archive->GetTileTable(); // Need some size and shape info about our terrain LOD const trpgHeader *head = archive->GetHeader(); head->GetTileSize(lod,cellSize); head->GetLodRange(lod,pageDist); head->GetLodSize(lod,lodSize); pageDist *= scale; head->GetVersion(majorVersion, minorVersion); // Area of interest size (in cells) aoiSize.x = (int)(pageDist/cellSize.x); aoiSize.y = (int)(pageDist/cellSize.y); /* Make a guess as to how many tiles we might have loaded in at any given time. Give ourselves 15% extra room. From the area of interest in cells, we can guess the max number of tiles (aka cells) we'll have loaded in at once. Note that the AOI size is only ahead, so it must be doubled. Version 2.1 now support variable lods, it might be overkill to allocate a free list by supposing that the tiles exist. So only for version 2.1 an over we will use the divider to allocate less */ maxNumTiles = (int)(1.15*(2*aoiSize.x+1)*(2*aoiSize.y+1)); if(majorVersion == 2 && minorVersion >= 1) maxNumTiles = (int)(1.15*(2*aoiSize.x+1)*(2*aoiSize.y+1)/freeListDivider); else maxNumTiles = (int)(1.15*(2*aoiSize.x+1)*(2*aoiSize.y+1)); // Allocate 'em for (int i=0;i<maxNumTiles;i++) { trpgManagedTile *tile = new trpgManagedTile(); freeList.push_back(tile); } // We still don't have a position yet valid = true; return true; }
void CDVDPlayerResampler::CheckResampleBuffers(int channels) { int error; if (channels != m_nrchannels) { Clean(); m_nrchannels = channels; m_converter = src_new(m_quality, m_nrchannels, &error); } }
// Create the generator polynomial g(x). // g(x)=(x-a)(x-a^2)(x-a^3)..(x-a^N) void RSCoder::pnInit() { int p2[MAXPAR + 1]; // Currently calculated part of g(x). Clean(p2, ParSize); p2[0] = 1; // Set p2 polynomial to 1. for (int I = 1; I <= ParSize; I++) { int p1[MAXPAR + 1]; // We use p1 as current (x+a^i) expression. Clean(p1, ParSize); p1[0] = gfExp[I]; p1[1] = 1; // Set p1 polynomial to x+a^i. // Multiply the already calucated part of g(x) to next (x+a^i). pnMult(p1, p2, GXPol); // p2=g(x). for (int J = 0; J < ParSize; J++) p2[J] = GXPol[J]; } }
OpenSSL_Mgr::~OpenSSL_Mgr(void) { try { Clean(); } catch(...) { } }//lint !e1579
void SchdFcfs(Record* rd) { Clean(); Record* cur = rd; while (cur->next != NULL) { cur = cur->next; if (IsAvailable(cur)) { Book(cur); cur->accept = 1; } else cur->accept = 0; } }
CRoseArray( CARRAY_SIZE arrsize ) { this->arr = NULL; this->arraysize = 0; this->arr = new T[arrsize]; if( this->arr != NULL ) { this->arraysize = arrsize; Clean( ); } }
BOOL CDrawGraph::Tick(DWORD dwTick) { // Save tick count if ( dwTick == 0 ) m_dwTime = GetTickCount(); else m_dwTime = dwTick; // Clean up the list Clean(); return TRUE; }
CNEOPopBuffer::CNEOPopBuffer(char *szBuffer, //缓冲区指针 int nBufferSize, //缓冲区尺寸 bool bInitFlag) //是否初始化标志 { m_pHead=NULL; m_pBuffer=NULL; m_nBufferSize=nBufferSize; Set(szBuffer,nBufferSize); if(bInitFlag)//需要初始化 Clean();//则清空队列 }
bool Application::LoadData(Utils::Image* imgSet[], int imageCount, bool isTraining) { char resource[33]; int currentIndex = 0; for (int x = 0; x < Utils::SUBJECT_COUNT; x++) { for (int y = 0; y < imageCount; y++) { char letter = x + Utils::CHAR_OFFSET; if (isTraining) std::sprintf(&resource[0], Utils::RESOURCE_STRING, letter, y); else std::sprintf(&resource[0], Utils::RESOURCE_STRING, letter, y + Utils::TRAINING_IMAGES_PER_SUBJECT); currentIndex = (x * imageCount) + y; imgSet[currentIndex] = Utils::LoadImage(resource); if (!imgSet[currentIndex]) { printf(Utils::ERROR_BEGIN); printf(Utils::ERROR_PROBLEM_LOADING); Clean(); return false; } if (imgSet[currentIndex]->height != Utils::IMAGE_HEIGHT && imgSet[currentIndex]->width != Utils::IMAGE_WIDTH) { printf(Utils::ERROR_BEGIN); printf(Utils::ERROR_WRONG_DIMENSIONS); Clean(); return false; } if (imgSet[currentIndex]->colorFormat != PNG_COLOR_TYPE_GRAY) { printf(Utils::ERROR_BEGIN); printf(Utils::ERROR_WRONG_FORMAT); Clean(); return false; } } } return true; }
void KVReader2::Clean(KeyValue* pData) { // Recursively delete node KeyValue* cur = pData; while(cur!=0) { Clean(cur->child); KeyValue* tmp = cur->sibling; delete cur; cur = tmp; } }
qPBReaderEpub::~qPBReaderEpub() { TRSCOPE(epub, "qPBReaderEpub::~qPBReaderEpub"); Clean(); if (_pCurrentOpf) { delete _pCurrentOpf; _pCurrentOpf = 0; } }
// ----------------------------------------------------------------------------- // CPhCltBaseImageParams::operator= // // Assignment operator. // ----------------------------------------------------------------------------- // CPhCltBaseImageParams& CPhCltBaseImageParams:: operator=( const CPhCltBaseImageParams& aParamClass ) { Clean(); this->iImages().iType = aParamClass.iImages().iType; this->iImages().iImageCount = aParamClass.iImages().iImageCount; for ( TInt i = 0; i < KPhCltImagesArrayLen; i++ ) { iImages().iImages[ i ] = aParamClass.iImages().iImages[ i ]; } return *this; }
// setup void MemoryPool::Setup(size_t aSize, size_t aStart, size_t aGrow, size_t aAlign) { // invalidate the pool Clean(); // update properties // (and ensure a block is large enough to hold a freelist node) mSize = std::max(sizeof(void *), (aSize + aAlign - 1) & ~(aAlign - 1)); mStart = aStart; mGrow = aGrow; mAlign = aAlign; }
KLString& KLString::operator= (KLString&& String) { Clean(); Data = String.Data; Capacity = String.Capacity; String.Data = nullptr; return *this; }
void AStar::Run() { CreateGraph(); CreateGraphAdjs(); ComputeGraphHeuristics(); Search(); Clean(); }
mSimpleDrawer::mSimpleDrawer(QWidget *parent): QWidget(parent), xMax(10), xMin(-10), yMax(10), yMin(-10) { label = new QLabel(this); label->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); label->resize(size()); pixMap = new QPixmap(this->size()); Clean(); }
//------------------------------------------------------ // The processing drive // it does not include collecting SoundEnergy, but contains all other steps to extract Rhythmic at run time //------------------------------------------------------ void RhythmicExtract::RhythmicProcessingDrive(){ SoundEnergyLowPassFilter(); //produce raw low passed curve if(lowPassedSoundEnergy.size() > 0){ //float check to make sure the size is non-zero SoundEnergyStatisticAnalysis(); //produce average, variance and standard deviation in 3 levels SoundEnergyBeatFirstExtraction(); SoundEnergyBeatSecondExtraction(); //SoundEnergyIterativePeriodicMatch(); Clean(); } }
bool BitmapFont::LoadBitmap(const std::string& filename) { Clean(); if(m_texture == nullptr) { m_texture = new Texture(); m_texture->LoadFromFile(filename); } return true; }
bool SockSpray::HandleBind(SockPoller *binder) { bool result = false; #if defined(LNE_WIN32) DWORD bytes; unsigned long value = 1; GUID guid = WSAID_DISCONNECTEX; if(WSAIoctl(skpad_.socket(), SIO_GET_EXTENSION_FUNCTION_POINTER, &guid, sizeof(guid), &iocp_data_.disconnectex, sizeof(iocp_data_.disconnectex), &bytes, NULL, NULL) == 0 && ioctlsocket(skpad_.socket(), FIONBIO, &value) == 0) { #else int flags = fcntl(skpad_.socket(), F_GETFL); if(flags >= 0 && fcntl(skpad_.socket(), F_SETFL, flags | O_NONBLOCK) == 0) { #endif set_poller(binder); #if defined(LNE_WIN32) if(CreateIoCompletionPort(reinterpret_cast<HANDLE>(skpad_.socket()), poller()->Handle(), static_cast<ULONG_PTR>(skpad_.socket()), 0) != NULL) { iocp_lock_.Lock(); DWORD bytes, flags = 0; int rc = WSARecv(skpad_.socket(), &iocp_data_.buffer, 1, &bytes, &flags, &iocp_data_.overlap[IOCP_READ], NULL); if(rc != SOCKET_ERROR || WSAGetLastError() == ERROR_IO_PENDING) { ++iocp_data_.count; result = true; } iocp_lock_.Unlock(); } #elif defined(LNE_LINUX) if(epoll_ctl(poller()->Handle(), EPOLL_CTL_ADD, skpad_.socket(), &epoll_data_) == 0) result = true; #elif defined(LNE_FREEBSD) struct kevent kev[2]; EV_SET(&kev[0], skpad_.socket(), EVFILT_READ, EV_ADD | EV_DISABLE | EV_CLEAR, 0, 0, static_cast<SockEventer *>(this)); EV_SET(&kev[1], skpad_.socket(), EVFILT_WRITE, EV_ADD | EV_DISABLE | EV_CLEAR, 0, 0, static_cast<SockEventer *>(this)); if(kevent(poller()->Handle(), kev, 2, NULL, 0, NULL) == 0) { kevent_data_.num_eof = 1; EV_SET(&kev[0], skpad_.socket(), EVFILT_READ, EV_ENABLE, 0, 0, static_cast<SockEventer *>(this)); EV_SET(&kev[1], skpad_.socket(), EVFILT_WRITE, EV_ENABLE, 0, 0, static_cast<SockEventer *>(this)); kevent(poller()->Handle(), kev, 2, NULL, 0, NULL); result = true; } #endif } if(!result) Clean(); return result; } void SockSpray::HandleTerminate(void) { __Shutdown(); handler_->HandleTerminate(this); Release(); }
void operator=(const Array& src) { if(this==&src)return; Clean(); _data=new T*[src.Count()]; int i; for(i=0;i<src.Count();i++) { _data[i]=new T(src[i]); } _size=src.Count(); _count=_size; }
void LuaManager::RunningFile(const char* fileName) { char* complete_path = FileTool::GetInstance()->GetCompletePath(fileName); int nRet = luaL_dofile(luaState, complete_path); if (nRet != 0) { Log::GetInstance()->Error("[LUA ERROR] %s", lua_tostring(luaState, -1)); lua_pop(luaState, 1); assert(!"运行Lua文件出现错误!"); } SAFDelete(complete_path); Clean(); }
void ByteBuffer::Compact() { if ( m_bufferCapacity > m_bufferSize ) { if ( m_secure ) Clean(m_buffer+m_bufferSize, m_bufferCapacity-m_bufferSize); m_buffer = reinterpret_cast<unsigned char*>(realloc(m_buffer, m_bufferSize)); if ( m_buffer == nullptr ) throw std::system_error(std::make_error_code(std::errc::not_enough_memory), "ByteBuffer"); m_bufferCapacity = m_bufferSize; } }
int WaveIn::Close() { //int nRet; Clean(); if(m_hWaveIn!=NULL){ m_nRet=waveInClose(m_hWaveIn); if(m_nRet!=MMSYSERR_NOERROR){ return 0; } } return 1; }
// All files must have the main function. int main(int UNUSED(argc), char **UNUSED(argv)) { Result result; hid_t file_id; InitResult(&result); file_id = CreateTestFile(); if (file_id < 0) { printf("Fail to open temporary test file: %s\n", TEST_FILE); Clean(file_id); return EXIT_FAILURE; } CheckTestResult(TestRead(file_id), &result); Clean(file_id); DisplayResult(&result); return result.status; }
void AFlareGame::UnloadGame() { FLOG("AFlareGame::UnloadGame"); if (ActiveSector) { UnloadStreamingLevel(ActiveSector->GetSimulatedSector()->GetDescription()->LevelName); ActiveSector->DestroySector(); ActiveSector = NULL; } Clean(); }
HRESULT ExchangeMigrationSetup::Setup() { try { Clean(); } catch (Zimbra::MAPI::ExchangeAdminException &ex) { dloge("Setup: Clean exception: %S",ex.Description().c_str()); } catch(...) { dloge("Setup: Unknown Clean exception"); } try { dloge("Going for CreateExchangeMailbox..."); m_exchAdmin->CreateExchangeMailBox(DEFAULT_ADMIN_MAILBOX_NAME, m_ExchangeAdminPwd.c_str(), m_ExchangeAdminName.c_str(), m_ExchangeAdminPwd.c_str()); dloge("CreateExchangeMailbox success."); } catch (Zimbra::MAPI::ExchangeAdminException &ex) { dloge("ExchangeMigrationSetup::Setup::CreateExchangeMailBox ExchangeAdminException exception: %S", ex.Description().c_str()); throw; } catch (Zimbra::MAPI::Util::MapiUtilsException &ex) { dloge("ExchangeMigrationSetup::Setup::CreateExchangeMailBox MapiUtilsException exception: %S", ex.Description().c_str()); throw; } try { m_exchAdmin->CreateProfile(DEFAULT_ADMIN_PROFILE_NAME, DEFAULT_ADMIN_MAILBOX_NAME, m_ExchangeAdminPwd.c_str()); } catch (Zimbra::MAPI::ExchangeAdminException &ex) { dloge("ExchangeMigrationSetup::Setup::CreateProfile ExchangeAdminException exception: %S", ex.Description().c_str()); throw; } catch(...) { dloge("ExchangeMigrationSetup::Setup::CreateProfile Unknown exception"); throw; } return S_OK; }
bool TimeClean(Id*& id, milliseconds_t milliDuration) { // this would delete the task in any case bool ret = true; if (!Clean(id)) { Self::Sleep(milliDuration); taskDeleteForce(id->TaskId); id->TaskId = Id::INVALID_ID; ret = false; delete id; } return ret; }
ByteBuffer::~ByteBuffer() { if ( m_buffer != nullptr ) { if ( m_secure ) Clean(m_buffer, m_bufferCapacity); free(m_buffer); } m_buffer = nullptr; m_bufferSize = 0; m_bufferCapacity = 0; }