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

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

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

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

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


示例2: UpdateAdditionsWin

voidUpdateAdditionsWin(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,


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


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


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


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


示例7: Get1Resource

// Parse a single resourcebool 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,


示例8: pict_from_gworld

PRIVATE PicHandlepict_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,


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


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


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


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


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


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


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


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


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


示例18: runlock

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


示例19: AddPopulateCompInfo

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


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


示例21: GetConfig

OSErr GetConfig(Ptr config){	OSErr			error = noErr;	FSSpec		where;	short			ref;	Handle		theString;	Ptr			temp = nil;	long			len;	config[0] = '/0';											// Start without a name	error = FindPrefs(&where);	ref = FSpOpenResFile(&where, fsRdWrPerm);	if (ref != -1) {		theString = Get1Resource('STR ',kConfigRes);	// Should look in most recent file first		if (theString != nil) {			len = SizeResource(theString);			SetPtrSize(config, len);						// Set the size			error = MemError();								// And make sure it worked			if (error == noErr) {				HLock(theString);				temp = (Ptr)*theString;				memcpy(config, temp, len);				HUnlock(theString);				ReleaseResource(theString);			}		} else {			error = -4;		}		CloseResFile(ref);	} else {		error = ResError();	}	return error;}
开发者ID:jleclanche,项目名称:darkdust-ctp2,代码行数:33,


示例22: 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:andrewsmedina,项目名称:iTerm2,代码行数:34,


示例23: getmacro

short getmacro(NewMacroInfo *macrost, short n, char *dest,				short room) // no more quoteflag! no more kludge!{ // RAB BetterTelnet 2.0b5	Handle macroHandle;	Ptr pos;	long offset, length;	if (n < 0 || n >= NUM_MACROS) {		return -1;		}	// find the macro in the new structure	if (n == 0)  // no offset for this		offset = 0;	else		offset = macrost->index[n];	macroHandle = macrost->handle;	HLock(macroHandle);	pos = *macroHandle;	pos += offset;	length = strlen(pos);	if (length >= room) { // >= compensates for null termination		length = room - 1; // truncate if too long		strncpy(dest, pos, length);		pos += length;		*pos = 0;	} else		strcpy(dest, pos); // or just move it in	HUnlock(macroHandle);	return 0;}
开发者ID:macssh,项目名称:macssh,代码行数:33,


示例24: snd_channel_callback

pascal void snd_channel_callback(SndChannelPtr theChannel,SndCommand* theCommand) {	long theA5;	short channel = -1,i,which_sound;	#ifndef EXILE_BIG_GUNS	theA5 = SetA5(theCommand->param2);#endif		for (i = 0; i < 4; i++)		if (chan[i] == theChannel)			channel = i;	which_sound = snd_played[channel];	snd_played[channel] = -1;	//if (in_startup_mode == false)	//	print_num(0,snd_played[channel],channel);  	if ((sound_going(which_sound) == false) && (load_when_play[which_sound] == true)) {	  	HUnlock(sound_handles[which_sound]);		//if (in_startup_mode == false)		//	print_num(99,snd_played[channel],channel);	}	#ifndef EXILE_BIG_GUNS	theA5 = SetA5(theA5);#endif}
开发者ID:PBrookfield,项目名称:cboe-msvc,代码行数:25,


示例25: getmacrointohandle

// postcondition: returns _LOCKED_ macro handle in desthpshort getmacrointohandle(NewMacroInfo *macrost, short n, Handle *desthp){ // RAB BetterTelnet 2.0b5 - for new sendmacro	Handle macroHandle, desth;	Ptr pos, dest;	long offset, length;	if (n < 0 || n >= NUM_MACROS) {		return -1;		}	// find the macro in the new structure	if (n == 0)  // no offset for this		offset = 0;	else		offset = macrost->index[n];	macroHandle = macrost->handle;	HLock(macroHandle);	pos = *macroHandle;	pos += offset;	length = strlen(pos);	if (!length) return -1; // don't bother if it's null	desth = myNewHandle(length + 1);	if (!desth) return -1; // ouch	HLock(desth);	*desthp = desth;	dest = *desth;	strcpy(dest, pos); // here we go	HUnlock(macroHandle); // that's right, we DON'T unlock the handle into which the macro						  // has been copied (desth), only the global macros handle!	return 0;}
开发者ID:macssh,项目名称:macssh,代码行数:35,


示例26: count_faces

  static short  count_faces( Handle        fond,               const UInt8*  pathname )  {    ResID     sfnt_id;    short     have_sfnt, have_lwfn;    Str255    lwfn_file_name;    UInt8     buff[PATH_MAX];    FT_Error  err;    short     num_faces;    have_sfnt = have_lwfn = 0;    HLock( fond );    parse_fond( *fond, &have_sfnt, &sfnt_id, lwfn_file_name, 0 );    if ( lwfn_file_name[0] )    {      err = lookup_lwfn_by_fond( pathname, lwfn_file_name,                                 buff, sizeof ( buff )  );      if ( !err )        have_lwfn = 1;    }    if ( have_lwfn && ( !have_sfnt || PREFER_LWFN ) )      num_faces = 1;    else      num_faces = count_faces_scalable( *fond );    HUnlock( fond );    return num_faces;  }
开发者ID:Wafflespeanut,项目名称:gecko-dev,代码行数:33,


示例27: setmacro

void setmacro(NewMacroInfo *macrost, short n, char *s) // RAB BetterTelnet 2.0b5{	// note that we don't check MACRO_MAX_LEN anymore - the new structure can handle most any	// size of macro, doesn't use 8-bit length descriptors anywhere (all 16 or 32 bit) -	// however, the final implementation still uses Str255-sized memory spaces. It is the	// responsibility of whoever calls getmacro() to pass a reasonable value for "room"	// to ensure correct truncation of oversized values.	short i;	Handle macroHandle;	Ptr pos;	long offset, offset2, offset3, ohlen, nhlen;	short oslen, nslen; // ..len: o = old, n = new, h = handle, s = string	macroHandle = macrost->handle;	HLock(macroHandle);	pos = *macroHandle;	ohlen = GetHandleSize(macroHandle); // get all the lengths and offsets calculated	if (n)		offset = macrost->index[n];	else offset = 0;	oslen = strlen(pos + offset);	nslen = strlen(s);	nhlen = ohlen - oslen + nslen;	offset2 = offset + oslen + 1; // the end of the old string	offset3 = offset + nslen + 1; // the end of the new strings	if (nhlen > ohlen) {		HUnlock(macroHandle);		SetHandleSize(macroHandle, nhlen); // make sure we have enough room		HLock(macroHandle);		pos = *macroHandle;	}	if (ohlen > offset2) { // move data after the insertion position up or down		BlockMoveData(pos + offset2, pos + offset3, ohlen - offset2);		for (i = n + 1; i < NUM_MACROS; i++) // fix the offsets			macrost->index[i] += offset3 - offset2;	}	HUnlock(macroHandle);	SetHandleSize(macroHandle, nhlen);	HLock(macroHandle);	pos = *macroHandle; // dereference _yet_ _again_ (rrgh)	strcpy(pos+offset, s);	HUnlock(macroHandle);}
开发者ID:macssh,项目名称:macssh,代码行数:46,


示例28: P0

P0(PUBLIC pascal trap, LONGINT, LoadScrap){    OSErr retval;    INTEGER f;    LONGINT l = Cx(ScrapSize);        if (ScrapState == 0) {        retval = FSOpen(MR(ScrapName), CW (BootDrive), &f);        if (retval != noErr)            return(retval);        HUnlock(MR(ScrapHandle));        ReallocHandle(MR(ScrapHandle), (Size)Cx(ScrapSize));	if (MemErr != noErr)/*-->*/	    return Cx(MemErr);        HLock(MR(ScrapHandle));        retval = FSReadAll(f, &l, STARH(MR(ScrapHandle)));        HUnlock(MR(ScrapHandle));        if (retval != noErr)            return(retval);        SetEOF(f, (LONGINT) 0);        FSClose(f);        ScrapState = CWC (1);    }    return(Cx(ScrapState) > 0 ? noErr : noScrapErr);}
开发者ID:LarBob,项目名称:executor,代码行数:26,



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


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