<[EMAIL PROTECTED]> wrote in message
news:25912@palm-dev-forum...
> I have problem understanding why data in rec gets changed in following
function.
I don't see why this is happening. Perhaps someone else will spot it. Are
you sure it's not just the debugger having trouble with optimized code?
I did notice another problem. You're computing (length) as if you're going
to pack the data:
> length = sizeof(rec->frp_id) + sizeof(rec->frp_facility_id);
> for (index = 0; index < frp_facilityCount; index++)
> length += StrLen(rec->Data[index]);
> length += frp_facilityCount; //number of string fields
but then you store the data padded:
> DmWrite(s, OffsetOf(FrpFacilityPacked, frp_id), (char*) &rec->frp_id,
sizeof(rec->frp_id) );
This may not make any difference - perhaps no padding is needed - but it's
unwise to rely on this. You should either calculate the offsets by adding or
use sizeof (or OffsetOf the Data element) to compute the size.
--
Danny Epstein
OS Engineer, Palm Inc.
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/