This not C++ but olny C. code  beleow

UInt CalcCRC(int typeStruct, UChar * cecho, int bytecount )
{
        int i;
        char *d_ptr, *end_p;
        unsigned short int t1, t2, crc = 0;
        char f1, f2;
        
        switch(typeStruct)
        {
                case 1:
                        end_p = (char *)cecho; 
                        d_ptr = (char *)cecho;
                        end_p += 2;
                        end_p += bytecount;
                break;
                case 2:
                        end_p = (char *)cecho;
                        d_ptr = (char *)cecho;
                        end_p += 4;
                break;
                case 3:
                    end_p  = d_ptr = (char*)cecho;
                        end_p += 3;
                        end_p += bytecount;
                break;
                case 4:
                end_p  = d_ptr = (char *)cecho;
                end_p += 2;
                end_p += bytecount;
                break;
        } //<-happens here
        
        for (; d_ptr < end_p; d_ptr++)
        {
        f2 = *d_ptr;
        for (i=0; i<8; i++)
        {
                f1=0;
                if(crc&0X8000) 
                {
                        f1=1;
                }
                crc<<=1;
                if(f2&0X80) 
                {
                        crc|=0X0001;
                }
                f2<<=1;
                if(f1==1) 
                {
                        crc^=0X1021;
                }
        }
        }
        
        t1 = t2 = crc;
        
        return crc;
}

-----Original Message-----
From: Ben Combee [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 11, 2001 6:30 AM
To: Palm Developer Forum
Subject: Re: Error Msg


"Nesselhauf, John" <[EMAIL PROTECTED]> wrote in message
news:35543@palm-dev-forum...
>
> How this hapens to read past end of memory block. occurrs when hit bracket
> '}' in code ?

Look at the statement right before the '}'... it could also be a destructor
for a C++ object, if you've got any of those.

--
Ben Combee
Veriprise Wireless <http://www.veriprise.com>



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

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

Reply via email to