Example #1
0
File: hyp.c Project: abinition/hs
void gHyp_hyp_delete ( sHyp * pHyp ) 
{
  /* Description:
   *
   *	Delete the HyperScript program. 
   *
   * Arguments:
   *
   *	pHyp							[R]
   *	- pointer to sHyp program object
   *
   * Return value:
   *
   *	none
   *
   */

  /* Free the block of code */
  ReleaseMemory ( pHyp->pCode ) ; 
  
  /* Free the program */
  ReleaseMemory ( pHyp ) ; 

  return ;
}
Example #2
0
void GmJobItem::CopyItem (const GmJobItem & item)
{
	szName		= item.szName;
	szDest		= item.szDest;
	szDesc		= item.szDesc;
	szPass		= item.szPass;
	Time		= item.Time;
	SplitSize	= item.SplitSize;
	MergeTimes	= item.MergeTimes;

	DeflateType = item.DeflateType;
	EncryptType = item.EncryptType;

	for_each (vpSources.begin (), vpSources.end (), ReleaseMemory ());
	vpSources.clear ();
	for (size_t index = 0; index < item.vpSources.size (); ++index)
		AddSource (item.vpSources[index]->szPath, item.vpSources[index]->Options);

	Filter = item.Filter;
	for_each (vpPlans.begin (), vpPlans.end (), ReleaseMemory ());
	vpPlans.clear ();
	for (size_t index = 0; index < item.vpPlans.size (); ++index)
		AddPlan (*item.vpPlans[index]);

	Options = item.Options;
}
Example #3
0
CThreadPool::~CThreadPool()
{
	Destroy();
	ReleaseMemory();	
	DeleteCriticalSection(&m_csFuncList);
	DeleteCriticalSection(&m_csThreads);
}
Example #4
0
HRESULT CAviFile::AppendFrameUsual(HBITMAP hBitmap, int Count)
{
	BITMAPINFO	bmpInfo;

	bmpInfo.bmiHeader.biBitCount=0;
	bmpInfo.bmiHeader.biSize=sizeof(BITMAPINFOHEADER);

	GetDIBits(m_hAviDC,hBitmap,0,0,NULL,&bmpInfo,DIB_RGB_COLORS);

	bmpInfo.bmiHeader.biCompression=BI_RGB;

	GetDIBits(m_hAviDC,hBitmap,0,bmpInfo.bmiHeader.biHeight,m_lpBits,&bmpInfo,DIB_RGB_COLORS);

	while( Count > 0 )
	{
		if(FAILED(AVIStreamWrite(m_pAviCompressedStream,m_lSample++,1,m_lpBits,bmpInfo.bmiHeader.biSizeImage,0,NULL,NULL)))
		{
			SetErrorMessage(_T("Unable to Write Video Stream to the output Movie File"));

			ReleaseMemory();

			m_LastError = E_FAIL;
			return E_FAIL;
		}
		--Count;
	}
    return S_OK;
}
Example #5
0
BOOL CDrawGraph::Add(LPCTSTR pName, DWORD dwTime, DWORD dwValue, COLORREF rgbLine, HICON hIcon)
{
	// Use current time if not supplied
	if ( dwTime == 0 ) dwTime = GetTickCount();

	// Get the memory
	LPGRAPHELEMENTINFO pgei = (LPGRAPHELEMENTINFO)Find( pName );
	if ( pgei == NULL )
	{
		// Create new list entry
		pgei = (LPGRAPHELEMENTINFO)New( NULL, 0, pName );
		if ( pgei == NULL ) return TRUE;

	} // end if

	if ( hIcon == NULL )
	{
		pgei->type = 1;

		// Allocate memory
		if ( !AllocateMemory( pgei, m_dwGraphSize ) ) 
		{	Delete( pgei ); return FALSE; }

		// Don't overflow
		if ( pgei->validpts > pgei->pts ) pgei->validpts = pgei->pts;

		// Make some room
		if ( pgei->validpts > 0 )
			for ( DWORD i = pgei->validpts - 1; i > 0; i-- )
			{	pgei->ppts[ i ] = pgei->ppts[ i - 1 ];
				pgei->ptimes[ i ] = pgei->ptimes[ i - 1 ];
			} // end for
				
		// Save data
		pgei->ppts[ 0 ] = dwValue;
		pgei->ptimes[ 0 ] = dwTime;
		pgei->rgbline = rgbLine;

		// Increment valid point counter
		if ( pgei->validpts < pgei->pts ) pgei->validpts++;

	} // end if

	else
	{
		pgei->type = 2;

		// Don't need any point memory
		ReleaseMemory( pgei );

		// Save icon and time
		pgei->icon = hIcon;
		pgei->time = dwTime;

	} // end else


	return TRUE;
}
Example #6
0
void GmJobFilter::CopyItem (const GmJobFilter & item)
{
	for_each (vpFilters.begin (), vpFilters.end (), ReleaseMemory ());
	vpFilters.clear ();
	bExclude = item.bExclude;
	for (size_t index = 0; index < item.vpFilters.size (); ++index)
		AddFilter (item.vpFilters[index]->FileName, item.vpFilters[index]->DirName, item.vpFilters[index]->IsDir);
}
Example #7
0
void CDrawGraph::DeleteObject(void *node)
{
	LPGRAPHELEMENTINFO pgei = (LPGRAPHELEMENTINFO)node;
	if ( pgei == NULL ) return;

	ReleaseMemory( pgei );

	CHList::DeleteObject( node );
}
void AEGetLaunchTokenRequest::inflateValues(uint32_t measurementLength,const uint8_t* measurement,
        uint32_t sigstructLength,const uint8_t* sigstruct,
        uint32_t attributesLength,const uint8_t* attributes,
        uint32_t timeout)
{

    ReleaseMemory();

    CopyFields(measurementLength, measurement, sigstructLength, sigstruct, attributesLength, attributes, timeout);
}
Example #9
0
//代入演算子でコピー
rxShapeMatching& rxShapeMatching::operator=(const rxShapeMatching& copy)
{
	if(this != &copy){
		ReleaseMemory();

		Copy(copy);
	}

	return *this;
}
Example #10
0
void D3D9Texture::FreeMemory()
{
    ReleaseMemory();
    if(_SurfacePlain != NULL)
    {
        D3DValidateRelease(_SurfacePlain);
        _SurfacePlain = NULL;
    }
    _RenderTarget = false;
}
Example #11
0
bool AEGetQuoteResponse::inflateWithMessage(AEMessage* message)
{
    aesm::message::Response msg;
    msg.ParseFromArray(message->data, message->size);
    if (msg.has_getquoteres() == false)
        return false;

    ReleaseMemory();
    m_response = new aesm::message::Response::GetQuoteResponse(msg.getquoteres());
    return true;
}
Example #12
0
void
OnExit (void)
{
  ReleaseMemory ();
  ReleaseFatInfo ();
  setcbrk (SavedCBreak);

  SynchronizeLFNs ();

  CROSSCUT_NLS_CLOSE
}
Example #13
0
AEGetQuoteResponse& AEGetQuoteResponse::operator=(const AEGetQuoteResponse& other)
{
    if (this == &other)
        return *this;

    ReleaseMemory();
    if (other.m_response != NULL)
    {
        m_response = new aesm::message::Response::GetQuoteResponse(*other.m_response);
    }    return *this;
}
Example #14
0
bool AEInitQuoteResponse::inflateWithMessage(AEMessage* message)
{
    aesm::message::Response msg;
    msg.ParseFromArray(message->data, message->size);
    if (msg.has_initquoteres() == false)
        return false;

    //this is an AEGetLaunchTokenResponse
    ReleaseMemory();
    m_response = new aesm::message::Response::InitQuoteResponse(msg.initquoteres());
    return true;
}
bool AECloseSessionResponse::inflateWithMessage(AEMessage* message)
{
    aesm::message::Response msg;
    msg.ParseFromArray(message->data, message->size);
    if (msg.has_closesessionres() == false)
        return false;

    //this is an AECloseSessionResponse
    ReleaseMemory();
    m_response = new aesm::message::Response::CloseSessionResponse(msg.closesessionres());
    return true;
}
bool AESGXSwitchExtendedEpidGroupResponse::inflateWithMessage(AEMessage* message)
{
    aesm::message::Response msg;
    msg.ParseFromArray(message->data, message->size);
    if (msg.has_sgxswitchextendedepidgroupres() == false)
        return false;

    //this is an AESGXSwitchExtendedEpidGroupResponse
    ReleaseMemory();
    m_response = new aesm::message::Response::SGXSwitchExtendedEpidGroupResponse(msg.sgxswitchextendedepidgroupres());
    return true;
}
AESGXSwitchExtendedEpidGroupResponse& AESGXSwitchExtendedEpidGroupResponse::operator=(const AESGXSwitchExtendedEpidGroupResponse& other)
{
    if (this == &other)
        return *this;

    ReleaseMemory();
    if (other.m_response != NULL)
    {
        m_response = new aesm::message::Response::SGXSwitchExtendedEpidGroupResponse(*other.m_response);
    }
    return *this;
}
Example #18
0
bool AEGetPsCapResponse::inflateWithMessage(AEMessage* message)
{
    aesm::message::Response msg;
    if (!msg.ParseFromArray(message->data, message->size))
        return false;
    if (msg.has_getpscapres() == false)
        return false;

    //this is an AEGetPsCapResponse
    ReleaseMemory();
    m_response = new aesm::message::Response::GetPsCapResponse(msg.getpscapres());
    return true;
}
Example #19
0
bool CVConLine::AllocateMemory()
{
	ReleaseMemory();

	if (!(TextParts = (VConTextPart*)malloc(TextWidth*sizeof(*TextParts))))
		return false;
	if (!(TempCharFlags = (TextCharType*)malloc(TextWidth*sizeof(*TempCharFlags))))
		return false;
	if (!(TempCharWidth = (unsigned*)malloc(TextWidth*sizeof(*TempCharWidth))))
		return false;

	return true;
}
bool AEExchangeReportResponse::inflateWithMessage(AEMessage* message)
{
    aesm::message::Response msg;
    if (!msg.ParseFromArray(message->data, message->size))
        return false;
    if (msg.has_exchangereportres() == false)
        return false;

    //this is an AEExchangeReportResponse
    ReleaseMemory();
    m_response = new aesm::message::Response::ExchangeReportResponse(msg.exchangereportres());
    return true;
}
Example #21
0
HRESULT	CAviFile::AppendFrameFirstTime(int nWidth, int nHeight, LPVOID pBits,int nBitsPerPixel,int Count)
{
	if(SUCCEEDED(InitMovieCreation(nWidth, nHeight, nBitsPerPixel)))
	{
		m_nAppendFuncSelector=2;		//Point to the UsualAppend Function

		return AppendFrameUsual(nWidth, nHeight, pBits, nBitsPerPixel, Count);
	}

	ReleaseMemory();

	return E_FAIL;
}
Example #22
0
BOOL CDrawGraph::AllocateMemory(LPGRAPHELEMENTINFO pgei, DWORD size)
{
	// Sanity check
	if ( pgei == NULL ) return FALSE;

	// Want any memory?
	if ( size == 0 ) { ReleaseMemory( pgei ); return TRUE; }

	// Do we already have what they want?
	if ( pgei->pts == size && pgei->ppts != NULL && pgei->ptimes != NULL ) 
		return TRUE;

	// Save current data pointers if any
	long *data = NULL;
	DWORD *times = NULL;
	if ( pgei->ppts != NULL ) data = pgei->ppts;
	if ( pgei->ptimes != NULL ) times = pgei->ptimes;

	// Allocate memory
	pgei->ppts = new long[ size ];
	pgei->ptimes = new DWORD[ size ];

	// Ensure we got the memory
	if ( pgei->ppts == NULL || pgei->ptimes == NULL )
	{	DeleteObject( pgei ); return FALSE; }

	// Save size
	pgei->pts = size;

	// Copy old values if any
	if ( pgei->validpts > 0 )
	{
		// Bounds check size
		if ( pgei->validpts > size ) pgei->validpts = size;

		// Copy old data values
		if ( data != NULL ) memcpy( pgei->ppts, data, pgei->validpts );		

		// Copy old time values
		if ( times != NULL ) memcpy( pgei->ptimes, times, pgei->validpts );
		
	} // end if

	// Delete pointer / init memory
	if ( data != NULL ) delete [] data;

	// Delete pointer / init memory
	if ( times != NULL ) delete [] times;

	return TRUE;
}
Example #23
0
HRESULT	CAviFile::AppendFrameUsual(int nWidth, int nHeight, LPVOID pBits, WORD nBitsPerPixel)
{
	DWORD dwSize = nWidth * nHeight * nBitsPerPixel / 8;

	if (FAILED(AVIStreamWrite(m_pAviCompressedStream, m_lVSample++, 1, pBits, dwSize, 0, NULL, NULL))) 
	{
		SetErrorMessage(_T("Unable to Write Video Stream to the output Movie File"));

		ReleaseMemory();

		return E_FAIL;
	}

	return S_OK;
}
void CClientThread::operator()(void)
{
#ifdef _WIN32
#ifdef BACKGROUND_PRIORITY
	SetThreadPriority( GetCurrentThread(), THREAD_PRIORITY_LOWEST);
#ifdef THREAD_MODE_BACKGROUND_BEGIN
	SetThreadPriority( GetCurrentThread(), THREAD_MODE_BACKGROUND_BEGIN);
#endif

#endif // BACKGROUND_PRIORITY
#endif // _WIN32

#ifdef HIGH_PRIORITY
	SetThreadPriority( GetCurrentThread(), THREAD_PRIORITY_ABOVE_NORMAL);
#endif

	while( RecvMessage()==true && stopped==false )
	{
	}
	ReleaseMemory();

	if( hFile!=0 )
	{
		CloseHandle( hFile );
		hFile=0;
	}

	if(chunk_send_thread_ticket!=ILLEGAL_THREADPOOL_TICKET)
	{
		{
			IScopedLock lock(mutex);
			state=CS_NONE;
			while(!next_chunks.empty())
				next_chunks.pop();
			if(update_file!=NULL)
			{
				Server->destroy(update_file);
				update_file=NULL;
			}
			cond->notify_all();
		}
		Server->getThreadPool()->waitFor(chunk_send_thread_ticket);
	}

	killable=true;
}
Example #25
0
HRESULT CAviFile::AppendFrameUsual( CDIBSection *pDIBSection, int Count )
{
	while( Count > 0 )
	{
		if(FAILED(AVIStreamWrite(m_pAviCompressedStream,m_lSample++,1,pDIBSection->m_pBits,pDIBSection->m_bmpInfo.bmiHeader.biSizeImage,0,NULL,NULL)))
		{
			SetErrorMessage(_T("Unable to Write Video Stream to the output Movie File"));

			ReleaseMemory();

			m_LastError = E_FAIL;
			return E_FAIL;
		}
		--Count;
	}

    return S_OK;
}
Example #26
0
HRESULT	CAviFile::AppendFrameFirstTime( CDIBSection *pDIBSection, int Count )
{
	BITMAP Bitmap;

	GetObject( pDIBSection->m_Bitmap, sizeof(BITMAP), &Bitmap);

	if(SUCCEEDED(InitMovieCreation( Bitmap.bmWidth,
									Bitmap.bmHeight,
									Bitmap.bmBitsPixel)))
	{
		m_nAppendFuncSelector=2;		//Point to the UsualAppend Function

		return AppendFrameUsual( pDIBSection, Count );
	}

	ReleaseMemory();

	return E_FAIL;
}
Example #27
0
/* Description	: Use this method to destory the thread pool. The destructor of
				  this class will destory the pool anyway. Make sure you 
				  this method before calling a Create() when an existing pool is 
				  already existing.
   Returns		: void
  *****************************************************************************/
void CThreadPool::Destroy()
{
	if(m_state == Destroying || m_state == Destroyed)
		return;
	
	// Set the state to 'destroying'. Pooled functions might be checking this 
	// state to see if they need to stop.
	m_state = Destroying;
		
	// tell all threads to shutdown.
	SetEvent(m_hNotifyShutdown);

	Sleep(2000); // give the threads a chance to complete

	if(GetWorkingThreadCount() > 0)
	{
		// There are still threads in processing mode..
		// lets give the thread one last chance to finish based on configured setting
		Sleep(m_nWaitForThreadsToDieMS);
	}
	
	ThreadMap::iterator iter;
	_ThreadData ThreadData;
	
	// walk through the events and threads and close them all
	for(iter = m_threads.begin(); iter != m_threads.end(); iter++)
	{
		CloseHandle(iter->second.WaitHandle);
		CloseHandle(iter->second.hThread);
	}

	// close the shutdown event
	CloseHandle(m_hNotifyShutdown);
	m_hNotifyShutdown = NULL;

	ReleaseMemory(); // free any remaining UserPoolData objects 

	InterlockedDecrement(&CThreadPool::m_lInstance);

	m_state = Destroyed;
}
Example #28
0
void ReadJobs ()
{
	bool bError = false;
	wxString message;
	try {
		vector<GmJobItem*> & jobs = ctx.Jobs;
		for_each (jobs.begin (), jobs.end (), ReleaseMemory ());
		jobs.clear ();
		GetJobsFromJobFile (GetJobContainerFile (), jobs);
	}
	catch (GmException &e) {
		message = wxString::Format (_T("Schedule %s job error, error is %s")
									, GimuDaemonService
									, e.GetMessage ().c_str ());
		bError = true;
	}
	catch (...) {
		message = wxString::Format (_T("Schedule %s job unknown error!"), GimuDaemonService);
		bError = true;
	}

	if (bError) {
		HANDLE es = RegisterEventSource (NULL, GimuDaemonService);
		if (NULL != es) {
			LPCTSTR lpszStrings[2];
			lpszStrings[0] = GimuDaemonService;
			lpszStrings[0] = message.c_str ();
			ReportEvent(es,					 // event log handle
						EVENTLOG_ERROR_TYPE, // event type
						0,                   // event category
						0,			         // event identifier
						NULL,                // no security identifier
						2,                   // size of lpszStrings array
						0,                   // no binary data
						lpszStrings,         // array of strings
						NULL);               // no binary data
			DeregisterEventSource (es);
		}
	}
}
Example #29
0
int AddTextureClass::InheriteMemory(AddTextureClass &tex)
{
  if (!tex.OwnMemory)
  {
    if (SetSize(tex.Len)) return -1;
    for (unsigned int i=0u; i<tex.Len; i++) Hash[i] = tex.Hash[i];
    for (unsigned int i=0u; i<tex.Len; i++) WasAdded[i] = tex.WasAdded[i];
    for (unsigned int i=0u; i<tex.Len; i++) Size[i] = tex.Size[i];
    for (unsigned int i=0u; i<tex.Num; i++) if (tex.Textures[i]!=NULL && tex.Size[i]>0)
    {
      if (GetMemory( Textures[i], tex.Size[i])) return -1;
      for (unsigned int j=0u; j<tex.Size[i]; j++) Textures[i][j] = tex.Textures[i][j];
      Size[i] =  tex.Size[i];
    }
    Len = tex.Len;
    Num = tex.Num;
  }
  else
  {
    ReleaseMemory();
    Hash = tex.Hash;
    WasAdded = tex.WasAdded;
    Size = tex.Size;
    Textures = tex.Textures;
    Len = tex.Len;
    Num = tex.Num;
    OwnMemory = true;
    tex.OwnMemory = false;
  }
  Add = tex.Add;
  Force = tex.Force;
  Loaded = tex.Loaded;

  File = tex.File;
  Comment = tex.Comment;
  return 0;
}
Example #30
0
VOID
CleanupAsyncList(PEHCI_HOST_CONTROLLER hcd)
{
    PQUEUE_TRANSFER_DESCRIPTOR Descriptor;
    PQUEUE_HEAD QueueHead;
    KIRQL OldIrql;

    KeAcquireSpinLock(&hcd->Lock, &OldIrql);

    QueueHead = hcd->CompletedListQueue;
    QueueHead = QueueHead->NextQueueHead;

    while (QueueHead != hcd->CompletedListQueue)
    {
        Descriptor = QueueHead->FirstTransferDescriptor;
        while (Descriptor)
        {
            if (Descriptor->Token.Bits.PIDCode == PID_CODE_SETUP_TOKEN)
                ReleaseMemory(hcd, Descriptor->BufferPointerVA[0]);
            FreeDescriptor(hcd, Descriptor);
            Descriptor = Descriptor->NextDescriptor;
        }

        if (QueueHead->FreeMdl)
        {
            DPRINT("Freeing Mdl %x, StartVA %x\n", QueueHead->Mdl, QueueHead->Mdl->StartVa);
            IoFreeMdl(QueueHead->Mdl);
        }
        
        QueueHead = QueueHead->NextQueueHead;
    }
    
    hcd->CompletedListQueue->NextQueueHead = hcd->CompletedListQueue;
    hcd->CompletedListQueue->PreviousQueueHead = hcd->CompletedListQueue;
    
    KeReleaseSpinLock(&hcd->Lock, OldIrql);
}