From: George Foot Newsgroups: comp.os.msdos.djgpp Subject: Re: Some trouble with Allegro & DJGPP Date: 22 Nov 1997 00:34:16 GMT Organization: Oxford University, England Lines: 38 Message-ID: <6559a8$ilq$5@news.ox.ac.uk> References: <3475d323 DOT 781597 AT news DOT nuernberg DOT netsurf DOT de> NNTP-Posting-Host: sable.ox.ac.uk To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk On Fri, 21 Nov 1997 18:50:23 GMT in comp.os.msdos.djgpp Nighthawk wrote: : I'm currently developing a module for Allegro to support the loading : of GIF Files (yes, I know there is already one, but I need it for : special purposes :) and I ran into some trouble when reading the : palette. The program always crashes there. : Here's the snippet of code that's concerned : : if (GlobalPallete) : for (i = 0; i < ColorMapSize; i++) { : pallete[i]->r = NEXTBYTE; : pallete[i]->g = NEXTBYTE; : pallete[i]->b = NEXTBYTE; : } : I have to say to this : : The function is defined as BITMAP *load_gif(const char* name, PALLETE* : pallete); pallete is then a pointer to an array of RGBs. You're using it above as an array of pointers to RGBs. What you should write is: (*pallete)[i].r = NEXTBYTE; There's not much point in making pallete a PALLETE* anyway -- you could just make it a PALLETE, or RGB *, and then use: pallete[i].r = NEXTBYTE; This would be more consistent with the other Allegro load_* functions. You would then call your routine like this: BITMAP *bmp; PALETTE pal; load_gif("file.gif",pal); -- george DOT foot AT merton DOT oxford DOT ac DOT uk