Mail Archives: djgpp/1998/05/04/17:16:43
From: | random AT visi DOT net (Michael Bosley)
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Q: Please tell me why this is crashing...
|
Date: | Mon, 04 May 1998 21:02:44 GMT
|
Organization: | @Home Network
|
Lines: | 88
|
Message-ID: | <354e2a93.27671024@news>
|
NNTP-Posting-Host: | cx582964-a.nwptn1.va.home.com
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Hi all,
I have been trying to do this for (it seems like forever now) a couple
days. Trace here, trace there... take a break, get a new view of
it... kick the computer :)
I don't know how to read the error info created by a GPF so I need
some help... I have included the error and some of the code below and
I can't quite figure why it is crashing.
Just so you know what I am doing, I am trying to read a PCX file.
It's probably something stupid, I just can't see it anywhere :( If it
is needed, the machine is a P233 MMX running win95. If you need any
more info, email me at random AT NOSPAM DOT visi DOT net (remove the NOSPAM.)
Thanks all!!!
Michael Bosley
The Error:
Exiting due to signal SIGSEGV
General Protection Fault at eip=00002d08
eax=0006a000 ebx=0000fa01 ecx=4c4c4f43 edx=00000000 esi=0006a000
edi=0000f9ff
ebp=000623a4 esp=000623a0 program=E:\CPPPROJ\TRIBUTE\UTILS\GFX.EXE
cs: sel=00a7 base=82eaa000 limit=0008ffff
ds: sel=00af base=82eaa000 limit=0008ffff
es: sel=00af base=82eaa000 limit=0008ffff
fs: sel=0087 base=0000cf40 limit=0000ffff
gs: sel=00c7 base=00000000 limit=ffffffff
ss: sel=00af base=82eaa000 limit=0008ffff
Call frame traceback EIPs:
0x00002d08
0x000025a5
0x000030c9
0x0001213e
...
typedef struct _RGB_Color {
int red;
int green;
int blue;
} RGB_Color, *RGB_Color_ptr;
...
RGB_Color_ptr palette[256 + 1];
/*
also tried:
RGB_Color *palette[256 + 1]
RGB_Color_ptr palette = new RGB_Color_ptr[256+1]
*/
...
// set the palette information
// NOTE this _works_ if the for loop does not go past 1 but
// crashes otherwise...
for (int index = 0; index < 256; index++) {
fp.read(&data, 1);
SetPalette(index, GFX::red, (data >> 2));
fp.read(&data, 1);
SetPalette(index, GFX::green, (data >> 2));
fp.read(&data, 1);
SetPalette(index, GFX::blue, (data >> 2));
}
...
void GFX::SetPalette(int element, int rgb, unsigned char color) {
if (rgb == red){
palette[element]->red = color;
} else if (rgb == green) {
palette[element]->green = color;
} else {
palette[element]->blue = color;
}
} // end SetPalette
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Do Not Send Me Unsolicited Email!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- Raw text -