Am Dienstag, 7. Dezember 2004 02:57 schrieb Donald C. Kirker:
> Also, memcpy is from the Palm-Unix header file
> included in the PalmOS 4 SDK's (it just defines it as MemMove).

Well, why don't you use MemMove directly then?

>                               // Copy SARbuf into buf
>                                 MemPtrResize (buf, sizeof(SARbuf));
>                               memcpy(buf, SARbuf, s); // <= Problem is here

As you copy s bytes, you could simply use
   MemPtrResize(buf, s)

So you are shure you have the space reserved you need.

BTW: You should check the return value of MemPtrResize. From the Reference:
"This routine is always successful when shrinking the size of a chunk. When 
growing a chunk, it attempts to use free space immediately following the 
chunk."

If there isn't enough space, it fails as it's no MemHandle which could be 
moved.

-- 
Mit freundlichen Gr��en
Helmut A. Bender
Helmut Bender GmbH

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please 
see http://www.palmos.com/dev/support/forums/

Reply via email to