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

C++ HUnlock函数代码示例

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

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



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

示例1: CurResFile

char *__PHYSFS_platformGetUserName(void)
{
    char *retval = NULL;
    StringHandle strHandle;
    short origResourceFile = CurResFile();

    /* use the System resource file. */
    UseResFile(0);
    /* apparently, -16096 specifies the username. */
    strHandle = GetString(-16096);
    UseResFile(origResourceFile);
    BAIL_IF_MACRO(strHandle == NULL, NULL, NULL);

    HLock((Handle) strHandle);
    retval = (char *) malloc((*strHandle)[0] + 1);
    if (retval == NULL)
    {
        HUnlock((Handle) strHandle);
        BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL);
    } /* if */
    memcpy(retval, &(*strHandle)[1], (*strHandle)[0]);
    retval[(*strHandle)[0]] = '\0';  /* null-terminate it. */
    HUnlock((Handle) strHandle);

    return(retval);
} /* __PHYSFS_platformGetUserName */
开发者ID:newerthcom,项目名称:savagerebirth,代码行数:26,代码来源:macclassic.c


示例2: UpdateAdditionsWin

void
UpdateAdditionsWin(void)
{
	Rect		r;
	Cell		c;
	int			i;
	GrafPtr		oldPort;
	GetPort(&oldPort);
	
	SetPort(gWPtr);
	
	MoveTo( gControls->aw->compListBox.left, gControls->aw->compListBox.top - kInterWidgetPad + 1);
	HLock(gControls->cfg->selAddMsg);
	DrawString( CToPascal(*gControls->cfg->selAddMsg));
	HUnlock(gControls->cfg->selAddMsg);
	
#if 0
	RGBColor backColorOld;
    Rect adjustedRect, *clRect = &gControls->aw->compListBox;
    SetRect(&adjustedRect, clRect->left, clRect->top+1, clRect->right, clRect->bottom-1);
    GetBackColor(&backColorOld);
    BackColor(whiteColor);
    EraseRect(&adjustedRect);
    RGBBackColor(&backColorOld);
#endif
   
	LUpdate( (*gControls->aw->compList)->port->visRgn, gControls->aw->compList);
	SetRect(&r, gControls->aw->compListBox.left, gControls->aw->compListBox.top,
	            gControls->aw->compListBox.right + 1, gControls->aw->compListBox.bottom);
	FrameRect(&r);	
	
	SetPt(&c, 0, 0);
	if (LGetSelect(true, &c, gControls->aw->compList))
	{
		HLock((Handle)gControls->aw->compDescTxt);
		SetRect(&r, (*gControls->aw->compDescTxt)->viewRect.left,
					(*gControls->aw->compDescTxt)->viewRect.top,
					(*gControls->aw->compDescTxt)->viewRect.right,
					(*gControls->aw->compDescTxt)->viewRect.bottom);
		HUnlock((Handle)gControls->aw->compDescTxt);
		TEUpdate(&r, gControls->aw->compDescTxt);	
	}
	
	DrawDiskSpaceMsgs( gControls->opt->vRefNum );
	
	for (i = 0; i < numRows; i++)
	{
		if (gControls->cfg->comp[rowToComp[i]].highlighted)
		{
			AddInitRowHighlight(i);
			break;
		}
	}
	
	SetPort(oldPort);
}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:56,代码来源:AdditionsWin.c


示例3: unlock_collection

static void unlock_collection(
	struct collection_header *header)
{
	assert(header->collection);
	
	HUnlock((Handle)header->collection);
	HUnlock((Handle)header->shading_tables);
	
	return;
}
开发者ID:DrItanium,项目名称:moo,代码行数:10,代码来源:shapes_macintosh.c


示例4: fixMacros

// This routine makes sure there is at least a null byte (and accompanying index)
// for every defined macro numbered n such that n < NUM_MACROS
// It lengthens the handle if necessary (backwards compatibility),
// but does NOT truncate additional data (forwards compatibility).
void fixMacros(NewMacroInfo *macrost)
{
	Handle macroHandle;
	Ptr macroPtr, pos;
	long len, len2;
	short i, num;

	macroHandle = macrost->handle;
	HLock(macroHandle);
	macroPtr = *macroHandle;
	len = macrost->index[0];
	pos = macroPtr;
	pos += (len - 1);

	if (*pos != 0) {
		len++;
		HUnlock(macroHandle);
		SetHandleSize(macroHandle, len);
		HLock(macroHandle);
		macroPtr = *macroHandle;
		pos = macroPtr + (len - 1);
		*pos = 0;
	}

	num = 0;
	for (i = 1; i < NUM_MACROS; i++) {
		if (macrost->index[i] == 0) {
			num = i;
			break;
		}
	}

	if (num) {
		len2 = len;
		len += (NUM_MACROS - num);
		HUnlock(macroHandle);
		SetHandleSize(macroHandle, len);
		HLock(macroHandle);
		macroPtr = *macroHandle;
		pos = macroPtr + len2;
		for (i = num; i < NUM_MACROS; i++, pos++) {
			*pos = 0;
			macrost->index[i] = pos - macroPtr;
		}
	}

	HUnlock(macroHandle);
	macrost->index[0] = len;
}
开发者ID:macssh,项目名称:macssh,代码行数:53,代码来源:macros.c


示例5: 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


示例6: GetToolname

OSErr GetToolname(char* toolName)
{
	OSErr			error = noErr;
	FSSpec		where;
	short			ref;
	Handle		theString;
	toolName[0] = '\0';													// Start without a name
	error = FindPrefs(&where);
	ref = FSpOpenResFile(&where, fsRdWrPerm);
	if (ref != -1) {
		theString = Get1Resource('STR ',kToolNameRes);			// Should look in most recent file first
		if (theString != nil) {
			HLock(theString);
			memcpy(toolName, *theString, (*theString)[0] + 1);
			HUnlock(theString);
			ReleaseResource(theString);
		} else {
			error = -5;
		}
		CloseResFile(ref);
		if (error == noErr) {											// CTB is touchy; make sure this tool exists
			error = VerifyToolExists(toolName);
		}
	} else {
		error = ResError();
	}

	return error;
}
开发者ID:jleclanche,项目名称:darkdust-ctp2,代码行数:29,代码来源:CTBStuff.c


示例7: Get1Resource

// Parse a single resource
bool XML_ResourceFork::ParseResource(ResType Type, short ID)
{
    ResourceHandle = Get1Resource(Type,ID);
    if (ResourceHandle == NULL) {
        return false;
    }

    HLock(ResourceHandle);
    if (!DoParse()) {
        const char *Name = SourceName ? SourceName : "[]";
#ifdef TARGET_API_MAC_CARBON
        csprintf(
            temporary,
            "There were configuration-file parsing errors in resource %hd of object %s",
            ID,Name);
        SimpleAlert(kAlertStopAlert,temporary);
#else
        psprintf(
            ptemporary,
            "There were configuration-file parsing errors in resource %hd of object %s",
            ID,Name);
        ParamText(ptemporary,0,0,0);
        Alert(FatalErrorAlert,NULL);
#endif
        ExitToShell();
    }
    HUnlock(ResourceHandle);
    ReleaseResource(ResourceHandle);
    return true;
}
开发者ID:blezek,项目名称:marathon-ios,代码行数:31,代码来源:XML_ResourceFork.cpp


示例8: pict_from_gworld

PRIVATE PicHandle
pict_from_gworld (GWorldPtr gp, int *lenp)
{
  PicHandle retval;

  if (!gp)
    retval = NULL;
  else
    {
      Rect pict_frame;
      PixMapHandle pm;

      pm = GetGWorldPixMap (gp);
      pict_frame = PIXMAP_BOUNDS (pm);
      retval = OpenPicture (&pict_frame);
      if (retval)
	{
	  ClipRect (&pict_frame);
	  HLock ((Handle) pm);
	  CopyBits ((BitMap *) STARH (pm), PORT_BITS_FOR_COPY (thePort),
		    &pict_frame, &pict_frame, srcCopy, NULL);
	  HUnlock ((Handle) pm);
	  ClosePicture ();
	}
    }
  return retval;
}
开发者ID:LarBob,项目名称:executor,代码行数:27,代码来源:scrap.c


示例9: free_all_alloc_pools

void	free_all_alloc_pools()
{
    PoolHandlePtr p, q;
    long count;

    if ( poolList == 0 ) return;
    assert( *poolList != 0 );

    // loop through the allocated blocks and free them
    p = *poolList;
    count = GetHandleSize( (Handle)poolList )/sizeof(PoolHandle);

    q = p + count;

    HLock( (Handle)poolList );
    while (p<q) {
        if ( *p != 0 )
            DisposeHandle( (Handle)*p );
        *p = 0;
        p++;
    }
    HUnlock( (Handle)poolList );

    DisposeHandle( (Handle)poolList );
    poolList = 0;

    // reset the alloc mechanism
    uninitialize_memory_pool();
}
开发者ID:hoelzl,项目名称:gwydion-2.4-cleanup,代码行数:29,代码来源:pool_alloc.plugin.c


示例10: PushCalcEntry

void PushCalcEntry(CtlRecHndl entryBox)
{
    abCalcOp *op;

    GetLETextByID(gCalcWinPtr, abCalcEntryBox, &gStrBuf);

    if (gStrBuf.textLength > 0) {
        gStrBuf.text[gStrBuf.textLength] = '\0';

        op = abCalcOpLookup(gStrBuf.text);

        if (op != NULL) {
            op->execute();
        } else if (abCalcParseExpr(&gNDAExpr, gStrBuf.text) != NULL) {
            abCalcStackExprPush(&gNDAExpr);
        } else {
            LERecHndl leHandle;

            HLock((Handle)entryBox);
            leHandle = (LERecHndl)(*entryBox)->ctlData;
            HUnlock((Handle)entryBox);

            LESetSelect(0, gStrBuf.textLength, leHandle);
            abCalcRaiseError(abCalcSyntaxError, NULL);
            return;
        }

        gStrBuf.textLength = 0;
        SetLETextByID(gCalcWinPtr, abCalcEntryBox, &gStrBuf);
    }
}
开发者ID:jeremysrand,项目名称:abCalc,代码行数:31,代码来源:abCalcNDA.c


示例11: XIconToIPIcon

/* convert icns(icons for MacOS X) to IPIcon */
OSErr	XIconToIPIcon(const FSSpec *theFile,IPIconRec *ipIcon)
{
	OSErr	err;
	IconFamilyHandle	theIconFamily;
	short		refNum;
	long		count;
	
	if (isIconServicesAvailable)
	{
		/* open icns file */
		err=FSpOpenDF(theFile,fsRdPerm,&refNum);
		if (err!=noErr) return err;
		
		err=GetEOF(refNum,&count);
		if (err!=noErr)
		{
			FSClose(refNum);
			return err;
		}
		theIconFamily=(IconFamilyHandle)NewHandle(count);
		HLock((Handle)theIconFamily);
		err=FSRead(refNum,&count,*theIconFamily);
		HUnlock((Handle)theIconFamily);
		
		err=FSClose(refNum);
		
		/* convert IconFamily to IPIcon */
		err=IconFamilyToIPIcon(theIconFamily,ipIcon);
		
		DisposeHandle((Handle)theIconFamily);
		return err;
	}
	else
		return -1;
}
开发者ID:amatubu,项目名称:iconparty,代码行数:36,代码来源:IPIconSupport.c


示例12: ResObj_tp_init

static int ResObj_tp_init(PyObject *_self, PyObject *_args, PyObject *_kwds)
{
    char *srcdata = NULL;
    int srclen = 0;
    Handle itself;
    char *kw[] = {"itself", 0};

    if (PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, ResObj_Convert, &itself))
    {
        ((ResourceObject *)_self)->ob_itself = itself;
        return 0;
    }
    PyErr_Clear();
    if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "|s#", kw, &srcdata, &srclen)) return -1;
    if ((itself = NewHandle(srclen)) == NULL)
    {
        PyErr_NoMemory();
        return 0;
    }
    ((ResourceObject *)_self)->ob_itself = itself;
    if (srclen && srcdata)
    {
        HLock(itself);
        memcpy(*itself, srcdata, srclen);
        HUnlock(itself);
    }
    return 0;
}
开发者ID:0xcc,项目名称:python-read,代码行数:28,代码来源:_Resmodule.c


示例13: NewHandle

static PyObject *Res_Handle(PyObject *_self, PyObject *_args)
{
    PyObject *_res = NULL;

    char *buf;
    int len;
    Handle h;
    ResourceObject *rv;

    if (!PyArg_ParseTuple(_args, "s#", &buf, &len))
        return NULL;
    h = NewHandle(len);
    if ( h == NULL ) {
        PyErr_NoMemory();
        return NULL;
    }
    HLock(h);
    memcpy(*h, buf, len);
    HUnlock(h);
    rv = (ResourceObject *)ResObj_New(h);
    rv->ob_freeit = PyMac_AutoDisposeHandle;
    _res = (PyObject *)rv;
    return _res;

}
开发者ID:0xcc,项目名称:python-read,代码行数:25,代码来源:_Resmodule.c


示例14: FindFolderPath

void FindFolderPath( Handle appendPathTo, int folderType, Str255  pathInFolder )
{
	OSErr err;
	short vRefNum;
	long dirID;
	long appendPathToLength;
	short pathLength;
	Handle path;
		
	// Try to get the application support folder
	err = FindFolder( kOnSystemDisk, folderType, FALSE, &vRefNum, &dirID );
	if( ! err )
	{		
		// Find the mindy:libraries dir and get its full path
		// Resize the destination handle to fit,
		// then copy in the path and the sub-path
		err = GetFullPath( vRefNum, dirID, "\p", &pathLength, &path );
		if( ! err )
		{
			appendPathToLength = GetHandleSize( appendPathTo );
			SetHandleSize( appendPathTo,  appendPathToLength+ pathLength + pathInFolder[ 0 ] );
			err = MemError();
			if( ! err )
			{
				HLock( appendPathTo );
				HLock( path );
					BlockMove( *path, &((*appendPathTo)[ appendPathToLength ]),  pathLength );
					BlockMove( &(pathInFolder[ 1 ]), &((*appendPathTo)[ appendPathToLength + pathLength ])  ,  pathInFolder[ 0 ] );
				HUnlock( path );
				HLock( appendPathTo );
			}
		}
	}
开发者ID:dylan-hackers,项目名称:GD_2_4,代码行数:33,代码来源:runner.c


示例15: BuildLibPath

void BuildLibPath( void )
{
	Handle searchPath;
	
	// make the search path handle 
	// and fill it with the initial search path
	// use strlen neat so as to chop off trailing null!
	searchPath = NewHandle( strlen( INITIAL_SEARCH_PATH ) );
	if( (searchPath != NULL) && ( ResError() == noErr ) )
	{
		HLock( searchPath );
			BlockMove( INITIAL_SEARCH_PATH, *searchPath, strlen( INITIAL_SEARCH_PATH  ) );
		HUnlock( searchPath );
			
		// Try to get the application support folder
		FindFolderPath( searchPath, kApplicationSupportFolderType, FOLDER_SEARCH_PATH );
		
		// Try to get the extensions folder
		FindFolderPath( searchPath, kExtensionFolderType, FOLDER_SEARCH_PATH  );
		
		// lock it out of the way, 
		// null terminate it, overwriting the last \t, making a c string
		// and set LIBDIR to it
		HLockHi( searchPath );
		(*searchPath)[ GetHandleSize( searchPath ) -1 ] = '\0';
		LIBDIR = *searchPath;
	}
}
开发者ID:dylan-hackers,项目名称:GD_2_4,代码行数:28,代码来源:runner.c


示例16: __sys_alloc

void * __sys_alloc(mem_size size, struct mem_pool_obj * )
{
    PoolHandlePtr slot;
    OSErr err;

    slot = NewPoolListSlot();
    assert ( slot != 0 );

    // (slot is dereferenced from poolList, and we dont want it to move)
    HLock( (Handle)poolList );

    // Allocate a new handle.
    // Use temporary memory if asked to.
    // Use application heap if temporary memory fails.
    if (use_temporary_memory)
        *slot = (PoolHandle)TempNewHandle( size, &err );
    if ( !use_temporary_memory || *slot == nil || err!=noErr )
        *slot = (PoolHandle)NewHandle( size );

    assert( *slot != 0 );
    HUnlock( (Handle)poolList );

    HLock( *slot );

    return(**slot);
}
开发者ID:hoelzl,项目名称:gwydion-2.4-cleanup,代码行数:26,代码来源:pool_alloc.plugin.c


示例17: mac_updatelicence

static void mac_updatelicence(WindowPtr window)
{
    Handle h;
    int len;
    long fondsize;
    Rect textrect;

    SetPort((GrafPtr)GetWindowPort(window));
    BeginUpdate(window);
    fondsize = GetScriptVariable(smRoman, smScriptSmallFondSize);
    TextFont(HiWord(fondsize));
    TextSize(LoWord(fondsize));
    h = Get1Resource('TEXT', wLicence);
    len = GetResourceSizeOnDisk(h);
#if TARGET_API_MAC_CARBON
    GetPortBounds(GetWindowPort(window), &textrect);
#else
    textrect = window->portRect;
#endif
    if (h != NULL) {
	HLock(h);
	TETextBox(*h, len, &textrect, teFlushDefault);
	HUnlock(h);
    }
    EndUpdate(window);
}
开发者ID:svn2github,项目名称:kitty,代码行数:26,代码来源:macabout.c


示例18: runlock

void runlock(
	handle h)
{
	HUnlock((Handle)h);
	
	return;
}
开发者ID:DrItanium,项目名称:moo,代码行数:7,代码来源:macintosh_utilities.c


示例19: AddPopulateCompInfo

Boolean
AddPopulateCompInfo()
{
	int 	i;
	char	*currDesc;
	Point	currCell;
	Boolean bCellSelected = false;
	int		nextRow = 0;
	
	for (i=0; i<gControls->cfg->numComps; i++)
	{
		if (!gControls->cfg->comp[i].invisible && gControls->cfg->comp[i].additional)
		{
			HLock(gControls->cfg->comp[i].shortDesc);
			currDesc = *gControls->cfg->comp[i].shortDesc;
			SetPt(&currCell, 0, nextRow);
			rowToComp[nextRow++] = i;
			LSetCell( currDesc, strlen(currDesc), currCell, gControls->aw->compList);
			HUnlock(gControls->cfg->comp[i].shortDesc);
			if (gControls->cfg->comp[i].selected == true)
			{
				LSetSelect(true, currCell, gControls->aw->compList);
				bCellSelected = true;
			}
		}
	}

	numRows = nextRow;	
	return bCellSelected;
}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:30,代码来源:AdditionsWin.c


示例20: GetResource

char *getpstr(
	char *buffer,
	short resource_number,
	short string_number)
{
	Handle strings= GetResource('STR#', resource_number);

	assert(strings);
	if (strings)
	{
		short count;
		byte *string_address;
		
		vassert(string_number>=0&&string_number<**((short**)strings),
			csprintf(temporary, "asked for #%d/#%d in 'STR#' ID#%d", string_number, **((short**)strings), resource_number));
		
		HLock(strings);
		count= 0;
		string_address= ((byte *)*strings)+2;
		while (count++<string_number)
		{
			string_address+= *string_address+1;
		}
		pstrcpy(buffer, (const char *)string_address);
		HUnlock(strings);
	}
	else
	{
		*buffer= '\0';
	}
	
	return buffer;
}
开发者ID:DrItanium,项目名称:moo,代码行数:33,代码来源:macintosh_utilities.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ HWCRHKerr函数代码示例发布时间:2022-05-30
下一篇:
C++ HUDInitMessage函数代码示例发布时间: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