当前位置: 首页>>代码示例>>C++>>正文


C++ DisposeHandle函数代码示例

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


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

示例1: LoadAudioUnits

void LoadAudioUnits()
{
   ComponentDescription desc;
   Component component;
   
   desc.componentType = kAudioUnitType_Effect; //'aufx'
   desc.componentSubType = 0;
   desc.componentManufacturer = 0;
   desc.componentFlags = 0;
   desc.componentFlagsMask = 0;
   
   component = FindNextComponent(NULL, &desc);
   while (component != NULL) {
      ComponentDescription found;
      Handle nameHandle = NewHandle(0);
      GetComponentInfo(component, &found, nameHandle, 0, 0);
      HLock(nameHandle);
      int len = ((const char *)(*nameHandle))[0];
      wxString name((const char *)(*nameHandle)+1, len);
      HUnlock(nameHandle);
      DisposeHandle(nameHandle);

      Effect::RegisterEffect(new AudioUnitEffect(name, component));

      component = FindNextComponent (component, &desc);
   }
}
开发者ID:Kirushanr,项目名称:audacity,代码行数:27,代码来源:LoadAudioUnits.cpp

示例2: Dispose

void ComponentMover_c::Dispose ()
{
	if (pattern1) {
		pattern1 -> Dispose();
		delete pattern1;
		pattern1 = nil;
	}
	if (pattern2) {
		pattern2 -> Dispose();
		delete pattern2;
		pattern2 = nil;
	}
	//For pyGnome, let python/cython manage memory for this object.	
#ifndef pyGNOME
	if (timeFile)
	{
		timeFile -> Dispose ();
		delete timeFile;
		timeFile = nil;
	}
	if (fAveragedWindsHdl)
	{
		DisposeHandle((Handle)fAveragedWindsHdl);
		fAveragedWindsHdl = 0;
	}
#endif
	CurrentMover_c::Dispose ();
}
开发者ID:liuy0813,项目名称:PyGnome,代码行数:28,代码来源:ComponentMover_c.cpp

示例3: SaveSettingsPreference

//----------------------------------------
// SaveSettingsPreference
//    Saves a preference for a specified key from QuickTime UserData
OSErr SaveSettingsPreference(CFStringRef inKey, UserData inUserData)
{
  CFDataRef theCFSettings;
  Handle    hSettings;
  OSErr     err;

  if (NULL == inUserData) return paramErr;

  hSettings = NewHandle(0);
  err = MemError();

  if (noErr == err) {
    err = PutUserDataIntoHandle(inUserData, hSettings);

    if (noErr == err) {
      HLock(hSettings);

      theCFSettings = CFDataCreate(kCFAllocatorDefault,
                                   (UInt8 *)*hSettings,
                                   GetHandleSize(hSettings));
      if (theCFSettings) {
        CFPreferencesSetAppValue(inKey, theCFSettings,
                                 kCFPreferencesCurrentApplication);
        CFPreferencesAppSynchronize(kCFPreferencesCurrentApplication);
        CFRelease(theCFSettings);
      }
    }

    DisposeHandle(hSettings);
  }

  return err;
}
开发者ID:burningneutron,项目名称:openFrameworks,代码行数:36,代码来源:ofxQtUtils_alpha.cpp

示例4: copyIconDataForURL

CFDataRef copyIconDataForURL(CFURLRef URL) {
	CFDataRef data = NULL;

	if (URL) {
		FSRef ref;
		if (CFURLGetFSRef(URL, &ref)) {
			IconRef icon = NULL;
			SInt16 label_noOneCares;
			OSStatus err = GetIconRefFromFileInfo(&ref,
												  /*inFileNameLength*/ 0U, /*inFileName*/ NULL,
												  kFSCatInfoNone, /*inCatalogInfo*/ NULL,
												  kIconServicesNoBadgeFlag | kIconServicesUpdateIfNeededFlag,
												  &icon,
												  &label_noOneCares);
			if (err != noErr) {
				NSLog(CFSTR("in copyIconDataForURL in CFGrowlAdditions: could not get icon for %@: GetIconRefFromFileInfo returned %li\n"), URL, (long)err);
			} else {
				IconFamilyHandle fam = NULL;
				err = IconRefToIconFamily(icon, kSelectorAllAvailableData, &fam);
				if (err != noErr) {
					NSLog(CFSTR("in copyIconDataForURL in CFGrowlAdditions: could not get icon for %@: IconRefToIconFamily returned %li\n"), URL, (long)err);
				} else {
					HLock((Handle)fam);
					data = CFDataCreate(kCFAllocatorDefault, (const UInt8 *)*(Handle)fam, GetHandleSize((Handle)fam));
					HUnlock((Handle)fam);
					DisposeHandle((Handle)fam);
				}
				ReleaseIconRef(icon);
			}
		}
	}

	return data;
}
开发者ID:binoc-software,项目名称:mozilla-cvs,代码行数:34,代码来源:CFGrowlAdditions.c

示例5: ROM_VideoQuit

void ROM_VideoQuit(_THIS)
{
	int i;

	/* Free current video mode */
	ROM_UnsetVideoMode(this, this->screen);
	if ( SDL_Window ) {
		DisposeWindow(SDL_Window);
		SDL_Window = nil;
	}

	/* Free palette and restore original one */
	if ( SDL_CTab != nil ) {
		DisposeHandle((Handle)SDL_CTab);
		SDL_CTab = nil;
	}
	if ( SDL_CPal != nil ) {
		DisposePalette(SDL_CPal);
		SDL_CPal = nil;
	}
	RestoreDeviceClut(GetMainDevice());

#if SDL_MACCLASSIC_GAMMA_SUPPORT
	Mac_QuitGamma(this);
#endif

	/* Free list of video modes */
	if ( SDL_modelist != NULL ) {
		for ( i=0; SDL_modelist[i]; ++i ) {
			SDL_free(SDL_modelist[i]);
		}
		SDL_free(SDL_modelist);
		SDL_modelist = NULL;
	}
}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:35,代码来源:SDL_romvideo.c

示例6: InitMacStuff

/*
=============
InitMacStuff
=============
*/
void InitMacStuff( void ) {
	Handle 		menuBar;
	char		dir[MAX_OSPATH];
	
	// init toolbox
	MaxApplZone();
	MoreMasters();
	
	InitGraf(&qd.thePort);
	InitFonts();
	FlushEvents(everyEvent, 0);
	SetEventMask( -1 );
	InitWindows();
	InitMenus();
	TEInit();
	InitDialogs(nil);
	InitCursor();

	// init menu
	menuBar = GetNewMBar(rMenuBar);
	if(!menuBar) {
		Com_Error( ERR_FATAL, "MenuBar not found.");
	}
	
	SetMenuBar(menuBar);
	DisposeHandle(menuBar);
	AppendResMenu(GetMenuHandle(mApple),'DRVR');
	DrawMenuBar();

	Sys_InitConsole();

	SetEventMask( -1 );
}
开发者ID:5Quintessential,项目名称:jedioutcast,代码行数:38,代码来源:mac_main.c

示例7: findGraphicsExporterComponents

void findGraphicsExporterComponents(_List& compList, _SimpleList& compIndex)
{
    ComponentDescription cd, cd2;
    Component c = 0;
    
    cd.componentType 			= GraphicsExporterComponentType;
    cd.componentSubType 		= 0;
    cd.componentManufacturer 	= 0;
    cd.componentFlags 			= 0;
    cd.componentFlagsMask 		= graphicsExporterIsBaseExporter;
    
    _String	fileFormat;
    
    while( ( c = FindNextComponent( c, &cd ) ) != 0 ) 
    {
    	 Handle     cInfo = NewHandle(256);
    	 GetComponentInfo (c,&cd2,cInfo,nil,nil);
    	 (*cInfo)[**cInfo+1] = 0;
    	 fileFormat = (char*)(*cInfo+1);
    	 if (fileFormat.sLength)
    	 {
    		 compList&& &fileFormat; 
    		 compIndex << (long)c;
    	 } 
    	 DisposeHandle(cInfo);
    }
} 
开发者ID:mdsmith,项目名称:OCLHYPHY,代码行数:27,代码来源:HYPlatformGraphicPane.cpp

示例8: vr_findVerRegName

extern char* vr_findVerRegName()
{
    FSSpec  regSpec;
    OSErr   err;
    short   foundVRefNum;
    long    foundDirID;
    int     bCreate = 0;
    
    /* quick exit if we have the info */
    if ( verRegName != NULL )
        return verRegName;

    err = FindFolder(kOnSystemDisk,'pref', false, &foundVRefNum, &foundDirID);

    if (err == noErr)
    {
        err = FSMakeFSSpec(foundVRefNum, foundDirID, MAC_VERREG, &regSpec);

        if (err == -43) /* if file doesn't exist */
        {
            err = FSpCreate(&regSpec, 'MOSS', 'REGS', smSystemScript);
            bCreate = 1;
        }

        if (err == noErr)
        {
            Handle thePath;
            short pathLen;
            err = FSpGetFullPath(&regSpec, &pathLen, &thePath);
            if (err == noErr && thePath)
            {
                /* we have no idea if this moves memory, so better lock the handle */
             #if defined(STANDALONE_REGISTRY) || defined(USE_STDIO_MODES)
                HLock(thePath);
                verRegName = (char *)XP_ALLOC(pathLen + 1);
                XP_STRNCPY(verRegName, *thePath, pathLen);
                verRegName[pathLen] = '\0';
            #else
                /* Since we're now using NSPR, this HAS to be a unix path! */
                const char* src;
                char* dst;
                HLock(thePath);
                verRegName = (char*)XP_ALLOC(pathLen + 2);
                src = *(char**)thePath;
                dst = verRegName;
                *dst++ = '/';
                while (pathLen--)
                {
                    char c = *src++;
                    *dst++ = (c == ':') ? '/' : c;
                }
                *dst = '\0';
            #endif
            }
            DisposeHandle(thePath);
        }
    }

    return verRegName;
}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:60,代码来源:vr_stubs.c

示例9: GC_MacFreeTemporaryMemory

void GC_MacFreeTemporaryMemory()
{
# if defined(SHARED_LIBRARY_BUILD)
    /* if possible, collect all memory, and invoke all finalizers. */
      perform_final_collection();
# endif

    if (theTemporaryMemory != NULL) {
	long totalMemoryUsed = 0;
	TemporaryMemoryHandle tempMemBlock = theTemporaryMemory;
	while (tempMemBlock != NULL) {
		TemporaryMemoryHandle nextBlock = (**tempMemBlock).nextBlock;
		totalMemoryUsed += GetHandleSize((Handle)tempMemBlock);
		DisposeHandle((Handle)tempMemBlock);
		tempMemBlock = nextBlock;
	}
	theTemporaryMemory = NULL;

#       if !defined(SHARED_LIBRARY_BUILD)
	  if (GC_print_stats) {
            fprintf(stdout, "[total memory used:  %ld bytes.]\n",
                  totalMemoryUsed);
            fprintf(stdout, "[total collections:  %ld.]\n", GC_gc_no);
	  }
#       endif
    }
}
开发者ID:LiaoPengyu,项目名称:bdwgc,代码行数:27,代码来源:MacOS.c

示例10: qt_mac_createCGImageFromQImage

QList<QByteArray> QMacPasteboardMimePict::convertFromMime(const QString &mime, QVariant variant,
                                                          QString flav)
{
    QList<QByteArray> ret;
    if (!resolveMimeQuickTimeSymbols())
        return ret;

    if (!canConvert(mime, flav))
        return ret;
    QCFType<CGImageRef> cgimage = qt_mac_createCGImageFromQImage(qvariant_cast<QImage>(variant));
    Handle pic = NewHandle(0);
    GraphicsExportComponent graphicsExporter;
    ComponentResult result = OpenADefaultComponent(GraphicsExporterComponentType,
                                                   kQTFileTypePicture, &graphicsExporter);
    if (!result) {
        unsigned long sizeWritten;
        result = ptrGraphicsExportSetInputCGImage(graphicsExporter, cgimage);
        if (!result)
            result = ptrGraphicsExportSetOutputHandle(graphicsExporter, pic);
        if (!result)
            result = ptrGraphicsExportDoExport(graphicsExporter, &sizeWritten);

        CloseComponent(graphicsExporter);
    }

    int size = GetHandleSize((Handle)pic);
    // Skip the Picture File header (512 bytes) and feed the raw data
    QByteArray ar(reinterpret_cast<char *>(*pic + 512), size - 512);
    ret.append(ar);
    DisposeHandle(pic);
    return ret;
}
开发者ID:FilipBE,项目名称:qtextended,代码行数:32,代码来源:qmime_mac.cpp

示例11: NewHandle

UInt32 
OPL_DSNList::getSelectedItem()
{
    OSStatus err;
    UInt32 retID = 0;
    UInt32 itemCount;
    Handle itemList = NewHandle(0);

    if (itemList == NULL)
      return 0;

    err = GetDataBrowserItems(m_itemView, kDataBrowserNoItem, false,
	kDataBrowserItemIsSelected, itemList);
    require_noerr(err, error);

    itemCount = GetHandleSize(itemList) / sizeof(DataBrowserItemID);
    if (itemCount != 0)
      {
        DataBrowserItemID *list = (DataBrowserItemID *) *itemList;
        retID = list[0];
      }

    DisposeHandle(itemList);
    return retID;

error:
    return 0;
}
开发者ID:openlink,项目名称:odbc-bench,代码行数:28,代码来源:DSNList.cpp

示例12: qWarning

QVariant QMacPasteboardMimePict::convertToMime(const QString &mime, QList<QByteArray> data, QString flav)
{
    if(data.count() > 1)
        qWarning("QMacPasteboardMimePict: Cannot handle multiple member data");
    QVariant ret;
    if (!resolveMimeQuickTimeSymbols())
        return ret;

    if(!canConvert(mime, flav))
        return ret;
    const QByteArray &a = data.first();

    // This function expects the 512 header (just to skip it, so create the extra space for it).
    Handle pic = NewHandle(a.size() + 512);
    memcpy(*pic + 512, a.constData(), a.size());

    GraphicsImportComponent graphicsImporter;
    ComponentResult result = OpenADefaultComponent(GraphicsImporterComponentType,
                                                   kQTFileTypePicture, &graphicsImporter);
    QCFType<CGImageRef> cgImage;
    if (!result)
        result = ptrGraphicsImportSetDataHandle(graphicsImporter, pic);
    if (!result)
        result = ptrGraphicsImportCreateCGImage(graphicsImporter, &cgImage,
                                             kGraphicsImportCreateCGImageUsingCurrentSettings);
    if (!result)
        ret = QVariant(QPixmap::fromMacCGImageRef(cgImage).toImage());
    CloseComponent(graphicsImporter);
    DisposeHandle(pic);
    return ret;
}
开发者ID:FilipBE,项目名称:qtextended,代码行数:31,代码来源:qmime_mac.cpp

示例13: set_track_clean_aperture_ext

// Create the 'pasp' atom for video tracks. No guesswork required.
// References http://www.uwasa.fi/~f76998/video/conversion/
void set_track_clean_aperture_ext(ImageDescriptionHandle imgDesc, Fixed displayW, Fixed displayH, Fixed pixelW, Fixed pixelH)
{
    if (displayW == pixelW && displayH == pixelH)
        return;

    AVRational dar, invPixelSize, sar;

    dar			   = (AVRational) {
        displayW, displayH
    };
    invPixelSize   = (AVRational) {
        pixelH, pixelW
    };
    sar = av_mul_q(dar, invPixelSize);

    av_reduce(&sar.num, &sar.den, sar.num, sar.den, fixed1);

    if (sar.num == sar.den)
        return;

    PixelAspectRatioImageDescriptionExtension **pasp = (PixelAspectRatioImageDescriptionExtension**)NewHandle(sizeof(PixelAspectRatioImageDescriptionExtension));

    **pasp = (PixelAspectRatioImageDescriptionExtension) {
        EndianU32_NtoB(sar.num), EndianU32_NtoB(sar.den)
    };

    AddImageDescriptionExtension(imgDesc, (Handle)pasp, kPixelAspectRatioImageDescriptionExtension);

    DisposeHandle((Handle)pasp);
}
开发者ID:klimooo,项目名称:perian,代码行数:32,代码来源:ff_private.c

示例14: create_placeholder_track

ComponentResult create_placeholder_track(Movie movie, Track *placeholderTrack, TimeValue duration, Handle dataRef, OSType dataRefType) {
    SampleDescriptionHandle sdH = NULL;
    Media placeholderMedia;
    TimeScale movieTimeScale;
    ComponentResult result = noErr;

    movieTimeScale = GetMovieTimeScale(movie);

    sdH = (SampleDescriptionHandle)NewHandleClear(sizeof(SampleDescription));
    (*sdH)->descSize = sizeof(SampleDescription);

    *placeholderTrack = NewMovieTrack(movie, 0, 0, kNoVolume);
    placeholderMedia = NewTrackMedia(*placeholderTrack, BaseMediaType, movieTimeScale, dataRef, dataRefType);

    result = AddMediaSampleReference(placeholderMedia, 0, 1, duration, sdH, 1, 0, NULL);
    if(result != noErr)
        goto bail;

    result = InsertMediaIntoTrack(*placeholderTrack, -1, 0, duration, fixed1);

bail:
    if (sdH)
        DisposeHandle((Handle) sdH);
    return(result);
}
开发者ID:klimooo,项目名称:perian,代码行数:25,代码来源:ff_private.c

示例15: sImportProc

	static PGPError
sImportProc(
	PFLFileSpecRef		ref,
	PGPByte const *		data,
	PGPSize				dataSize )
{
	const ExportedFileSpec *	exportedData;
	MyData *					newData	= NULL;
	PGPError					err	= kPGPError_NoErr;

	(void) dataSize;
	
	exportedData	= (const ExportedFileSpec *)data;
	newData			= GetMyData( ref );
	
	err	= PGPReallocData( ref->memoryMgr,
			&newData, sizeof( *newData ), 0 );
	if ( IsntPGPError( err ) )
	{
		MyData *		myData	= (MyData *)newData;
		
		ref->data		= (PGPByte *)newData;
		ref->dataSize	= sizeof( *newData );
		
		myData->specIsValid 	= FALSE;
		
		CopyPString( exportedData->name, myData->spec.name );
		
		if( exportedData->aliasDataSize != 0 )
		{
			AliasHandle	alias;
			
			if( PtrToHand( &exportedData->aliasData[0], (Handle *) &alias,
						exportedData->aliasDataSize ) == noErr )
			{
				FSSpec	spec;
				short	aliasCount = 1;
				Boolean	needsUpdate;
				
				if( MatchAlias( NULL, kARMNoUI | kARMSearch,
						alias, &aliasCount, &spec, &needsUpdate, NULL, NULL ) == noErr )
				{
					CInfoPBRec	cpb;
					
					if( FSpGetCatInfo( &spec, &cpb ) == noErr )
					{
						myData->specIsValid = TRUE;
					
						myData->spec.vRefNum 	= spec.vRefNum;
						myData->spec.parID 		= cpb.dirInfo.ioDrDirID;
					}
				}
				
				DisposeHandle( (Handle) alias );
			}
		}
	}
	
	return( err );
}
开发者ID:ysangkok,项目名称:pgp-win32-6.5.8,代码行数:60,代码来源:pgpFileSpecMac.c


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