>>> Joe<[EMAIL PROTECTED]> 05/18/02 11:49AM >>>
>DmWriteCheck is called by DmWrite to make sure that the arguments you
>pass in are reasonable -- pDest points to a data storage chunk, offset
>+ size is within that chunk, etc.

>Why not set a break point at the start of PackRecord and check these
>things with the debugger?  Then you'll know exactly what caused the
>error and you can trace back through your code from that point.

I have stepped through it several times.  If I comment out the lines, like bellow,  
the DmWrite line works, but then it is just writes over the first part of the chunk 
over an over.  The first offset increment of pos only moves it two bytes.    I will go 
through the part that allocates the memory again, but the chunk should be the right 
size.  In any event the first write is failing which is only 2 or 4 bytes, and much 
more than that has been allocated for the entire chunk.

The problem seems to happen as soon as I increment pos.

UInt16 PackRecord(CRecipientNodePtr Head, void * pDest)
{
        UInt16                          offset = 0;
        CRecipientNodePtr       Cur = Head;
        CRecipientType          Recip = {0};
        Char *                          pos;

        CRecipientNodeListType Header = {0};
        
        // Skip Header
        offset += sizeof (CRecipientNodeListType);
        pos = (Char *)pDest;
        //pos += offset;
        
        while (Cur != NULL)
        {
                Header.Count++;
                UnpackRecord(Cur->Recip, &Recip);
                offset += PackRecord(&Recip, (CRecipientPackedPtr)pos);
                //pos += offset;
                
                Cur = Cur->Next;
        }

I was thinking I might be using the variable wrong, i.e. incrementing the var instead 
of the pointer, or something. 

Thanks,

-  Dan  :D

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

Reply via email to