本文整理汇总了C++中GetHandleSize函数的典型用法代码示例。如果您正苦于以下问题:C++ GetHandleSize函数的具体用法?C++ GetHandleSize怎么用?C++ GetHandleSize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetHandleSize函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: validhandle
boolean validhandle (Handle h) {
if (h == nil)
return (true);
#ifdef MACVERSION
if (GetHandleSize (h) < 0) /*negative length never valid*/
return (false);
return (MemError () == noErr);
#endif
#ifdef WIN95VERSION
if (GlobalSize (h) <= 0)
return (false);
return (true);
#endif
} /*validhandle*/
开发者ID:pombredanne,项目名称:frontier-1,代码行数:20,代码来源:memory.track.c
示例2: CheckStack
/*
** CheckStack checks the size of the search stack (array) to see if there's
** room to push another LevelRec. If not, CheckStack grows the stack by
** another kAdditionalLevelRecs elements.
*/
static OSErr CheckStack(unsigned short stackDepth,
LevelRecHandle searchStack,
Size *searchStackSize)
{
OSErr result;
if ( (*searchStackSize / sizeof(LevelRec)) == (stackDepth + 1) )
{
/* Time to grow stack */
SetHandleSize((Handle)searchStack, *searchStackSize + (kAdditionalLevelRecs * sizeof(LevelRec)));
result = MemError(); /* should be noErr */
*searchStackSize = GetHandleSize((Handle)searchStack);
}
else
{
result = noErr;
}
return ( result );
}
开发者ID:Bluehorn,项目名称:wxPython,代码行数:25,代码来源:Search.c
示例3: ParseMacrosFromHandle
// RAB BetterTelnet 2.0b5
// handle should be locked and detached
void ParseMacrosFromHandle(NewMacroInfo *macrost, Handle theHandle)
{
Ptr macroPtr;
long macroLength;
macroPtr = *theHandle;
macroLength = GetHandleSize(theHandle) - 2;
// format and sanity checks follow
if ((macroLength < 1) || (*macroPtr != '!') || (*(macroPtr + 1) != '\015')) {
DisposeHandle(theHandle);
setupNewMacros(macrost);
return;
} // bah
BlockMoveData(macroPtr + 2, macroPtr, macroLength); // get rid of !CR
HUnlock(theHandle);
SetHandleSize(theHandle, macroLength);
HLock(theHandle);
// now invoke the actual parser
parseNewMacros2(macrost, theHandle);
}
开发者ID:macssh,项目名称:macssh,代码行数:23,代码来源:macros.c
示例4: _GetResource
bool VMacResFile::GetResource( const VString& inType, sLONG inID, VBlob& outData) const
{
outData.Clear();
bool ok = false;
Handle data = NULL;
VError error = _GetResource( inType, inID, &data);
if (error == VE_OK)
{
::LoadResource(data);
OSErr macError = ::ResError();
if (testAssert(macError == noErr))
{
assert(*data != NULL);
::HLock(data);
ok = outData.PutData( *data, GetHandleSize( data)) == VE_OK;
::HUnlock(data);
data = NULL;
}
}
return ok;
}
开发者ID:StephaneH,项目名称:core-XToolbox,代码行数:21,代码来源:XMacResource.cpp
示例5: setmessageverb
static pascal OSErr setmessageverb (const AppleEvent *event, AppleEvent *reply, long refcon) {
#pragma unused (refcon)
OSErr ec;
AEDesc result;
Str255 s;
Handle htext;
long lentext;
Boolean fl;
ec = AEGetParamDesc (event, keyDirectObject, typeChar, &result);
if (ec != noErr)
return (ec);
htext = result.dataHandle;
if (htext == nil)
return (noErr);
lentext = GetHandleSize (htext);
if (lentext > 255)
lentext = 255;
s [0] = (unsigned char) lentext;
BlockMove (*htext, &s [1], lentext);
AEDisposeDesc (&result);
setwindowmessage (s);
fl = true;
ec = AEPutParamPtr (reply, keyDirectObject, typeBoolean, (Ptr) &fl, sizeof (Boolean));
return (ec);
} /*setmessageverb*/
开发者ID:dvincent,项目名称:frontier,代码行数:40,代码来源:main.c
示例6: read_setting_filename
int read_setting_filename(void *handle, const char *key, Filename *result)
{
int fd;
AliasHandle h;
Boolean changed;
OSErr err;
Str255 pkey;
if (handle == NULL) goto out;
fd = *(int *)handle;
UseResFile(fd);
if (ResError() != noErr) goto out;
c2pstrcpy(pkey, key);
h = (AliasHandle)Get1NamedResource(rAliasType, pkey);
if (h == NULL) goto out;
if ((*h)->userType == 'pTTY' && (*h)->aliasSize == sizeof(**h))
memset(result, 0, sizeof(*result));
else {
err = ResolveAlias(NULL, h, &result->fss, &changed);
if (err != noErr && err != fnfErr) goto out;
if ((*h)->userType == 'pTTY') {
long dirid;
StrFileName fname;
/* Tail of record is pascal string contaning leafname */
if (FSpGetDirID(&result->fss, &dirid, FALSE) != noErr) goto out;
memcpy(fname, (char *)*h + (*h)->aliasSize,
GetHandleSize((Handle)h) - (*h)->aliasSize);
err = FSMakeFSSpec(result->fss.vRefNum, dirid, fname,
&result->fss);
if (err != noErr && err != fnfErr) goto out;
}
}
ReleaseResource((Handle)h);
if (ResError() != noErr) goto out;
return 1;
out:
return 0;
}
开发者ID:sdottaka,项目名称:cvsnt-sjis,代码行数:40,代码来源:macstore.c
示例7: NewPoolListSlot
static PoolHandlePtr NewPoolListSlot()
{ // Find or make an empty slot in the list.
// WARNING: returns a pointer to data in an unlocked handle.
PoolHandlePtr p, q;
long count;
const int kInitialSlots = 4;
const int kIncreaseBySlots = 4;
// Initialize the pool list if necessary
if ( poolList == 0 ) {
poolList = (PoolListHandle)NewHandleClear(kInitialSlots*sizeof(Handle));
assert( poolList != 0 );
}
// Find an empty slot in the poolList (if there is one)
count = GetHandleSize( (Handle)poolList )/sizeof(PoolHandle);
p = *poolList;
q = p + count;
while (p<q) {
if ( *p == 0 )
return p;
p++;
}
// Couldn't find and empty slot. Make some.
SetHandleSize( (Handle)poolList, sizeof(PoolHandle) * ( count + kIncreaseBySlots) );
assert( MemError() == noErr );
// Note: poolList might have moved, so we *must* rebuild p and q.
p = *poolList + count;
q = p + kIncreaseBySlots;
while ( p<q ) {
*(p++) = 0;
}
return *poolList + count;
}
开发者ID:hoelzl,项目名称:gwydion-2.4-cleanup,代码行数:40,代码来源:pool_alloc.plugin.c
示例8: defined
ODSize
RealShape::Purge( ODSize )
{
if( fQDRegion ) {
#if defined(_PLATFORM_OS2_) || defined(_PLATFORM_WIN32_) || defined(_PLATFORM_UNIX_)
ODSize size = 0;
fQDRegion.DisposeRgn();
#else
ODSize size = GetHandleSize( (Handle)fQDRegion );
DisposeRgn( fQDRegion );
#endif // IBM Platforms
fQDRegion = kODNULL;
return size;
} else
return 0;
}
开发者ID:OS2World,项目名称:DEV-SAMPLES-IBM_OpenDoc,代码行数:22,代码来源:RealShpe.cpp
示例9: parseNewMacros2
void parseNewMacros2(NewMacroInfo *macrost, Handle macroHandle)
{
Ptr macroPtr, pos;
long macroLength, len;
short i, flag;
macroLength = GetHandleSize(macroHandle);
macroPtr = *macroHandle;
len = macroLength;
pos = macroPtr;
i = 1; // first index is obviously always zero, so we use it as length (see below)
flag = 0;
while (len) {
if (*pos == 13) *pos = 0; // for strlen
pos++;
len--;
}
len = macroLength;
pos = macroPtr;
while ((i < NUM_MACROS) && (len > 1)) { // if len = 1, this is the last char;
// then the index points out of the handle!
if (*pos == 0) {
macrost->index[i] = (pos - macroPtr + 1);
i++;
}
pos++;
len--;
}
macrost->handle = macroHandle;
macrost->index[0] = macroLength; // first index is length of whole shebang
HUnlock(macroHandle);
fixMacros(macrost); // make sure there's an entry for each macro
}
开发者ID:macssh,项目名称:macssh,代码行数:38,代码来源:macros.c
示例10: SpriteUtils_AddPICTImageToKeyFrameSample
OSErr SpriteUtils_AddPICTImageToKeyFrameSample (QTAtomContainer theKeySample, short thePictID, RGBColor *theKeyColor, QTAtomID theID, FixedPoint *theRegistrationPoint, StringPtr theImageName)
{
PicHandle myPicture = NULL;
Handle myCompressedPicture = NULL;
ImageDescriptionHandle myImageDesc = NULL;
OSErr myErr = noErr;
// get picture from resource
myPicture = (PicHandle)GetPicture(thePictID);
if (myPicture == NULL)
myErr = resNotFound;
if (myErr != noErr)
goto bail;
DetachResource((Handle)myPicture);
// convert it to image data compressed by the animation compressor
myErr = ICUtils_RecompressPictureWithTransparency(myPicture, theKeyColor, NULL, &myImageDesc, &myCompressedPicture);
if (myErr != noErr)
goto bail;
// add it to the key sample
HLock(myCompressedPicture);
myErr = SpriteUtils_AddCompressedImageToKeyFrameSample(theKeySample, myImageDesc, GetHandleSize(myCompressedPicture), *myCompressedPicture, theID, theRegistrationPoint, theImageName);
bail:
if (myPicture != NULL)
KillPicture(myPicture);
if (myCompressedPicture != NULL)
DisposeHandle(myCompressedPicture);
if (myImageDesc != NULL)
DisposeHandle((Handle)myImageDesc);
return(myErr);
}
开发者ID:fruitsamples,项目名称:qtactiontargets.win,代码行数:38,代码来源:SpriteUtilities.c
示例11: indexNthWord
static short indexNthWord (Handle htext, short n, short *wordcount) {
short i;
short ctchars;
Boolean inwhite = true;
Boolean thischarwhite;
*wordcount = 0;
ctchars = GetHandleSize (htext);
if (ctchars == 0)
return (0);
for (i = 0; i < ctchars; i++) {
thischarwhite = iswhite ((*htext) [i]);
if (inwhite) {
if (!thischarwhite) {
(*wordcount)++;
if (*wordcount >= n)
return (i + 1); /*returned value is 1-based*/
inwhite = false;
}
}
else {
if (thischarwhite)
inwhite = true;
}
} /*indexNthWord*/
return (0); /*aren't that many words*/
} /*indexNthWord*/
开发者ID:dvincent,项目名称:frontier,代码行数:38,代码来源:wordInfo.c
示例12: size
void CRectTracker::DrawTrackerRect(
LPCRECT lpRect, CWnd* pWndClipTo, CDC* pDC, CWnd* pWnd)
{
// first, normalize the rectangle for drawing
CRect rect = *lpRect;
rect.NormalizeRect();
// convert to client coordinates
if (pWndClipTo != NULL)
{
pWnd->ClientToScreen(&rect);
pWndClipTo->ScreenToClient(&rect);
}
CSize size(0, 0);
if (!m_bFinalErase)
{
// otherwise, size depends on the style
if (m_nStyle & hatchedBorder)
{
size.cx = size.cy = max(1, GetHandleSize(rect)-1);
rect.InflateRect(size);
}
else
{
size.cx = CX_BORDER;
size.cy = CY_BORDER;
}
}
// and draw it
if (m_bFinalErase || !m_bErase)
pDC->DrawDragRect(rect, size, m_rectLast, m_sizeLast);
// remember last rectangles
m_rectLast = rect;
m_sizeLast = size;
}
开发者ID:rickerliang,项目名称:OpenNT,代码行数:38,代码来源:trckrect.cpp
示例13: QTUtils_FindUserDataItemWithPrefix
static long QTUtils_FindUserDataItemWithPrefix (UserData theUserData, OSType theType, char *thePrefix)
{
Handle myData = NULL;
long myCount = 0;
long myIndex = 0;
long myItemIndex = 0;
OSErr myErr = noErr;
// make sure we've got some valid user data
if (theUserData == NULL)
goto bail;
// allocate a handle for GetUserData
myData = NewHandle(0);
if (myData == NULL)
goto bail;
myCount = CountUserDataType(theUserData, theType);
for (myIndex = 1; myIndex <= myCount; myIndex++) {
myErr = GetUserData(theUserData, myData, theType, myIndex);
if (myErr == noErr) {
if (GetHandleSize(myData) < strlen(thePrefix))
continue;
// see if the user data begins with the specified prefix (IdenticalText is case-insensitive)
if (IdenticalText(*myData, thePrefix, strlen(thePrefix), strlen(thePrefix), NULL) == 0) {
myItemIndex = myIndex;
goto bail;
}
}
}
bail:
if (myData != NULL)
DisposeHandle(myData);
return(myItemIndex);
}
开发者ID:fruitsamples,项目名称:qtactiontargets.win,代码行数:38,代码来源:QTActionTargets.c
示例14:
/*e*/
TClut &TClut::operator=(const TClut ©Me)
{
if (copyMe.ctab)
{
Size size=GetHandleSize((Handle)copyMe.ctab);
if (ctab)
BetterSetHandleSize((Handle)ctab,size,0);
else
{
ctab=(CTabHandle)NewHandle(size);
ThrowIfMemFull_(ctab);
}
BlockMove(*copyMe.ctab,*ctab,size);
}
else
{
if (ctab)
DisposeHandle((Handle)ctab);
ctab=0L;
}
return *this;
}
开发者ID:MaddTheSane,项目名称:tntbasic,代码行数:24,代码来源:TClut.cpp
示例15: UnRef
void wxMetafile::SetHMETAFILE(WXHMETAFILE mf)
{
UnRef() ;
m_refData = new wxMetafileRefData;
M_METAFILEDATA->m_metafile = (PicHandle) mf;
#if wxMAC_USE_CORE_GRAPHICS
size_t sz = GetHandleSize( (Handle) M_METAFILEDATA->m_metafile ) ;
wxMemoryBuffer* membuf = new wxMemoryBuffer( sz ) ;
void * data = membuf->GetWriteBuf(sz) ;
memcpy( data , *M_METAFILEDATA->m_metafile , sz ) ;
membuf->UngetWriteBuf(sz) ;
CGDataProviderRef provider = CGDataProviderCreateWithData( membuf , data , sz ,
wxMacMemoryBufferReleaseProc ) ;
M_METAFILEDATA->m_qdPictRef = NULL ;
if ( provider != NULL )
{
M_METAFILEDATA->m_qdPictRef = QDPictCreateWithProvider( provider ) ;
CGDataProviderRelease( provider ) ;
}
#endif
}
开发者ID:HackLinux,项目名称:chandler-1,代码行数:23,代码来源:metafile.cpp
示例16: FT_New_Face_From_SFNT
/* Create a new FT_Face from an SFNT resource, specified by res ID. */
static
FT_Error FT_New_Face_From_SFNT( FT_Library library,
short sfnt_id,
FT_Long face_index,
FT_Face* aface )
{
Handle sfnt = NULL;
FT_Byte* sfnt_data;
size_t sfnt_size;
FT_Stream stream = NULL;
FT_Error error = 0;
FT_Memory memory = library->memory;
sfnt = GetResource( 'sfnt', sfnt_id );
if ( ResError() )
return FT_Err_Invalid_Handle;
sfnt_size = (FT_ULong)GetHandleSize( sfnt );
if ( ALLOC( sfnt_data, (FT_Long)sfnt_size ) )
{
ReleaseResource( sfnt );
return error;
}
HLock( sfnt );
memcpy( sfnt_data, *sfnt, sfnt_size );
HUnlock( sfnt );
ReleaseResource( sfnt );
return open_face_from_buffer( library,
sfnt_data,
sfnt_size,
face_index,
"truetype",
aface );
}
开发者ID:Joincheng,项目名称:lithtech,代码行数:38,代码来源:ftmac.c
示例17: MakeXIconWithIPIcon
/* create icns(icon for MacOS X) with IPIcon */
OSErr MakeXIconWithIPIcon(const FSSpec *theFile,const IPIconRec *ipIcon)
{
OSErr err;
FInfo fndrInfo;
short refNum;
IconFamilyHandle iconFamily;
long count;
if (!isIconServicesAvailable) return -1;
/* convert IPIcon to icns */
err=IPIconToIconFamily(ipIcon,&iconFamily);
if (err!=noErr) return err;
/* create a file */
err=FSpGetFInfo(theFile,&fndrInfo);
if (err==fnfErr)
err=FSpCreate(theFile,kIconPartyCreator,kXIconFileType,smSystemScript);
if (err!=noErr) return err;
/* open the file */
err=FSpOpenDF(theFile,fsWrPerm,&refNum);
if (err!=noErr) return err;
/* save icns */
HLock((Handle)iconFamily);
count=GetHandleSize((Handle)iconFamily);
err=FSWrite(refNum,&count,*iconFamily);
err=SetEOF(refNum,count);
HUnlock((Handle)iconFamily);
DisposeHandle((Handle)iconFamily);
/* close the file */
err=FSClose(refNum);
return noErr;
}
开发者ID:amatubu,项目名称:iconparty,代码行数:38,代码来源:IPIconSupport.c
示例18: FindPoolListSlot
static PoolHandlePtr FindPoolListSlot(void *ptr)
{ // Find the slot used by a pointer.
// WARNING: returns a pointer to data in an unlocked handle.
PoolHandlePtr p, q;
long count;
assert( poolList != 0 && *poolList != 0 );
// find the slot in the pool list that refers to ptr
p = *poolList;
count = GetHandleSize( (Handle)poolList )/sizeof(PoolHandle);
q = p + count;
while (p<q) {
if ( **p == ptr )
return p;
p++;
}
// Not found.
return 0;
}
开发者ID:hoelzl,项目名称:gwydion-2.4-cleanup,代码行数:24,代码来源:pool_alloc.plugin.c
示例19: os
NS_IMETHODIMP
nsMacShellService::OnStateChange(nsIWebProgress* aWebProgress,
nsIRequest* aRequest,
uint32_t aStateFlags,
nsresult aStatus)
{
if (aStateFlags & STATE_STOP) {
nsCOMPtr<nsIObserverService> os(do_GetService("@mozilla.org/observer-service;1"));
if (os)
os->NotifyObservers(nullptr, "shell:desktop-background-changed", nullptr);
bool exists = false;
mBackgroundFile->Exists(&exists);
if (!exists)
return NS_OK;
nsAutoCString nativePath;
mBackgroundFile->GetNativePath(nativePath);
AEDesc tAEDesc = { typeNull, nil };
OSErr err = noErr;
AliasHandle aliasHandle = nil;
FSRef pictureRef;
OSStatus status;
// Convert the path into a FSRef
status = ::FSPathMakeRef((const UInt8*)nativePath.get(), &pictureRef,
nullptr);
if (status == noErr) {
err = ::FSNewAlias(nil, &pictureRef, &aliasHandle);
if (err == noErr && aliasHandle == nil)
err = paramErr;
if (err == noErr) {
// We need the descriptor (based on the picture file reference)
// for the 'Set Desktop Picture' apple event.
char handleState = ::HGetState((Handle)aliasHandle);
::HLock((Handle)aliasHandle);
err = ::AECreateDesc(typeAlias, *aliasHandle,
GetHandleSize((Handle)aliasHandle), &tAEDesc);
// unlock the alias handler
::HSetState((Handle)aliasHandle, handleState);
::DisposeHandle((Handle)aliasHandle);
}
if (err == noErr) {
AppleEvent tAppleEvent;
OSType sig = 'MACS';
AEBuildError tAEBuildError;
// Create a 'Set Desktop Pictue' Apple Event
err = ::AEBuildAppleEvent(kAECoreSuite, kAESetData, typeApplSignature,
&sig, sizeof(OSType), kAutoGenerateReturnID,
kAnyTransactionID, &tAppleEvent, &tAEBuildError,
"'----':'obj '{want:type (prop),form:prop" \
",seld:type('dpic'),from:'null'()},data:(@)",
&tAEDesc);
if (err == noErr) {
AppleEvent reply = { typeNull, nil };
// Sent the event we built, the reply event isn't necessary
err = ::AESend(&tAppleEvent, &reply, kAENoReply, kAENormalPriority,
kNoTimeOut, nil, nil);
::AEDisposeDesc(&tAppleEvent);
}
}
}
}
return NS_OK;
}
开发者ID:InternalError503,项目名称:cyberfox,代码行数:68,代码来源:nsMacShellService.cpp
示例20: ploticonfromodb
boolean ploticonfromodb (const Rect *r, short align, short transform, bigstring bsadricon) {
#if defined (MACVERSION)
//bigstring bsadricon = "\psystem.verbs.builtins.Frontier.tools.data.nodeTypes.link.icon.mac";
IconRef iconRef;
IconFamilyHandle iconHand;
SInt32 theSize;
OSStatus theErr;
Handle hicon;
bigstring bsadriconpart;
theErr = noErr;
theSize = sizeof(OSType) + sizeof(OSType);
newhandle(theSize, (Handle*) &iconHand);
//iconHand = (IconFamilyHandle) getnewhandle(theSize, false);
if (iconHand == NULL) theErr = memFullErr;
if (theErr == noErr) {
(*iconHand)->resourceType = EndianU32_NtoB(kIconFamilyType);
(*iconHand)->resourceSize = EndianU32_NtoB(theSize);
}
if (theErr == noErr) {
setemptystring(bsadriconpart);
copystring(bsadricon, bsadriconpart);
pushstring(BIGSTRING("\x05" ".ics4"), bsadriconpart);
theErr = loadicondatafromodb(bsadriconpart, BIGSTRING("\x04" "ics4"), &hicon);
if (theErr == noErr) {
theErr = SetIconFamilyData(iconHand, kSmall4BitData, hicon);
disposehandle(hicon);
}
}
if (theErr == noErr) {
setemptystring(bsadriconpart);
copystring(bsadricon, bsadriconpart);
pushstring(BIGSTRING("\x05" ".ics8"), bsadriconpart);
theErr = loadicondatafromodb(bsadriconpart, BIGSTRING("\x04" "ics8"), &hicon);
if (theErr == noErr) {
theErr = SetIconFamilyData(iconHand, kSmall8BitData, hicon);
disposehandle(hicon);
}
}
if (theErr == noErr) {
setemptystring(bsadriconpart);
copystring(bsadricon, bsadriconpart);
pushstring(BIGSTRING("\x09" ".icspound"), bsadriconpart);
theErr = loadicondatafromodb(bsadriconpart, BIGSTRING("\x08" "icspound"), &hicon);
if (theErr == noErr) {
theErr = SetIconFamilyData(iconHand, kSmall1BitMask, hicon);
disposehandle(hicon);
}
}
if (theErr == noErr) {
theErr = GetIconRefFromIconFamilyPtr(*iconHand, GetHandleSize((Handle) iconHand), &iconRef);
}
if (theErr == noErr) {
theErr = PlotIconRef(r, align, transform, kIconServicesNormalUsageFlag, iconRef);
}
setemptystring(bsadriconpart);
ReleaseIconRef(iconRef);
disposehandle((Handle) iconHand);
return theErr == noErr;
#else if defined (WIN95VERSION)
return FALSE;
#endif
}
开发者ID:pombredanne,项目名称:Frontier,代码行数:79,代码来源:icon.c
注:本文中的GetHandleSize函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论