For several hours I've been trying to find a bug.. I would change
or add some code.. like adding a printf(), and my program would
crash.. remove the printf() and it works fine...
I finally tracked it to this bit of code in a library I wrote over
10 years ago..
So on all these compilers the code always worked...
Lattice C, SAS C, Mertroworks , Borland, MSC, Watcom
GCC.. enjoys wasting my time!!!
the fix I had to do is on the bottom.. go figure..
Code: Select all
if( data>=192 )
{
rollcount=data-192;
data = fgetc(fp);
while( rollcount-->0 ) pic->buffer[count++]=data;
} // end RLE
else
{
// the data is just one pixel, copy it into the buffer
pic->buffer[count++]=data;
} // end not RLE
Code: Select all
if( data>=192 )
{
rollcount = data - 192;
data = fgetc(fp);
while( rollcount-->0 ){
pic->buffer[count++] = data;
}//end while
} // end RLE
else
{
// the data is just one pixel, copy it into the buffer
pic->buffer[count++] = data;
} // end not RLE