當前位置: 首頁>>代碼示例>>C++>>正文


C++ DisposePtr函數代碼示例

本文整理匯總了C++中DisposePtr函數的典型用法代碼示例。如果您正苦於以下問題:C++ DisposePtr函數的具體用法?C++ DisposePtr怎麽用?C++ DisposePtr使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了DisposePtr函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: NewPtrClear

static recDevice *HIDBuildDevice (io_object_t hidDevice)
{
	recDevice *pDevice = (recDevice *) NewPtrClear (sizeof (recDevice));
	if (pDevice)
	{
		/* get dictionary for HID properties */
		CFMutableDictionaryRef hidProperties = 0;
		kern_return_t result = IORegistryEntryCreateCFProperties (hidDevice, &hidProperties, kCFAllocatorDefault, kNilOptions);
		if ((result == KERN_SUCCESS) && hidProperties)
		{
			/* create device interface */
			result = HIDCreateOpenDeviceInterface (hidDevice, pDevice);
			if (kIOReturnSuccess == result)
			{
				HIDGetDeviceInfo (hidDevice, hidProperties, pDevice); /* hidDevice used to find parents in registry tree */
				HIDGetCollectionElements (hidProperties, pDevice);
			}
			else
			{
				DisposePtr((Ptr)pDevice);
				pDevice = NULL;
			}
			CFRelease (hidProperties);
		}
		else
		{
			DisposePtr((Ptr)pDevice);
			pDevice = NULL;
		}
	}
	return pDevice;
}
開發者ID:Sgt-Nukem,項目名稱:chocolate_duke3D,代碼行數:32,代碼來源:SDL_sysjoystick.c

示例2: NetDDPCloseSocket

OSErr NetDDPCloseSocket(
    short socketNumber)
{
    OSErr error= noErr;

    if (ddpPacketBuffer)
    {
        MPPPBPtr myMPPPBPtr= (MPPPBPtr) NewPtrClear(sizeof(MPPParamBlock));

        error= MemError();
        if (error==noErr)
        {
            myMPPPBPtr->DDP.socket= socketNumber;

            error= PCloseSkt(myMPPPBPtr, FALSE);

            DisposePtr((Ptr)ddpPacketBuffer);
            ddpPacketBuffer= (DDPPacketBufferPtr) NULL;

            DisposePtr((Ptr)myMPPPBPtr);
        }
    }

    return error;
}
開發者ID:DrItanium,項目名稱:moo,代碼行數:25,代碼來源:network_ddp.c

示例3: asyncFileClose

int asyncFileClose(AsyncFile *f) {
  /* Close the given asynchronous file. */

	AsyncFileState *state;
	short int volRefNum;
	OSErr err;

	if (!asyncFileValid(f)) return 0;  /* already closed */
	state = f->state;

	err = GetVRefNum(state->refNum, &volRefNum);
	success(err == noErr);

	err = FSClose(state->refNum);
	success(err == noErr);

	if (!interpreterProxy->failed()) err = FlushVol(NULL, volRefNum);
	success(err == noErr);

    if (asyncFileCompletionProc != nil)
        DisposeIOCompletionUPP(asyncFileCompletionProc);
  
	asyncFileCompletionProc = nil;
	if (state->bufferPtr != nil) DisposePtr(state->bufferPtr);
	DisposePtr((void *) f->state);
	f->state = nil;
	f->sessionID = 0;
	return 0;
}
開發者ID:fniephaus,項目名稱:squeak,代碼行數:29,代碼來源:sqMacAsyncFilePrims.c

示例4: SaveDriverState

/*__________________________________________________________________________*/
Boolean SaveDriverState (short refnum, StringPtr file, OSType creator, OSType type)
{
	FSSpec spec; OSErr err; TDriverInfos dInfos;
	long size, dirID; short vrefNum, ref;
	Ptr ptr;
	
	if (FindMidiShareFolder (true, &vrefNum, &dirID) != noErr) return false;
	if (!MidiGetDriverInfos (refnum, &dInfos)) return false;

	size = Get1DriverStateSize (dInfos.slots);
	if (!size) return true;
	
	ptr = NewPtrSys(size);
	if (!ptr) return false;
		
	Get1DriverState (refnum, dInfos.slots, ptr, size);
	err = FSMakeFSSpec(vrefNum, dirID, file, &spec);
	if (err == fnfErr)
		err = FSpCreate (&spec, creator, type, smSystemScript);
	if (err != noErr) goto err;
		err = FSpOpenDF (&spec, fsWrPerm, &ref);
	if (err != noErr) goto err;
		err = FSWrite (ref, &size, ptr);
	FSClose (ref);
	DisposePtr (ptr);
	return err == noErr;

err:
	DisposePtr (ptr);
	return false;
}
開發者ID:AntonLanghoff,項目名稱:whitecatlib,代碼行數:32,代碼來源:SavingState.c

示例5: RemoveElement

Boolean RemoveElement(LinkedList *listPtr,unsigned long num)
{
	ElementHandle	moo=listPtr,last=0L;
	unsigned long	count=0;
	
	while((*moo) && (count!=num))
	{
		count++;
		last=moo;
		moo=(ElementHandle)&((**moo).next);
	}
	
	if (*moo) // if this is 0L then n wasn't in the list
	{
		Ptr		dataPtr=(**moo).data;
		Ptr		entityPtr=(Ptr)*moo;
		
		// got it, delete it
		if (last==0L) // if last==0L then this was the first element in the list
			*listPtr=(ElementPtr)(**moo).next; // the start is the next one (which is null if this was also the last one in the list)
		else
			(**last).next=(**moo).next; // bypass element moo (element n)
		
		// Free up the ram
		DisposePtr(dataPtr);
		DisposePtr(entityPtr);
		return true; // it's gone
	}
	else
		return false;
}
開發者ID:MaddTheSane,項目名稱:tntbasic,代碼行數:31,代碼來源:LinkedLists.c

示例6: PPMADInfoFile

OSErr PPMADInfoFile( char	*AlienFile, PPInfoRec	*InfoRec)
{
	MADSpec		*theMAD;
	long			fileSize;
	short			fileID;
	
	theMAD = (MADSpec*) NewPtr( sizeof( MADSpec) + 200);
		
	fileID = iFileOpen( AlienFile);
	if( !fileID)
	{
		DisposePtr( (Ptr) theMAD);
		return -1;
	}
	fileSize = iGetEOF( fileID);
		
	iRead( sizeof( MADSpec), (Ptr) theMAD, fileID);
	iClose( fileID);
		
	strcpy( InfoRec->internalFileName, theMAD->name);
	
	InfoRec->totalPatterns = theMAD->numPat;
	InfoRec->partitionLength = theMAD->numPointers;
	InfoRec->totalTracks = theMAD->numChn;
	InfoRec->signature = 'MADK';
	strcpy( InfoRec->formatDescription, "MADK");
	InfoRec->totalInstruments = theMAD->numInstru;
	InfoRec->fileSize = fileSize;
		
	DisposePtr( (Ptr) theMAD);	
	theMAD = NULL;
		
	return noErr;
}
開發者ID:mctully,項目名稱:tntbasic,代碼行數:34,代碼來源:Mac-PlugImport.c

示例7: CleanTemp

void CleanTemp(void)
{
    OSErr   err = noErr;
    short   vRefNum;
    long    dirID;
    FSSpec  viewerFSp;
    XPISpec *xpiList, *currXPI = 0, *nextXPI = 0;
#ifdef MIW_DEBUG
    Boolean isDir = false;
#endif
    
#ifndef MIW_DEBUG
    /* get "viewer" in "Temporary Items" folder */
    ERR_CHECK(FindFolder(kOnSystemDisk, kTemporaryFolderType, kCreateFolder, &vRefNum, &dirID));
    err = FSMakeFSSpec(vRefNum, dirID, kViewerFolder, &viewerFSp);
#else
    /* for DEBUG builds temp is "<currProcessVolume>:Temp NSInstall:" */
    ERR_CHECK(GetCWD(&dirID, &vRefNum));
 	err = FSMakeFSSpec(vRefNum, 0, kTempFolder, &viewerFSp);
	if (err == fnfErr)
	    return; /* no debug temp exists */
	err = FSpGetDirectoryID(&viewerFSp, &dirID, &isDir);
	if (err != noErr || !isDir)
	    return;
    err = FSMakeFSSpec(vRefNum, dirID, kViewerFolder, &viewerFSp);
#endif
    
    /* whack the viewer folder if it exists */
    if (err == noErr)
    {
        ERR_CHECK(DeleteDirectory(viewerFSp.vRefNum, viewerFSp.parID, viewerFSp.name));
    }
    
    /* clean out the zippies (.xpi's) */
    xpiList = (XPISpec *) NewPtrClear(sizeof(XPISpec));
    if (!xpiList)
        return;
    IterateDirectory(vRefNum, dirID, "\p", 1, CheckIfXPI, (void*)&xpiList);
    
    if (xpiList)
    {
        currXPI = xpiList;
        while(currXPI)
        {
            nextXPI = currXPI->next; /* save nextXPI before we blow away currXPI */
            if (currXPI->FSp)
            {
                FSpDelete(currXPI->FSp);
                DisposePtr((Ptr)currXPI->FSp);
            }
            DisposePtr((Ptr)currXPI);
            currXPI = nextXPI;
        }
    }
}
開發者ID:rn10950,項目名稱:RetroZilla,代碼行數:55,代碼來源:MacInstallWizard.c

示例8: ottcp_free

void ottcp_free(OTTCP *x) {
	freeobject(x->o_clock);
	freeobject(x->o_connectedclock);
    if (x->o_tcp_ep != 0) {
		OTCloseProvider(x->o_tcp_ep);
	}
	
	DisposePtr(x->o_ReadBufA);
	DisposePtr(x->o_ReadBufB);
	DisposePtr(x->o_WriteBuf);
}
開發者ID:CNMAT,項目名稱:CNMAT-Externs,代碼行數:11,代碼來源:ottcp.c

示例9: SinkerNew

void*
SinkerNew(
	SymbolPtr,
	short		iArgC,
	Atom		iArgV[])
	
	{
	const float kDefVal = 0.0;
	
	short			valCount = (iArgC > 0) ? iArgC : 1;
	objSinker*		me	= NIL;
	tCurPendPair*	vals = (tCurPendPair*) NewPtrClear(valCount * sizeof(tCurPendPair));
	tSampleVector*	inSigs = (tSampleVector*) NewPtrClear(valCount * sizeof(tSampleVector));
	tSampleVector*	outSigs = (tSampleVector*) NewPtrClear(valCount * sizeof(tSampleVector));
	
	if (vals == NIL || inSigs == NIL || outSigs == NIL) {
		// Quick punt before any damage can be done
		if (vals != NIL) DisposePtr((Ptr) vals);
		if (inSigs != NIL) DisposePtr((Ptr) inSigs);
		if (outSigs != NIL) DisposePtr((Ptr) outSigs);
		return NIL;	
		}					
	
	// Let Max/MSP allocate us and inlets
	me = (objSinker*) newobject(gObjectClass);
	
	// Add outlets, right to left, and initialize values
	if (iArgC == 0) {
		// Default to two inlets, one outlet
		dsp_setup(&me->coreObject, 2);
		outlet_new(me, "signal");
		// Don't actually need to initialize as long as kDefVal is zero
		// vals[0].current = vals[0].pending = kDefVal;		
		}
	else {
		dsp_setup(&me->coreObject, iArgC + 1);
		while (--iArgC >= 0) {
			outlet_new(me, "signal");
			vals[iArgC].current = vals[iArgC].pending = AtomGetFloat(&iArgV[iArgC]);
			}
		}
	
	// My own initialization. Do this now before we lose the value of iArgCount
	me->lastSync	= 0.0;
	me->valCount	= valCount;
	me->mode		= trigDef;
	me->vals		= vals;
	me->inSigs		= inSigs;
	me->outSigs		= outSigs;
	
punt:
	return me;
	}
開發者ID:pcastine-lp,項目名稱:LitterPower,代碼行數:53,代碼來源:sinker~.c

示例10: TclMacExitHandler

void
TclMacExitHandler()
{
    ExitToShellUPPListPtr curProc;

    /*
     * Loop through all installed Exit handlers
     * and call them.  Always make sure we are in
     * a clean state in case we are recursivly called.
     */
    if ((gExitToShellData) != NULL && (gExitToShellData->userProcs != NULL)){
    
	/*
	 * Call the installed exit to shell routines.
	 */
	curProc = gExitToShellData->userProcs;
	do {
	    gExitToShellData->userProcs = curProc->nextProc;
	    CallExitToShellProc(curProc->userProc);
	    DisposeExitToShellProc(curProc->userProc);
	    DisposePtr((Ptr) curProc);
	    curProc = gExitToShellData->userProcs;
	} while (curProc != (ExitToShellUPPListPtr) NULL);
    }

    return;
}
開發者ID:gordonchaffee,項目名稱:expectnt,代碼行數:27,代碼來源:tclMacExit.c

示例11: FadeToColorMultiple

/* Do a gamma fade to the color provided over the time period desired	*/
OSStatus FadeToColorMultiple( 	ScreenRef *screens, 
								unsigned int count, 
								const RGBColor *color, 
								float seconds )
{
	RLGammaTable	*newGammas = (RLGammaTable*) NewPtr( count * sizeof( RLGammaTable ) );
	if( NULL == newGammas )
		return rlOutOfMemory;
	
	//Generate new gamma tables from the provided color
	float red = float( color->red ) / 65535.0;
	float green = float( color->green ) / 65535.0;
	float blue = float( color->blue ) / 65535.0;

	for( int i = 0; i < count; i++ )
	{
		for( int j = 0; j < kGammaTableEntryCount; j++ )
		{
			newGammas[i].red[j] = red;
			newGammas[i].green[j] = green;
			newGammas[i].blue[j] = blue;	
		}
	}
	
	OSStatus err = FadeToGammaMultiple( screens, count, newGammas, seconds );

	DisposePtr( (Ptr) newGammas );

	return err;
}
開發者ID:mctully,項目名稱:tntbasic,代碼行數:31,代碼來源:RLDisplayMachO.cpp

示例12: alSourceStop

ALAPI ALvoid ALAPIENTRY alSourceStop (ALuint source)
{
	QueueEntry *pQE;
	
#ifndef MAC_OS_X
	smSourceFlushAndQuiet(source);
#endif
	
	gSource[source].state = AL_STOPPED;
	gSource[source].readOffset = 0;
        if (gSource[source].pCompHdr != NULL) {
#ifdef MAC_OS_X
            free(gSource[source].pCompHdr);
#else
            DisposePtr(gSource[source].pCompHdr);
#endif
            gSource[source].pCompHdr = NULL;
        }
        gSource[source].uncompressedReadOffset = 0;
#ifdef MAC_OS_X
        gSource[source].uncompressedBufferOffset = 0;
#endif
	
	pQE = gSource[source].ptrQueue; // reset all processed flags
	while (pQE != NULL)
	{
	    gSource[source].srcBufferNum = 0; // will play the null-buffer, then process queue...
	 	pQE->processed = AL_FALSE;
	 	pQE = pQE->pNext;
	}
}
開發者ID:Aye1,項目名稱:RVProject,代碼行數:31,代碼來源:alSource.c

示例13: BigSendAppleEvent

OSErr BigSendAppleEvent(TargetID *targ,AEEventClass aeClass,AEEventID aeID,Ptr *data,short dataLen,DescType dataType,Boolean returnData,Boolean checkForHandlerErr)
{
	AEAddressDesc	targDesc={typeNull, nil};	// Desc for target
	AppleEvent		appOut={typeNull, nil},appIn={typeNull, nil};
	short			sendMode=kAENeverInteract;
	OSErr			err;
									
	if (returnData || checkForHandlerErr)
		sendMode+=kAEWaitReply;
	else
		sendMode+=kAENoReply;
									
	// Create the address desriptor
	err=AECreateDesc(typeTargetID,(Ptr)targ,sizeof(TargetID), &targDesc);
	if (err)
		return err;
		
	// now create the apple event which will be sent
	err=AECreateAppleEvent(aeClass,aeID,&targDesc,kAutoGenerateReturnID,kAnyTransactionID,&appOut);	
	if (err)
	{
		AEDisposeDesc(&targDesc);
		return err;
	}
	
	if (data && *data)
	{
		err=AEPutParamPtr(&appOut,keyDirectObject,typeChar,*data,dataLen);
		DisposePtr(*data);
		*data=0L;
		if (err)
		{
			AEDisposeDesc(&appOut);
			AEDisposeDesc(&targDesc);
		}
	}
		
	// Send the apple event	
	err=AESend(&appOut,&appIn,sendMode,kAENormalPriority,kAEDefaultTimeout,0L,0L);		
	if (err)
	{
		AEDisposeDesc(&appOut); 		// get rid of the apple events
		AEDisposeDesc(&appIn);
		AEDisposeDesc(&targDesc);	// and the address descriptor
	}
		
	if (returnData) // get info from reply event
		err=FetchParamAnySize(keyDirectObject,&appIn,data,dataType);
	
	// Get the error returned if any
	if (!err && checkForHandlerErr)
		err=FetchAEErr(&appIn);
	
	// The apple event has been sent, dispose of descriptors
	AEDisposeDesc(&appOut); 		// get rid of the apple events
	AEDisposeDesc(&appIn);
	AEDisposeDesc(&targDesc);	// and the address descriptor
	
	return err;
}
開發者ID:MaddTheSane,項目名稱:tntbasic,代碼行數:60,代碼來源:AppleEvents.cpp

示例14: NetDDPDisposeFrame

void NetDDPDisposeFrame(
    DDPFramePtr frame)
{
    DisposePtr((Ptr)frame);

    return;
}
開發者ID:DrItanium,項目名稱:moo,代碼行數:7,代碼來源:network_ddp.c

示例15: SetControlData

/*	KillPopMenus(theDialog)

 	Call when exiting the dialog, before calling DisposeXOPDialog.
 	
 	The menu handles associated with popup controls are automatically deleted
 	by the controls because we use SetControlData(...kControlPopupButtonOwnedMenuRefTag...).
 	However, we need to do some bookkeeping here to keep track of which menu IDs are
 	free for use in popup menus. This bookkeeping is complicated by the possibility
 	of subdialogs.

	Thread Safety: KillPopMenus is not thread-safe.
*/
void
KillPopMenus(DialogPtr theDialog)
{
	int i;
	
	if (gPopMenuInfoP == NULL)
		return;								// Would happen if you did not create any popup menus.
	
	// Mark menu IDs used for this dialog as free so they can be reused for another dialog.
	for(i=0; i<MAX_POPUP_MENUS; i++) {
		if (gPopMenuInfoP[i].theDialog == theDialog) {	// This is the dialog for which the menu was created?
			gPopMenuInfoP[i].theDialog = NULL;
			gPopMenuInfoP[i].menuID = 0;
		}
	}

	/*	Now see if gPopMenuInfoP is no longer needed. If we just disposed a subdialog,
		it is still needed for the parent dialog.
	*/
	{
		int infoStillNeeded;
		infoStillNeeded = 0;
		for(i=0; i<MAX_POPUP_MENUS; i++) {
			if (gPopMenuInfoP[i].menuID != 0) {
				infoStillNeeded = 1;
				break;		
			}
		}
		if (!infoStillNeeded) {
			DisposePtr((Ptr)gPopMenuInfoP);
			gPopMenuInfoP = NULL;
		}
	}
}
開發者ID:jgreenb2,項目名稱:DFMLoadWave,代碼行數:46,代碼來源:XOPDialogsMac.c


注:本文中的DisposePtr函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。