• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ MemFree函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中MemFree函数的典型用法代码示例。如果您正苦于以下问题:C++ MemFree函数的具体用法?C++ MemFree怎么用?C++ MemFree使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了MemFree函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: ScrollString

void ScrollString( )
{
	ScrollStringStPtr pStringSt = pStringS;
	UINT32 suiTimer=0;
	UINT32 cnt;
  INT32 iNumberOfNewStrings = 0; // the count of new strings, so we can update position by WIDTH_BETWEEN_NEW_STRINGS pixels in the y
	INT32 iNumberOfMessagesOnQueue = 0;
	INT32 iMaxAge = 0;
	BOOLEAN fDitchLastMessage = FALSE;

	// UPDATE TIMER
	suiTimer=GetJA2Clock();

	// might have pop up text timer
	HandleLastQuotePopUpTimer( );

	if( guiCurrentScreen == MAP_SCREEN )
	{
		return;
	}

	// DONOT UPDATE IF WE ARE SCROLLING!
	if ( gfScrollPending || gfScrollInertia )
	{
		return;
	}

	// messages hidden
	if( fScrollMessagesHidden )
	{
		return;
	}

	iNumberOfMessagesOnQueue = GetMessageQueueSize( );
	iMaxAge =  MAX_AGE;

	if( ( iNumberOfMessagesOnQueue > 0 )&&( gpDisplayList[ MAX_LINE_COUNT - 1 ] != NULL) )
	{
		fDitchLastMessage = TRUE;
	}
	else
	{
		fDitchLastMessage = FALSE;

	}

	
	if( ( iNumberOfMessagesOnQueue * 1000 ) >= iMaxAge )
	{
		iNumberOfMessagesOnQueue = ( iMaxAge / 1000 );
	}
	else if( iNumberOfMessagesOnQueue < 0 )
	{
		iNumberOfMessagesOnQueue = 0;
	}
	
	//AGE
	for ( cnt = 0; cnt < MAX_LINE_COUNT; cnt++ )
	{
		if ( gpDisplayList[ cnt ] != NULL )
		{
			if( ( fDitchLastMessage ) && ( cnt == MAX_LINE_COUNT - 1 ) )
			{
				gpDisplayList[ cnt ]->uiTimeOfLastUpdate = iMaxAge;
			}
				// CHECK IF WE HAVE AGED
			if ( ( suiTimer - gpDisplayList[ cnt ]->uiTimeOfLastUpdate ) > ( UINT32 )( iMaxAge - ( 1000 * iNumberOfMessagesOnQueue ) ) ) 
			{
				// Remove our sorry ass
				RemoveStringVideoOverlay( gpDisplayList[ cnt ] );
				MemFree( gpDisplayList[ cnt ]->pString16);
				MemFree( gpDisplayList[ cnt ] );
			
				// Free slot
				gpDisplayList[ cnt ] = NULL;					
			}
		}
	}


	// CHECK FOR FREE SPOTS AND ADD ANY STRINGS IF WE HAVE SOME TO ADD!

	// FIRST CHECK IF WE HAVE ANY IN OUR QUEUE
	if ( pStringS != NULL )
	{
		// CHECK IF WE HAVE A SLOT!
		// CHECK OUR LAST SLOT!
		if ( gpDisplayList[ MAX_LINE_COUNT - 1 ] == NULL )
		{
			// MOVE ALL UP!
		 
		 // cpy, then move	
		 for( cnt = MAX_LINE_COUNT - 1; cnt > 0; cnt-- )
		 { 
				gpDisplayList[ cnt ] =  gpDisplayList[ cnt - 1 ];
		 }

			// now add in the new string
		 cnt = 0;
		 gpDisplayList[ cnt ] = pStringS;
//.........这里部分代码省略.........
开发者ID:bowlofstew,项目名称:ja2,代码行数:101,代码来源:message.c


示例2: UserOpen

static INT UserOpen(CHAR *userName, USERFILE *userFile)
{
    DB_CONTEXT *db;
    DWORD       result;
    MOD_CONTEXT *mod;

    ASSERT(userName != NULL);
    ASSERT(userFile != NULL);
    TRACE("userName=%s userFile=%p", userName, userFile);

    if (!DbAcquire(&db)) {
        // Return UM_DELETED instead of UM_ERROR to work around a bug in ioFTPD.
        return UM_DELETED;
    }

    // Module context is required for all file operations
    mod = MemAllocate(sizeof(MOD_CONTEXT));
    if (mod == NULL) {
        result = ERROR_NOT_ENOUGH_MEMORY;
        LOG_ERROR("Unable to allocate memory for module context.");

    } else {
        // Initialize MOD_CONTEXT structure
        mod->file            = INVALID_HANDLE_VALUE;
        userFile->lpInternal = mod;

        // Open user file
        result = FileUserOpen(userFile->Uid, userFile);
        if (result != ERROR_SUCCESS) {
            LOG_WARN("Unable to open user file for \"%s\" (error %lu).", userName, result);
        } else {

            // Read database record
            result = DbUserOpen(db, userName, userFile);
            if (result == ERROR_SUCCESS) {
                // Make sure we haven't wiped out the module context pointer
                ASSERT(userFile->lpInternal != NULL);

            } else {
                LOG_WARN("Unable to open user database record for \"%s\" (error %lu).", userName, result);

                // Clean-up user file
                FileUserClose(userFile);
            }
        }

        // Free module context if the file/database open failed
        if (result != ERROR_SUCCESS) {
            MemFree(mod);
        }
    }

    DbRelease(db);

    //
    // Return UM_DELETED instead of UM_ERROR to work around a bug in ioFTPD. If
    // UM_ERROR is returned, ioFTPD frees part of the USERFILE structure and
    // may crash later on (e.g. if someone issues "SITE USERS").
    //
    SetLastError(result);
    return (result == ERROR_SUCCESS) ? UM_SUCCESS : UM_DELETED;
}
开发者ID:MalaGaM,项目名称:nxscripts,代码行数:62,代码来源:user.c


示例3: DoRM


//.........这里部分代码省略.........
        err = FileMatchInit( &crx, wild );
        if( err != NULL )
            Die( "\"%s\": %s\n", err, wild );
    }

    k = ( int ) strlen( fpath );
    while( ( nd = readdir( d ) ) != NULL ) {
        FNameLower( nd->d_name );
        if( rxflag ) {
            if( !FileMatch( crx, nd->d_name ) )
                continue;
        } else {
            if( !FileMatchNoRx( nd->d_name, wild ) )
                continue;
        }
        /* set up file name, then try to delete it */
        l = ( int ) strlen( nd->d_name );
        bo = tmppath;
        for( i = 0; i < k; i++ )
            *bo++ = fpath[i];
        for( i = 0; i < l; i++ )
            *bo++ = nd->d_name[i];
        *bo = 0;
        if( nd->d_attr & _A_SUBDIR ) {
            /* process a directory */
            if( !IsDotOrDotDot( nd->d_name ) ) {
                if( rflag ) {
                    /* build directory list */
                    len = strlen( tmppath );
                    tmp = MemAlloc( sizeof( iolist ) + len );
                    if( dtail == NULL )
                        dhead = tmp;
                    else
                        dtail->next = tmp;
                    dtail = tmp;
                    memcpy( tmp->name, tmppath, len + 1 );
                } else {
                    PrintALineThenDrop( "%s is a directory, use -r", tmppath );
                    error_occured = 1;
                }
            }

        } else if( ( nd->d_attr & _A_RDONLY ) && !fflag ) {
            PrintALineThenDrop( "%s is read-only, use -f", tmppath );
            error_occured = 1;
        } else {
            /* build file list */
            len = strlen( tmppath );
            tmp = MemAlloc( sizeof( iolist ) + len );
            if( ftail == NULL )
                fhead = tmp;
            else
                ftail->next = tmp;
            ftail = tmp;
            memcpy( tmp->name, tmppath, len + 1 );
            tmp->attr = nd->d_attr;
        }
    }
    closedir( d );
    if( rxflag )
        FileMatchFini( crx );

    /* process any files found */
    tmp = fhead;
    if( tmp == NULL && !fflag ) {
        PrintALineThenDrop( "File (%s) not found.", f );
        error_occured = 1;
    }
    while( tmp != NULL ) {
        if( tmp->attr & _A_RDONLY )
            chmod( tmp->name, PMODE_RW );

        if( iflag ) {
            PrintALine( "Delete %s (y\\n)", tmp->name );
            while( ( i = tolower( getch() ) ) != 'y' && i != 'n' )
                ;
            DropALine();
            if( i == 'y' )
                remove( tmp->name );
        } else {
            if( !sflag )
                PrintALine( "Deleting file %s", tmp->name );
            remove( tmp->name );
        }

        ftail = tmp;
        tmp = tmp->next;
        MemFree( ftail );
    }

    /* process any directories found */
    if( rflag && ( tmp = dhead ) != NULL ) {
        while( tmp != NULL ) {
            RecursiveRM( tmp->name );
            dtail = tmp;
            tmp = tmp->next;
            MemFree( dtail );
        }
    }
}
开发者ID:NoSuchProcess,项目名称:open-watcom-v2,代码行数:101,代码来源:rm.c


示例4: ArchAddFileW

extern "C" bool ArchAddFileW(HZIP hZip,WCHAR *pstrSourceFile,WCHAR *pstrDestFile)
{
    bool r=false;
    if ((hZip) && (((ZIPCOMPRESSION *)hZip)->bHandleType == HT_COMPRESSOR) && (pstrSourceFile) && (pstrDestFile))
    {
        int lDest,lSrc;

        if (((lDest=lstrlenW(pstrDestFile)) < MAX_PATH-1) && ((lSrc=lstrlenW(pstrSourceFile)) < MAX_PATH-1))
        {
            ZIPCOMPRESSION *p=(ZIPCOMPRESSION *)hZip;
            char *file=UnicodeToOemEx(pstrDestFile,lDest);

            if (file)
            {
                void *buf=_alloc(INT_BUF_SIZE);
                if (buf)
                {
                    p->bInMem=false;
                    zip_fileinfo zi={0};
                    filetime(pstrSourceFile,&zi.tmz_date,&zi.dosDate);
                    char *lpPassword=NULL;
                    unsigned long crcFile=0;
                    if (p->bEncrypted)
                    {
                        getFileCrc(pstrSourceFile,buf,INT_BUF_SIZE,&crcFile);
                        lpPassword=p->szPassword;
                    }
                    int err=zipOpenNewFileInZip3_64(p->hZip,file,&zi,NULL,0,NULL,0,NULL,(p->dwCompLevel>0) ? Z_DEFLATED:0,p->dwCompLevel,0,-MAX_WBITS,DEF_MEM_LEVEL,Z_DEFAULT_STRATEGY,lpPassword,crcFile,0);
                    if (err == ZIP_OK)
                    {
                        HANDLE fin=CreateFileW(pstrSourceFile,GENERIC_READ,0,NULL,OPEN_EXISTING,0,NULL);
                        if (fin != INVALID_HANDLE_VALUE)
                        {
                            unsigned long size_read = 0;
                            do
                            {
                                err=ZIP_OK;
                                ReadFile(fin,buf,INT_BUF_SIZE,&size_read,0);

                                if (size_read < INT_BUF_SIZE)
                                {
                                    if (!_feof(fin))
                                        err=ZIP_ERRNO;
                                }

                                if (size_read>0)
                                    err=zipWriteInFileInZip(p->hZip,buf,size_read);
                            }
                            while ((err == ZIP_OK) && (size_read>0));
                            SysCloseHandle(fin);

                            if (err<0)
                                err=ZIP_ERRNO;
                            else
                            {
                                err=zipCloseFileInZip(p->hZip);
                                r=true;
                            }
                        }
                    }
                    MemFree(buf);
                }
            }

            MemFree(file);
        }
    }
    else
        ArchSetLastError(ARCH_INVALID_PARAMETER);
    return r;
}
开发者ID:AlexWMF,项目名称:Carberp,代码行数:71,代码来源:compress_wrap.cpp


示例5: ASSERT

ALERROR CDataFile::OpenInt (void)

//	OpenInt
//
//	Continues opening after the file or resource is open

	{
	ALERROR error;
	int i;
	bool bHeaderModified = false;
	bool bEntryTableModified = false;

	//	Read the file header

	HEADERSTRUCT header;
	if (error = ReadBuffer(0, sizeof(header), &header))
		return ERR_FILEOPEN;

	//	If the signature is not right, bail

	if (header.dwSignature != DATAFILE_SIGNATURE)
		return ERR_FILEOPEN;

	//	If the version is not right, bail

	if (header.dwVersion > DATAFILE_VERSION)
		return ERR_FILEOPEN;

	//	Store header info

	m_iBlockSize = (int)header.dwBlockSize;
	m_iBlockCount = (int)header.dwBlockCount;
	m_iDefaultEntry = (int)header.dwDefaultEntry;

	//	Allocate an entry table of the appropriate size

	ASSERT(m_pEntryTable == NULL);
	m_iEntryTableCount = (int)header.dwEntryTableCount;
	if (header.dwVersion >= 2)
		{
		int iEntryTableSize = header.dwEntryTableCount * sizeof(ENTRYSTRUCT);
		m_pEntryTable = (PENTRYSTRUCT)MemAlloc(iEntryTableSize);
		if (m_pEntryTable == NULL)
			return ERR_MEMORY;

		//	Read the entry table

		if (error = ReadBuffer(header.dwEntryTablePos, iEntryTableSize, m_pEntryTable))
			{
			MemFree(m_pEntryTable);
			m_pEntryTable = NULL;
			return ERR_FILEOPEN;
			}
		}
	else
		{
		int iEntryTableSize = header.dwEntryTableCount * sizeof(SEntryV1);
		SEntryV1 *pOldEntryTable = (SEntryV1 *)new char [iEntryTableSize];
		if (pOldEntryTable == NULL)
			return ERR_MEMORY;

		//	Read the old table

		if (error = ReadBuffer(header.dwEntryTablePos, iEntryTableSize, pOldEntryTable))
			{
			delete pOldEntryTable;
			return ERR_FILEOPEN;
			}

		//	Convert to new format

		m_pEntryTable = (PENTRYSTRUCT)MemAlloc(header.dwEntryTableCount * sizeof(ENTRYSTRUCT));
		if (m_pEntryTable == NULL)
			return ERR_MEMORY;

		for (i = 0; i < (int)header.dwEntryTableCount; i++)
			{
			m_pEntryTable[i].dwBlock = pOldEntryTable[i].dwBlock;
			m_pEntryTable[i].dwBlockCount = pOldEntryTable[i].dwBlockCount;
			m_pEntryTable[i].dwSize = pOldEntryTable[i].dwSize;
			m_pEntryTable[i].dwFlags = pOldEntryTable[i].dwFlags;

			m_pEntryTable[i].dwVersion = 1;
			m_pEntryTable[i].dwPrevEntry = (DWORD)INVALID_ENTRY;
			m_pEntryTable[i].dwLatestEntry = (DWORD)INVALID_ENTRY;
			}

		//	Done

		delete pOldEntryTable;

		//	New version

		header.dwVersion = DATAFILE_VERSION;
		bHeaderModified = true;
		bEntryTableModified = true;
		}

	//	Reset modification flags

//.........这里部分代码省略.........
开发者ID:bmer,项目名称:Alchemy,代码行数:101,代码来源:CDataFile.cpp


示例6: GFXDestroyVtxBuff

/////////////////////////////////////
// Name:	
// Purpose:	
// Output:	
// Return:	
/////////////////////////////////////
IgfxQBSP::~IgfxQBSP()
{
	u32 i;

	GFXDestroyVtxBuff(m_vtx);

	if(m_faces)
	{
		//destroy the patches
		for(i = 0; i < m_numFaces; i++)
			QBSPPatchDestroy(m_faces[i].patch);
		
		MemFree(m_faces);
	}

	if(m_textures)
	{
		//release all textures
		for(i = 0; i < m_numTxt; i++)
		{
			SAFE_RELEASE(m_textures[i].fx);
			SAFE_RELEASE(m_textures[i].texture);
		}

		MemFree(m_textures);
	}

	if(m_lightmaps)
	{
		//release all textures
		for(u32 i = 0; i < m_numLightMap; i++)
			SAFE_RELEASE(m_lightmaps[i]);

		MemFree(m_lightmaps);
	}

	if(m_nodes)
		MemFree(m_nodes);

	if(m_leaves)
	{
		MemFree(m_leaves);
	}

	if(m_leafFaces)
		MemFree(m_leafFaces);

	if(m_planes)
		MemFree(m_planes);

	if(m_clusters.pBitsets)
		MemFree(m_clusters.pBitsets);

	if(m_clustersPHS.pBitsets)
		MemFree(m_clustersPHS.pBitsets);

	SAFE_RELEASE(m_meshIndBuff);
	
	if(m_models)
	{
		for(u32 i = 1; i < m_numModels; i++)
		{
			if(m_models[i].brushes)
			{
				for(s32 j = 0; j < m_models[i].numOfBrushes; j++)
				{
					if(m_models[i].brushes[j].planes)
						MemFree(m_models[i].brushes[j].planes);

					if(m_models[i].brushes[j].tPlanes)
						MemFree(m_models[i].brushes[j].tPlanes);

					if(m_models[i].brushes[j].txtID)
						MemFree(m_models[i].brushes[j].txtID);
				}

				MemFree(m_models[i].brushes);
			}
		}

		MemFree(m_models);
	}

	if(m_brushes)
		MemFree(m_brushes);

	if(m_brushVis)
		MemFree(m_brushVis);

	if(m_leafBrushes)
		MemFree(m_leafBrushes);

	if(m_brushSides)
		MemFree(m_brushSides);
//.........这里部分代码省略.........
开发者ID:ddionisio,项目名称:Mahatta,代码行数:101,代码来源:GFX_QBSPDestroy.cpp


示例7: GetThisBioseq

static void GetThisBioseq (XOSPtr xosp)
{
  GatherScopePtr  gsp;
  CharPtr         asnseqentfile;
  Int4            gi;
  AsnIoPtr        aiop;
  Boolean         flagHaveNet;
  SeqEntryPtr     sep;

  gsp = xosp->gsp;

  aiop = NULL;
  asnseqentfile = xosp->filename;
  gi = xosp->gi;
  xosp->sep = SeqEntryFree (xosp->sep);

  if (gi > 0)
  {
    if (!EntrezInit ("twopv", FALSE, &flagHaveNet))
    {
      ErrPostEx (SEV_ERROR, TOP_ERROR, 102,
                 "Entrez init failed");
      ErrShow ();
      return;
    }
  }

  if (gi > 0)
  {
    sep = EntrezSeqEntryGet (gi, SEQENTRY_READ_BIOSEQ);
  }
  else if (asnseqentfile != NULL)
  {
    if ((aiop = AsnIoOpen (asnseqentfile, "r")) == NULL)
    {
      Message (MSG_ERROR, "Failed to open: %s", asnseqentfile);
    }
    sep = SeqEntryAsnRead (aiop, NULL);
  }
  else
  {
    sep = NULL;
  }

  if (sep == NULL)
  {
    ErrPostEx (SEV_ERROR, TOP_ERROR, 104,
               "No SeqEntry");
    ErrShow ();
  }
  else
  {
    xosp->sep = sep;
    xosp->bsp = NULL;
    xosp->gi = gi;
    GatherSeqEntry (sep, (Pointer) xosp, GetBioseq, (Pointer) gsp);
  }

  if (gi > 0)
    EntrezFini ();
  else
    AsnIoClose (aiop);

  if (xosp->bsp != NULL)
  {
    if (!ISA_na (xosp->bsp->mol))
    {
      xosp->sep = SeqEntryFree (xosp->sep);
      xosp->bsp = NULL;
      xosp->filename = (CharPtr) MemFree (xosp->filename);
      xosp->gi = 0;
      ErrPostEx (SEV_ERROR, TOP_ERROR, 101, "Not nucleic acid Bioseq");
      ErrShow ();
    }
  }
  else
  {
    xosp->sep = SeqEntryFree (xosp->sep);
    xosp->filename = (CharPtr) MemFree (xosp->filename);
    xosp->gi = 0;
    ErrPostEx (SEV_ERROR, TOP_ERROR, 101, "No Bioseq");
    ErrShow ();
  }
  return;
}
开发者ID:hsptools,项目名称:hsp-wrap,代码行数:85,代码来源:cnsrtv.c


示例8: VNCStopServer

void VNCStopServer(HVNC hVNC,DWORD dwFlags)
{
    if (!bHVNCInit)
        return;

    HVNC_HANDLE *lpHandle=VNCGetHandleInformation(hVNC);
    if (!lpHandle)
        return;

    PHVNC lpServer=lpHandle->lpServer;
    if (!lpServer)
        return;

    EnterCriticalSection(&csHVNC);
    {
        if (!lpServer->bStopped)
        {
            if (lpServer->rfbScreen)
            {
                if (!(lpServer->DeskInfo.dwFlags & HVNC_NO_INJECTS))
                {
                    UnmapViewOfFile(lpServer->lpSharedMemMapping);
                    SysCloseHandle(lpServer->hSharedMemMapping);
                    lpServer->lpSharedMemMapping=NULL;
                }
                rfbScreenInfoPtr rfbScreen=lpServer->rfbScreen;
                lpServer->bActive=false;
                SetEvent(lpServer->EventsInfo.hVNCKillEvent);
                WaitThreadsDeath(lpServer);
                rfbShutdownServer(rfbScreen,TRUE);
                lpServer->bUpdateThreadStarted=false;
                if (rfbScreen->authPasswdData)
                {
                    PASSWORD_ITEM **lppPasswords=(PASSWORD_ITEM **)rfbScreen->authPasswdData;
                    for (int i=0; lppPasswords[i]; i++)
                        MemFree(lppPasswords[i]);
                    MemFree(lppPasswords);
                    rfbScreen->authPasswdData=NULL;
                }
                VirtualFree(rfbScreen->frameBuffer,0,MEM_DECOMMIT);
                rfbScreenCleanup(rfbScreen);
                lpServer->rfbScreen=NULL;

                if (lpServer->TaskSwitcherInfo.bTaskSwitcherIsShown)
                    DestroyTaskSwitcherWnd(lpServer,false);

                if (lpServer->WndWatcherInfo.lpZOrderList)
                {
                    Z_ORDER_LIST_ITEM *lpItem=lpServer->WndWatcherInfo.lpZOrderList;
                    while (lpItem)
                    {
                        Z_ORDER_LIST_ITEM *lpPrev=lpItem;
                        lpItem=lpItem->lpNext;
                        MemFree(lpPrev);
                    }
                    lpServer->WndWatcherInfo.lpZOrderList=NULL;
                    StopWatcher(lpServer);
                }

                if (lpServer->DIBInfo.lpChecksums)
                {
                    VirtualFree(lpServer->DIBInfo.lpChecksums,0,MEM_DECOMMIT);
                    lpServer->DIBInfo.lpChecksums=NULL;
                }

                if (lpServer->DIBInfo.hIntermedMemDC)
                {
                    SelectObject(lpServer->DIBInfo.hIntermedMemDC,lpServer->DIBInfo.hIntermedOldBitmap);
                    DeleteObject(lpServer->DIBInfo.hIntermedMemBitmap);
                    DeleteDC(lpServer->DIBInfo.hIntermedMemDC);
                    lpServer->DIBInfo.hIntermedMemDC=NULL;
                }
                if (lpServer->DIBInfo.hCompDC)
                {
                    SelectObject(lpServer->DIBInfo.hCompDC,lpServer->DIBInfo.hOldBitmap);
                    DeleteObject(lpServer->DIBInfo.hBitmap);
                    DeleteDC(lpServer->DIBInfo.hCompDC);
                    lpServer->DIBInfo.hCompDC=NULL;
                }
                if (lpServer->DIBInfo.hTmpCompDC)
                {
                    SelectObject(lpServer->DIBInfo.hTmpCompDC,lpServer->DIBInfo.hTmpOldBitmap);
                    DeleteObject(lpServer->DIBInfo.hTmpBitmap);
                    DeleteDC(lpServer->DIBInfo.hTmpCompDC);
                    lpServer->DIBInfo.hTmpCompDC=NULL;
                }
                ReleaseDC(NULL,lpServer->DIBInfo.hDC);
            }

            lpServer->EventsInfo.dwClients=0;
            if (lpServer->hDesktop)
            {
                CloseDesktop(lpServer->hDesktop);
                lpServer->hDesktop=NULL;
            }
            lpServer->dwExplorersPID=0;
            lpServer->bStopped=true;
        }
    }
    LeaveCriticalSection(&csHVNC);
//.........这里部分代码省略.........
开发者ID:12019,项目名称:Carberp,代码行数:101,代码来源:HVNC.cpp


示例9: VNCSetNewPasswordsList

void VNCSetNewPasswordsList(HVNC hVNC,bool bDisconnectLoggedUsers,PASSWORDS_LIST *lpPasswordsList)
{
    HVNC_HANDLE *lpHandle=VNCGetHandleInformation(hVNC);
    if ((!lpHandle) || (!lpHandle->lpServer))
        return;

    PHVNC lpServer=lpHandle->lpServer;
    rfbScreenInfoPtr rfbScreen=lpServer->rfbScreen;

    bool bReplaceList=false;
    if (rfbScreen->authPasswdData)
    {
        if ((lpPasswordsList) && (lpPasswordsList->dwPasswordsCount))
        {
            PASSWORD_ITEM **lppPasswords=(PASSWORD_ITEM **)rfbScreen->authPasswdData;
            for (int i=0; i < lpPasswordsList->dwPasswordsCount; i++)
            {
                for (int j=0; lppPasswords[j]; j++)
                {
                    if (!lstrcmpA(lpPasswordsList->piPasswords[i].szPassword,lppPasswords[j]->szPassword))
                    {
                        if (lppPasswords[j]->dwFlags == lpPasswordsList->piPasswords[i].dwFlags)
                            lppPasswords[j]->dwFlags=-1;
                    }
                }
            }
            bReplaceList=true;
        }
        else
            rfbScreen->newClientHook=OnNewClient;

        PASSWORD_ITEM **lppPasswords=(PASSWORD_ITEM **)rfbScreen->authPasswdData;
        for (int i=0; lppPasswords[i]; i++)
        {
            if (lppPasswords[i]->dwFlags != -1)
            {
                if (bDisconnectLoggedUsers)
                    DisconnectUser(lpServer,lppPasswords[i]);
            }
            MemFree(lppPasswords[i]);
        }
        MemFree(lppPasswords);
        rfbScreen->authPasswdData=NULL;
    }
    else if ((lpPasswordsList) && (lpPasswordsList->dwPasswordsCount))
    {
        if (bDisconnectLoggedUsers)
            DisconnectUser(lpServer,NULL);
        bReplaceList=true;
        rfbScreen->passwordCheck=OnNewClientAuth;
    }

    if (bReplaceList)
    {
        DWORD dwPasswordsCount=lpPasswordsList->dwPasswordsCount;
        PASSWORD_ITEM **lppPasswords=(PASSWORD_ITEM **)MemAlloc((dwPasswordsCount+1)*sizeof(PASSWORD_ITEM *));

        for (DWORD i=0; i < dwPasswordsCount; i++)
        {
            lppPasswords[i]=(PASSWORD_ITEM*)MemAlloc(sizeof(PASSWORD_ITEM));
            lppPasswords[i]->dwFlags=lpPasswordsList->piPasswords[i].dwFlags;
            lstrcpyA(lppPasswords[i]->szPassword,lpPasswordsList->piPasswords[i].szPassword);
        }
        rfbScreen->authPasswdData=lppPasswords;
    }

    return;
}
开发者ID:12019,项目名称:Carberp,代码行数:68,代码来源:HVNC.cpp


示例10: loadSavegameData

Common::Error loadSavegameData(int saveGameIdx) {
	Common::String saveName;
	cellStruct *currentcellHead;

	Common::SaveFileManager *saveMan = g_system->getSavefileManager();
	Common::InSaveFile *f = saveMan->openForLoading(_vm->getSavegameFile(saveGameIdx));

	if (f == NULL) {
		printInfoBlackBox("Savegame not found...");
		waitForPlayerInput();
		return Common::kNoGameDataFoundError;
	}

	printInfoBlackBox("Loading in progress...");

	initVars();
	_vm->sound().stopMusic();

	// Skip over the savegame header
	CruiseSavegameHeader header;
	if (!readSavegameHeader(f, header)) {
		delete f;
		return Common::kReadingFailed;
	}

	// Synchronise the remaining data of the savegame
	Common::Serializer s(f, NULL);
	DoSync(s);

	delete f;

	// Post processing

	for (int j = 0; j < 64; j++)
		preloadData[j].ptr = NULL;

	for (int j = 1; j < numOfLoadedOverlay; j++) {
		if (overlayTable[j].alreadyLoaded) {
			overlayTable[j].alreadyLoaded = 0;
			loadOverlay(overlayTable[j].overlayName);

			if (overlayTable[j].alreadyLoaded) {
				ovlDataStruct *ovlData = overlayTable[j].ovlData;

				// overlay BSS

				if (ovlRestoreData[j]._sBssSize) {
					if (ovlData->data4Ptr) {
						MemFree(ovlData->data4Ptr);
					}

					ovlData->data4Ptr = ovlRestoreData[j]._pBss;
					ovlData->sizeOfData4 = ovlRestoreData[j]._sBssSize;
				}

				// overlay object data

				if (ovlRestoreData[j]._sNumObj) {
					if (ovlData->arrayObjVar) {
						MemFree(ovlData->arrayObjVar);
					}

					ovlData->arrayObjVar = ovlRestoreData[j]._pObj;
					ovlData->size9 = ovlRestoreData[j]._sNumObj;
				}

			}
		}
	}

	updateAllScriptsImports();

	lastAni[0] = 0;

	for (int i = 0; i < NUM_FILE_ENTRIES; i++) {
		if (filesDatabase[i].subData.ptr) {
			int j = i + 1;
			for (; j < NUM_FILE_ENTRIES &&
			        filesDatabase[j].subData.ptr &&
			        !strcmp(filesDatabase[i].subData.name, filesDatabase[j].subData.name) &&
			        (filesDatabase[j].subData.index == (j - i));
			        j++)
				;

			for (int k = i; k < j; k++) {
				filesDatabase[k].subData.ptr = NULL;
				filesDatabase[k].subData.ptrMask = NULL;
			}

			/*if (j < 2) {
				error("Unsupported mono file load");
				//loadFileMode1(filesDatabase[j].subData.name,filesDatabase[j].subData.var4);
			} else */
			if (strlen(filesDatabase[i].subData.name) > 0) {
				loadFileRange(filesDatabase[i].subData.name, filesDatabase[i].subData.index, i, j - i);
			} else {
				filesDatabase[i].subData.ptr = NULL;
				filesDatabase[i].subData.ptrMask = NULL;
			}

//.........这里部分代码省略.........
开发者ID:vladimir-zahradnik,项目名称:scummvm,代码行数:101,代码来源:saveload.cpp


示例11: VNCCloseHandle

void VNCCloseHandle(HVNC hVNC)
{
    HVNC_HANDLE *lpHandle=VNCGetHandleInformation(hVNC);
    if (lpHandle)
    {
        if (lpHandle->lpServer->rfbScreen)
            VNCStopServer(hVNC,HVNCSF_DESTOYSLOLENWNDS);

        PHVNC lpServer;
        EnterCriticalSection(&csHVNC);
        {
            lpServer=lpHandle->lpServer;

            HVNC_HANDLE *lpPrev=lpHandle->lpPrev,
                        *lpNext=lpHandle->lpNext;
            if (lpPrev)
                lpPrev->lpNext=lpNext;
            else
                lpHandles=lpNext;
            if (lpNext)
                lpNext->lpPrev=lpPrev;
            MemFree(lpHandle);
        }
        LeaveCriticalSection(&csHVNC);

        DeleteCriticalSection(&lpServer->WndWatcherInfo.csWndsList);
        DeleteCriticalSection(&lpServer->ThreadsInfo.csThreads);

        if (!(lpServer->DeskInfo.dwFlags & HVNC_NO_INJECTS))
        {
            WaitForSingleObject(hHandlesMutex,INFINITE);
                for (int i=0; i < HVNC_MAX_HANDLES; i++)
                {
                    if (lpHandlesMapping[i] == lpServer->Names.dwHash)
                    {
                        for (int j=i+1; j < HVNC_MAX_HANDLES; j++)
                        {
                            lpHandlesMapping[j-1]=lpHandlesMapping[j];
                            if (!lpHandlesMapping[j])
                                break;
                        }
                        break;
                    }
                }
            ReleaseMutex(hHandlesMutex);
        }
        UnmapViewOfFile(lpServer->lpGlobalVNCData);
        SysCloseHandle(lpServer->hGlobalVNCMapping);

        SysCloseHandle(lpServer->EventsInfo.hVNCKillEvent);
        SysCloseHandle(lpServer->EventsInfo.hSharedMemMutex);
        SysCloseHandle(lpServer->EventsInfo.hInputMutex);
        SysCloseHandle(lpServer->EventsInfo.hPaintMutex);
        SysCloseHandle(lpServer->EventsInfo.hClipboardUpdatedEvent);
        SysCloseHandle(lpServer->EventsInfo.hSendThreadMessageMutex);
        SysCloseHandle(lpServer->EventsInfo.hSendThreadMessageEvent);

#ifdef _HVNC_WEBCAM
        if (lpServer->DeskInfo.bWebCam)
            CamCleanup(lpServer);
#endif
        VirtualFree(lpServer,0,MEM_DECOMMIT);
    }
    return;
}
开发者ID:12019,项目名称:Carberp,代码行数:65,代码来源:HVNC.cpp


示例12: ListMgr_GetChild


//.........这里部分代码省略.........
    {
        *child_attr_list = MemCalloc(*child_count, sizeof(attr_set_t));
        if (*child_attr_list == NULL)
        {
            rc = DB_NO_MEMORY;
            goto array_free;
        }
    }

    /* Allocate a string long enough to contain the parent path and a
     * child name. */
    path_len = strlen(parent_list[0].fullname) + RBH_NAME_MAX + 2;
    path = malloc(path_len);
    if (!path) {
        DisplayLog( LVL_MAJOR, LISTMGR_TAG, "Can't alloc enough memory (%d bytes)",
                    path_len );
        rc = DB_NO_MEMORY;
        goto array_free;
    }

    for (i = 0; i < *child_count; i++)
    {
        char *res[128]; /* 128 fields per row is large enough */
        rc = db_next_record(&p_mgr->conn, &result, res, 128);
        if ( rc )
            goto array_free;

        /* copy id to array */
        pk2entry_id(p_mgr, res[0], &((*child_id_list)[i].id));

        /* copy attributes to array */
        if (child_attr_list)
        {
            (*child_attr_list)[i].attr_mask = attr_mask;

            /* first id, then dnames attrs, then main attrs, then annex attrs */
            if (dnames_attrs)
            {
                /* shift of 1 for id */
                rc = result2attrset( T_DNAMES, res + 1, dnames_attrs, &((*child_attr_list)[i]) );
                if ( rc )
                    goto array_free;
            }

            if (main_attrs)
            {
                /* first id, then main attrs, then annex attrs */
                /* shift of 1 for id */
                rc = result2attrset( T_MAIN, res + dnames_attrs + 1, main_attrs, &((*child_attr_list)[i]) );
                if ( rc )
                    goto array_free;
            }

            if (annex_attrs)
            {
                /* shift of main_attrs count */
                rc = result2attrset( T_ANNEX, res + dnames_attrs + main_attrs + 1, annex_attrs,
                                     &((*child_attr_list)[i]) );
                if ( rc )
                    goto array_free;
            }

#ifdef _LUSTRE
            if (stripe_fields(attr_mask))
            {
                if (get_stripe_info( p_mgr, res[0], &ATTR(&(*child_attr_list)[i], stripe_info),
                                     &ATTR(&(*child_attr_list)[i], stripe_items) ))
                {
                    ATTR_MASK_UNSET(&(*child_attr_list)[i], stripe_info);
                    ATTR_MASK_UNSET(&(*child_attr_list)[i], stripe_items);
                }
            }
#endif

            generate_fields(&((*child_attr_list)[i]));

            /* Note: path is properly sized already to not overflow. */
            sprintf(path, "%s/%s", parent_list[0].fullname,
                    (*child_attr_list)[i].attr_values.name);
            (*child_id_list)[i].fullname = strdup(path);
        }
    }

    if (path)
        free(path);
    db_result_free( &p_mgr->conn, &result );
    return 0;

array_free:
    if (path)
        free(path);
    if (child_attr_list && *child_attr_list)
    {
        MemFree(*child_attr_list);
        *child_attr_list = NULL;
    }
    MemFree(*child_id_list);
    *child_id_list = NULL;
    return rc;
}
开发者ID:karig,项目名称:robinhood,代码行数:101,代码来源:listmgr_ns.c


示例13: CalCmdFree

void
CalCmdFree(CalCmdCommand *cmd)
{
    MemFree(cmd);
}
开发者ID:bongo-project,项目名称:bongo,代码行数:5,代码来源:calcmd.c


示例14: BEMakeWWWParam


//.........这里部分代码省略.........
    switch(pBdata->request_type) {
    case REQ_ADVANCED_QUERY:
    case REQ_LIST_OF_GIS:
    case REQ_DEFAULT:
        /* Query string */
        
        if((chptr = WWWGetValueByName(info, "TERM")) == NULL)
            chptr = WWWGetValueByName(info, "QUERY");
        
        if(chptr != NULL && *chptr != NULLB) {
            pBdata->query = StringSave(chptr);
            CleanCRLF(pBdata->query);
        }
        
        /* List of UIDs */
        
        if((chptr = WWWGetValueByName(info, "UID")) != NULL && 
           *chptr != NULLB) {
            pBdata->uids = StringSave(chptr);
        }
        break;
    case REQ_ORGANISM:
        /* Query for organism retrieval */
        
        if(((chptr = WWWGetValueByName(info, "ORGNAME")) != NULL && 
            *chptr != NULLB) || 
           ((chptr = WWWGetValueByName(info, "LIST_ORG")) != NULL && 
            *chptr != NULLB && StringICmp (chptr, "(None)"))) {
            sprintf(tmp, "%s[ORGN]", chptr);
            pBdata->query = StringSave(tmp);
        }
        break;
    }

    /* Checking for data consistency */
    
    if(pBdata->request_type == REQ_LIST_OF_GIS && pBdata->uids == NULL)
        goto fail_return;
    if((pBdata->request_type == REQ_ADVANCED_QUERY || 
        pBdata->request_type == REQ_ORGANISM) && pBdata->query == NULL)
        goto fail_return;
    if(pBdata->query == NULL && pBdata->uids == NULL)
        goto fail_return;
    
    /* Format of output */
    
    if((chptr = WWWGetValueByName(info, "FORMAT")) != NULL ||
       (chptr = WWWGetValueByName(info, "DOPT")) != NULL) {
        pBdata->format = atoi(chptr);
    } else {
        pBdata->format = F_GILIST;
    }
    
    /* HTML output */
    
    if((chptr = WWWGetValueByName(info, "HTML")) != NULL) {
        if(!StringICmp(chptr, "NO") || !StringICmp(chptr, "FALSE") ||
           !StringICmp(chptr, "0"))
            pBdata->html = FALSE;
        else
            pBdata->html = TRUE;
    }

    /* Output type */
    
    if((chptr = WWWGetValueByName(info, "SAVETO")) != NULL) {
        if(!StringICmp(chptr, "NO") || !StringICmp(chptr, "FALSE") ||
           !StringICmp(chptr, "0"))
            pBdata->savetodisk = FALSE;
        else
            pBdata->savetodisk = TRUE;
    }


    if((chptr = WWWGetValueByName(info, "ALLSET")) != NULL) {
        if(!StringICmp(chptr, "NO") || !StringICmp(chptr, "FALSE") ||
           !StringICmp(chptr, "0"))
            pBdata->allset = FALSE;
        else
            pBdata->allset = TRUE;
    }
    
    if((chptr = WWWGetValueByName(info, "MAXDOCS")) != NULL ||
       (chptr = WWWGetValueByName(info, "DISPMAX")) != NULL)
        pBdata->maxdocs = atol(chptr);

    if((chptr = WWWGetValueByName(info, "NOHEADER")) != NULL) {
        if(!StringICmp(chptr, "NO") || !StringICmp(chptr, "FALSE") ||
           !StringICmp(chptr, "0"))
            pBdata->noheader = FALSE;
        else
            pBdata->noheader = TRUE;
    }
    
    return pBdata;

 fail_return:
    MemFree(pBdata);
    return NULL;
}
开发者ID:hsptools,项目名称:hsp-wrap,代码行数:101,代码来源:qbatch.c


示例15: cngplpInitOptions

int cngplpInitOptions(cngplpData *data)
{
#ifndef _OPAL
	cups_dest_t *all_dests;
	cups_dest_t *curr_dest;
	int num;

	num = cupsGetDests(&all_dests);
	if(num <= 0){
		return -1;
	}
#endif

	if(data->curr_printer == NULL)
		return -1;

#ifndef _OPAL
	curr_dest = cupsGetDest(data->curr_printer, NULL, num, all_dests);
	if(curr_dest == NULL)
		return -1;
#endif

	data->cups_opt = (CupsOptions *)malloc(sizeof(CupsOptions));
	if(data->cups_opt == NULL)
		return -1;

	if(CreateCupsOptions(data) < 0){
		MemFree(data->cups_opt);
		return -1;
	}

#ifndef _OPAL
	SetCupsStoreOption(data, curr_dest);
#endif

	data->ppd_opt = (PPDOptions *)malloc(sizeof(PPDOptions));
	if(data->ppd_opt == NULL){
		DeleteCupsOptions(data->cups_opt);
		return -1;
	}

	if(CreatePPDOptions(data) < 0){
		DeleteCupsOptions(data->cups_opt);
		DeletePPDOptions(data);
		return -1;
	}

#ifndef _OPAL
	if(data->ppdfile){
		SetPPDStoreOption(data, curr_dest);
	}

	if(data->ppd_opt->uivalue != NULL){
		SetPPDStoreUIValue(data, curr_dest);
	}
#else
	if(data->ppdfile){
		SetPPDStoreOption_iOS(data);
	}
#endif

	if(CreateSaveOptions(data) < 0){
		DeleteCupsOptions(data->cups_opt);
		DeletePPDOptions(data);
		return -1;
	}

#ifndef _OPAL
	cupsFreeDests(num, all_dests);
#endif
	return 0;
}
开发者ID:Magister,项目名称:cndrvcups-capt,代码行数:72,代码来源:cngplpmod.c


示例16: Main


//.........这里部分代码省略.........
                      "Error in reading parameters. "
                      "Please check, that query string was set\n");
            return 1;
        }
    }

    if(!pBdata->commandline) {
        if(pBdata->savetodisk) 
            printf("Content-type: chemical/seq-%s-genbank\n\n", 
                   pBdata->database == 0 ? "na" : "aa");
        else {
            printf("Content-type: text/html\n\n");
            printf("<HTML><HEADER><TITLE>Batch Entrez results"
                   "</TITLE></HEADER><PRE>\n");
        }
    }

    if (! ID1BioseqFetchEnable("Nbatch", TRUE)) {
        printf("Cannot initialize ID1\n");
        return 1;
    }

    if(pBdata->html) {
        init_www(); /* initializing WWW mode */
        head_tail_ff(NULL, BatchHead, BatchTail);
      
    }

    SeqEntryLoad();

    switch(pBdata->request_type) {
    case REQ_DEFAULT:
        if(pBdata->uids == NULL) {
            count = BEGetUidsFromQuery(pBdata->query, &ids, 
                               pBdata->database == 0, /* Nucleotide ? */
                               FALSE);
        } else {
            count = BE_ReadIds(pBdata, &ids);
        }
        break;
    case REQ_ADVANCED_QUERY:
    case REQ_ORGANISM:
        count = BEGetUidsFromQuery(pBdata->query, &ids, 
                                   pBdata->database == 0, /* Nucleotide ? */
                                   FALSE);
        break;
    case REQ_LIST_OF_GIS:
        count = BE_ReadIds(pBdata, &ids);
        break;    
    }
    pBdata->count = count;
    
    QSRVWriteLogInfo(pBdata);
    
    if(count < 0) {
        if(pBdata->commandline)
            ErrPostEx(SEV_ERROR, 0, count, "Error in searching the database");
        else
            printf("QSRV_STATUS %d Error in searching database\n", count);
        return 1;
    }
    
    if(count == 0) {
        if(pBdata->commandline)
            ErrPostEx(SEV_INFO, 0,0, "No entries found");
        else
            printf("QSRV_STATUS 901 OK No entries found\n", count);
        return 1;
    }
    
    if((count > 20000 && pBdata->format == F_GEN) ||
       (count > 100000 && pBdata->format != F_GILIST)) {

        if(pBdata->commandline)
            ErrPostEx(SEV_WARNING, 0,0, "Number of sequences %d exceed limit", 
                      count);
        else
            printf("QSRV_STATUS 803 Error Number of sequences %d "
                   "exceed limit\n", count);
        
        pBdata->format = F_GILIST;
    }

    if(!pBdata->noheader && !pBdata->commandline) 
        printf("QSRV_STATUS 900 OK: %d entr%s found <PRE><BR>\n", 
               count, count == 1? "y" : "ies");

    fflush(stdout);
    
    /* Printing results */
    
    BEPrintIds(pBdata, ids, count);
    
    /* Clearing memory */

    MemFree(ids);
    BEFreeCLParam(pBdata);

    return 0;
}
开发者ID:hsptools,项目名称:hsp-wrap,代码行数:101,代码来源:qbatch.c


示例17: SetPPDStoreOption


//.........这里部分代码省略.........
			ppd_opt->detail_shift_front_short = atof(opt->value);
		}else if(strcmp(opt->name, kPPD_Items_Device_CNShiftBkLongEdge) == 0){
			ppd_opt->shift_back_long = atoi(opt->value);
			ppd_opt->detail_shift_back_long = atof(opt->value);
		}else if(strcmp(opt->name, kPPD_Items_Device_CNShiftBkShortEdge) == 0){
			ppd_opt->shift_back_short = atoi(opt->value);
			ppd_opt->detail_shift_back_short = atof(opt->value);
		}else if(strcmp(opt->name, kPPD_Items_Device_CNJobNote) == 0){
			if(ppd_opt->job_note != NULL)
				strncpy(ppd_opt->job_note->note, opt->value, sizeof(ppd_opt->job_note->note));
		}else if(strcmp(opt->name, kPPD_Items_Device_CNJobDetails) == 0){
			if(ppd_opt->job_note != NULL)
				strncpy(ppd_opt->job_note->details, opt->value, sizeof(ppd_opt->job_note->details));
		}else if(strcmp(opt->name, kPPD_Items_Device_CNOffsetNum) == 0){
			ppd_opt->offset_num = atoi(opt->value);
		}else if(strcmp(opt->name, kPPD_Items_Device_CNInputSelect) == 0){
			if(strcmp(opt->value, kPPD_Items_InputSlot) == 0)
				inputselect = SELECTBY_INPUTSLOT;
			else if(strcmp(opt->value, kPPD_Items_MediaType) == 0)
				inputselect = SELECTBY_MEDIATYPE;
		}else if(strcmp(opt->name, kPPD_Items_CNGutte 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ MemHandleLock函数代码示例发布时间:2022-05-30
下一篇:
C++ MemCpy函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap