mirror of
https://github.com/jorio/Pomme.git
synced 2024-11-27 05:49:18 +00:00
Implement PtrToHand
This commit is contained in:
parent
31f906a66b
commit
2a4ec3b76c
@ -97,6 +97,26 @@ void DisposeHandle(Handle h)
|
||||
blocks.Dispose(b);
|
||||
}
|
||||
|
||||
OSErr PtrToHand(const void* srcPtr, Handle* dstHndl, Size size)
|
||||
{
|
||||
if (!dstHndl
|
||||
|| (!srcPtr && size > 0)
|
||||
|| size < 0)
|
||||
{
|
||||
return paramErr;
|
||||
}
|
||||
|
||||
Handle h = NewHandle(size);
|
||||
if (!h)
|
||||
return memFullErr;
|
||||
|
||||
*dstHndl = h;
|
||||
|
||||
memcpy(*h, srcPtr, size);
|
||||
|
||||
return noErr;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Memory: Ptr
|
||||
|
||||
|
@ -352,6 +352,9 @@ void SetHandleSize(Handle, Size);
|
||||
|
||||
void DisposeHandle(Handle);
|
||||
|
||||
// Allocates a handle of the given size and copies the contents of srcPtr into it
|
||||
OSErr PtrToHand(const void* srcPtr, Handle* dstHndl, Size size);
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Memory: Ptr
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user