当前位置: 首页>>代码示例>>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;未经允许,请勿转载。