delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1996/11/11/18:08:18

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

Keith Gary Boyce <garp AT opustel DOT 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 AT statsci DOT com                        Seattle, WA USA   98109
Scott DOT Blachowicz AT seaslug DOT org


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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019