您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ DisposePtr函数代码示例

51自学网 2021-06-01 20:28:31
  C++
这篇教程C++ DisposePtr函数代码示例写得很实用,希望能帮到您。

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

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


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例10: TclMacExitHandler

voidTclMacExitHandler(){    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,


示例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,


示例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,


示例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,


示例14: NetDDPDisposeFrame

void NetDDPDisposeFrame(    DDPFramePtr frame){    DisposePtr((Ptr)frame);    return;}
开发者ID:DrItanium,项目名称:moo,代码行数:7,


示例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.*/voidKillPopMenus(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,


示例16: HIDDisposeDevice

static recDevice *HIDDisposeDevice(recDevice ** ppDevice){    kern_return_t result = KERN_SUCCESS;    recDevice *pDeviceNext = NULL;    if (*ppDevice) {        /* save next device prior to disposing of this device */        pDeviceNext = (*ppDevice)->pNext;        /* free posible io_service_t */        if ((*ppDevice)->ffservice) {            IOObjectRelease((*ppDevice)->ffservice);            (*ppDevice)->ffservice = 0;        }        /* free element lists */        HIDDisposeElementList(&(*ppDevice)->firstAxis);        HIDDisposeElementList(&(*ppDevice)->firstButton);        HIDDisposeElementList(&(*ppDevice)->firstHat);        result = HIDCloseReleaseInterface(*ppDevice);   /* function sanity checks interface value (now application does not own device) */        if (kIOReturnSuccess != result)            HIDReportErrorNum                ("HIDCloseReleaseInterface failed when trying to dipose device.",                 result);        DisposePtr((Ptr) * ppDevice);        *ppDevice = NULL;    }    return pDeviceNext;}
开发者ID:CrypticGator,项目名称:hackterm,代码行数:30,


示例17: ExitToShellPatchRoutine

static pascal voidExitToShellPatchRoutine(){    ExitToShellUPP oldETS;    long oldA5;    /*     * Set up our A5 world.  This allows us to have     * access to our global variables in the 68k world.     */    oldA5 = SetCurrentA5();    SetA5(gExitToShellData->a5);    /*     * Call the function that invokes all     * of the handlers.     */    TclMacExitHandler();    /*     * Call the origional ExitToShell routine.     */    oldETS = gExitToShellData->oldProc;    DisposePtr((Ptr) gExitToShellData);    SetA5(oldA5);    CallExitToShellProc(oldETS);    return;}
开发者ID:gordonchaffee,项目名称:expectnt,代码行数:28,


示例18: _heap_free_region

void __cdecl _heap_free_region (	REG1 int index	){	struct _heap_region_ *pHeapRegions;	/*	 * Give the memory back to the OS	 */	pHeapRegions = (struct _heap_region_ *)(*hHeapRegions);	if ((pHeapRegions + index)->_regbase)		{		DisposePtr((pHeapRegions + index)->_regbaseCopy);		}	/*	 * Zero out the heap region entry	 */	pHeapRegions = (struct _heap_region_ *)(*hHeapRegions);	(pHeapRegions + index)->_regbase = NULL;	(pHeapRegions + index)->_currsize = 0;	(pHeapRegions + index)->_totalsize = 0;}
开发者ID:chunhualiu,项目名称:OpenNT,代码行数:26,


示例19: getCurrentResourceFSSpec

// --------------------------------------------------------------------------------------static OSErr getCurrentResourceFSSpec(FSSpec *curResSpec){	OSErr error;	FCBPBPtr fileInfo;		// file control block parameter block pointer	StrFileName fileName;			/* In the age of application packages and bundles, it's less likely that the 		   current resource file is the application file itself.  It's more likely to be 		   a flattened resource file in a bundle so we need a generic method instead of 		   the traditional Process Manager method of getting the current application's 		   FSSpec of it's executable file */	fileInfo = (FCBPBPtr)NewPtr(sizeof(FCBPBRec));		fileInfo->ioNamePtr = fileName;		// to hold the resource file's name	fileInfo->ioVRefNum = 0;			// 0 to search through all open files on all volumes	fileInfo->ioRefNum = CurResFile();	// get info about the main resource file 										// by using its reference number	fileInfo->ioFCBIndx = 0;			// 0 to ignore this parameter and use the 										// ioRefNum parameter instead		error = PBGetFCBInfoSync(fileInfo);	// synchronous because we don't have 						// anything else to do while we're waiting on the filesystem		if (error == noErr)		// if we got the necessary file info, make an FSSpec out of it		FSMakeFSSpec(fileInfo->ioFCBVRefNum, fileInfo->ioFCBParID, fileName, curResSpec);							DisposePtr((Ptr)fileInfo);		return error;}
开发者ID:fruitsamples,项目名称:CarbonPorting,代码行数:31,


示例20: QTDR_CloseDownHandlers

void QTDR_CloseDownHandlers (void){	if (gDataReader != NULL) {		DataHCloseForRead(gDataReader);		CloseComponent(gDataReader);		gDataReader = NULL;	}	if (gDataWriter != NULL) {		DataHCloseForWrite(gDataWriter);		CloseComponent(gDataWriter);		gDataWriter = NULL;	}		// dispose of the data buffer	if (gDataBuffer != NULL)		DisposePtr(gDataBuffer);			// dispose of the routine descriptors	if (gReadDataHCompletionUPP != NULL)		DisposeDataHCompletionUPP(gReadDataHCompletionUPP);			if (gWriteDataHCompletionUPP != NULL)		DisposeDataHCompletionUPP(gWriteDataHCompletionUPP);		gDoneTransferring = false;	#if TARGET_OS_WIN32	// kill the timer that tasks the data handlers	KillTimer(NULL, gTimerID);#endif}
开发者ID:fruitsamples,项目名称:ThreadsImporter,代码行数:32,


示例21: grow_buffer

OSErr grow_buffer(Theora_Globals glob, UInt32 min_size) {    /* increase the size of the packet buffer, in       kPacketBufferAllocIncrement blocks, preserving the content of       the used part of the buffer */    OSErr err = noErr;    UInt32 new_size = glob->p_buffer_len;    dbg_printf("--:Theora:-  _grow_buffer(%08lx, %ld)/n", (long)glob, min_size);    while (new_size < min_size)        new_size += kPacketBufferAllocIncrement;    /* first try to resize in-place */    SetPtrSize((Ptr) glob->p_buffer, new_size);    if (err = MemError()) {        /* resizing failed: allocate new block, memcpy, release the old block */        Ptr p = NewPtr(new_size);        if (err = MemError()) goto bail;        BlockMoveData(glob->p_buffer, p, glob->p_buffer_used);        DisposePtr((Ptr) glob->p_buffer);        glob->p_buffer = (UInt8 *) p;    }    glob->p_buffer_len = new_size; bail:    if (err)        dbg_printf("--:Theora:-  _grow_buffer(%08lx, %ld) failed = %d/n", (long)glob, min_size, err);    return err;}
开发者ID:JanX2,项目名称:XiphQT,代码行数:34,


示例22: MoreFESetComment

pascal OSErr MoreFESetComment(const FSSpecPtr pFSSpecPtr, const Str255 pCommentStr, const AEIdleUPP pIdleProcUPP){	AppleEvent tAppleEvent = {		typeNull, nil	};                                              // If you always init AEDescs, it's always safe to dispose of them.	AEBuildError tAEBuildError;	AEDesc tAEDesc = {		typeNull, nil	};	OSErr anErr = noErr;	anErr = MoreAEOCreateObjSpecifierFromFSSpec(pFSSpecPtr, &tAEDesc);	if (noErr == anErr) {		char *dataPtr = NewPtr(pCommentStr[ 0 ]);		CopyPascalStringToC(pCommentStr, dataPtr);		anErr = AEBuildAppleEvent(		        kAECoreSuite, kAESetData,		        typeApplSignature, &gFinderSignature, sizeof( OSType ),		        kAutoGenerateReturnID, kAnyTransactionID,		        &tAppleEvent, &tAEBuildError,		        "'----':obj {form:prop,want:type(prop),seld:type(comt),from:(@)},data:'TEXT'(@)",		        &tAEDesc, dataPtr);		DisposePtr(dataPtr);		if (noErr == anErr) {			// Send the event. In this case we don't care about the reply			anErr = MoreAESendEventNoReturnValue(pIdleProcUPP, &tAppleEvent);			(void) MoreAEDisposeDesc(&tAppleEvent); // always dispose of AEDescs when you are finished with them		}	}	return anErr;}
开发者ID:r0ssar00,项目名称:platform,代码行数:33,


示例23: MoreAEGetCFStringFromDescriptor

pascal OSErr MoreAEGetCFStringFromDescriptor(const AEDesc* pAEDesc, CFStringRef* pCFStringRef){  AEDesc    uniAEDesc = {typeNull, NULL};  OSErr    anErr;  if (NULL == pCFStringRef)    return paramErr;  anErr = AECoerceDesc(pAEDesc, typeUnicodeText, &uniAEDesc);  if (noErr == anErr)  {    if (typeUnicodeText == uniAEDesc.descriptorType)    {          Size bufSize = AEGetDescDataSize(&uniAEDesc);          Ptr buf = NewPtr(bufSize);          if ((noErr == (anErr = MemError())) && (NULL != buf))          {              anErr = AEGetDescData(&uniAEDesc, buf, bufSize);              if (noErr == anErr)                  *pCFStringRef = CFStringCreateWithCharacters(kCFAllocatorDefault, (UniChar*) buf, bufSize / (Size) sizeof(UniChar));              DisposePtr(buf);          }    }    MoreAEDisposeDesc(&uniAEDesc);  }  return (anErr);}//end MoreAEGetCFStringFromDescriptor
开发者ID:specious,项目名称:osxutils,代码行数:29,


示例24: RemoveLastElement

// Removes a ListElement from the end of the list, copying data if wantedBoolean RemoveLastElement(LinkedList *listPtr){	ElementHandle	moo=listPtr; // address of linked list	if (!*moo) // if the list is empty		return false;		while((**moo).next) // go through list until found second to last element		moo=(ElementHandle)&((**moo).next);			DisposePtr((**moo).data);	DisposePtr((Ptr)*moo);	*moo=0L;		return true;}
开发者ID:MaddTheSane,项目名称:tntbasic,代码行数:17,


示例25: openabout

boolean openabout (boolean flzoom, long ctreservebytes) {		/*	2.1b5 dmb: added ctreservebytes parameter. of non-zero, caller wants us to 	reserve space in the heap below the dialog record (during initialization)	*/		hdlwindowinfo hinfo;	#ifdef MACVERSION	Ptr ptemp = nil;		if (ctreservebytes > 0)		ptemp = NewPtr (ctreservebytes); /*force about window to load high*/#endif	aboutstart ();		shellpatchnilroutines ();	//	aboutwindow = newmodaldialog (128, -1);	newaboutwindow (true);		if (findaboutwindow (&hinfo))		shellupdatenow ((**hinfo).macwindow);	#ifdef MACVERSION	if (ptemp != nil)		DisposePtr (ptemp); /*restore heap space for remaining code segments*/#endif		aboutopenticks = gettickcount ();		return (true);	} /*openabout*/
开发者ID:dvincent,项目名称:frontier,代码行数:35,


示例26: PAS_encodeData

OSErr PAS_encodeData(FSSpec *inFile, short outRefNum){	OSErr 		err;		short		inRefNum;	Ptr 		buffer;	SInt32 		currentRead = 	PAS_BUFFER_SIZE;			buffer	=	NewPtr(currentRead);	err = FSpOpenDF(inFile, fsRdPerm, &inRefNum);	if (err != noErr)	return err;		while ( currentRead > 0 )    {		err	= FSRead( inRefNum, &currentRead, buffer);		if (err != noErr && err != eofErr)	return err;				err = FSWrite(outRefNum, &currentRead, buffer);		if (err != noErr)	return err;	}		FSClose(inRefNum);		DisposePtr(buffer);		return noErr;}
开发者ID:binoc-software,项目名称:mozilla-cvs,代码行数:27,


示例27: sqCopyFilesizetosize

int sqCopyFilesizetosize(char *srcNameIndex, int srcNameSize, char *dstNameIndex, int dstNameSize) {	OSErr error;	FSSpec	srcSpec,dstFileSpec,dstSpec;	char *pointer;	const int desiredBufferSize = 64*1024;	FSpLocationFromFullPath(srcNameSize,srcNameIndex,&srcSpec);	FSpLocationFromFullPath(dstNameSize,dstNameIndex,&dstFileSpec);	FSMakeFSSpecCompat(dstFileSpec.vRefNum, dstFileSpec.parID, "/p:", &dstSpec);#if TARGET_API_MAC_CARBON		pointer = NewPtr(desiredBufferSize);#else	    pointer = NewPtr(desiredBufferSize);	    if (pointer == NULL) 		    pointer = NewPtrSys(desiredBufferSize);	    if (pointer == NULL)   			return false; #endif	error = FSpFileCopy(&srcSpec,						&dstSpec,						dstFileSpec.name,						pointer,						desiredBufferSize,						false);	DisposePtr((void *)pointer);	return error;} 
开发者ID:Geal,项目名称:Squeak-VM,代码行数:28,


示例28: PAS_encodeResource

OSErr PAS_encodeResource(FSSpec *inFile, short outRefNum){	OSErr 			err;		short			inRefNum;	PASResFork		resInfo;	SInt32			currentWrite;		ResType 		*resTypes;	long			typeCount;		short			*ids;	long			idCount;		short			oldResFile;		oldResFile=CurResFile();	inRefNum = FSpOpenResFile(inFile, fsRdPerm);	if (inRefNum < noErr)	return inRefNum;	UseResFile(inRefNum);			memset(&resInfo, 0, sizeof(PASResFork));   		PAS_sortTypes(inRefNum, &resTypes, &typeCount);	resInfo.NumberOfTypes	=	typeCount;		currentWrite	= sizeof(PASResFork);		err = FSWrite(outRefNum, &currentWrite, &resInfo);	if (err != noErr)	return err;		for (typeCount = 0; ((typeCount < resInfo.NumberOfTypes) && (err == noErr)); typeCount++)	{		PAS_sortIDs(inRefNum, resTypes[typeCount], &ids, &idCount);		err = PAS_flattenResource(resTypes[typeCount], ids, idCount, inRefNum, outRefNum);		DisposePtr((Ptr)ids);	}		DisposePtr((Ptr)resTypes);			UseResFile(oldResFile);			CloseResFile(inRefNum);		return err;}
开发者ID:binoc-software,项目名称:mozilla-cvs,代码行数:47,



注:本文中的DisposePtr函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ DisposeRgn函数代码示例
C++ DisposeHandle函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。