From: scott@statsci.com (Scott Blachowicz)
Subject: Re: FW: Re: wxwin port
11 Nov 1996 18:08:18 -0800
Sender: daemon@cygnus.com
Approved: cygnus.gnu-win32@cygnus.com
Distribution: cygnus
Message-ID: <m0vN2MP-0003wAC.cygnus.gnu-win32@main.statsci.com>
References: <Chameleon.847655588.garp@garp.worldnet.att.net>
Reply-To: scott@statsci.com
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Mailer: exmh version 1.6.9 8/22/96
Original-To: Keith Gary Boyce <garp@opustel.com>
Original-Cc: Wayne Meissner <w.meissner@qut.edu.au>, gnu-win32@cygnus.com
In-Reply-To: Your message of "Sun, 10 Nov 1996 14:49:07."
             <Chameleon.847655588.garp@garp.worldnet.att.net> 
Original-Sender: owner-gnu-win32@cygnus.com

Keith Gary Boyce <garp@opustel.com> wrote:

> Will someone give me an answer in context....
> How do I get sizeof(BITMAPFILEHEADER) to be 14 when structure is
> as follows and with gnu-win32 sizeof(BITMAPFILEHEADER) is 16 when it 
> should be 14?? Help would be greatly appreciated. 
> 
> (gdb) ptype BITMAPFILEHEADER
> type = struct tagBITMAPFILEHEADER {
>     short unsigned int bfType;
>     unsigned int bfSize;
>     short unsigned int bfReserved1;
>     short unsigned int bfReserved2;
>     unsigned int bfOffBits;
> }

I would place my bets on there being an extra 2 bytes of alignment padding 
between the bfType and bfSize fields. The alignment of the fields probably 
wants to stick the 4 byte bfSize field on an offset into the struct that is a 
multiple of 4 bytes.

One way to see what's going would be to do some variant of these untested 
little debugging statements:

	#define offset(str,field) (&(str.field) - &(str))
	struct tagBITMAPFILEHEADER tag;
	printf ("offset of bfType=%d\n", offset(tag, bfType));
	printf ("offset of bfSize=%d\n", offset(tag, bfSize));
	printf ("offset of bfReserved1=%d\n", offset(tag, bfReserved1));

Scott Blachowicz  Ph: 206/283-8802x240   Mathsoft (Data Analysis Products Div)
                                         1700 Westlake Ave N #500
scott@statsci.com                        Seattle, WA USA   98109
Scott.Blachowicz@seaslug.org


-
For help on using this list, send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".
