Opened 20 years ago

Closed 20 years ago

Last modified 19 years ago

#1700 closed defect (fixed)

sizeof(dataFileHeader) returns 24 on some targets

Reported by: anotherguest Owned by: eriktorbjorn
Priority: normal Component: Engine: Sky
Version: Keywords:
Cc: Game: Beneath a Steel Sky

Description

In Control.cpp, Disk.cpp,Intro.Cpp,Logic.cpp, Mouse.cpp, Screen.cpp,Sound.cpp & Text.cpp sizeof (dataFileHeader) is often used to calculate the offset of data. The data of the struct is 22 bytes, and corresponds to the actual datasize within the datafiles of Sky. But on some targets (in my case Symbian Gcc ARM compiler), the struct size is rounded up to the closest 32 bit long word and this size is 24 bytes, and stops Sky from working.

Suggested fix: Change the sizeof(dataFileHeader) to the constant of 22, as this is the size of the data in the datafiles.

Ticket imported from: #1002534. Ticket imported from: bugs/1700.

Attachments (1)

sky-pack.diff (760 bytes ) - added by eriktorbjorn 20 years ago.
Trivial patch against a September 15 CVS snapshot

Download all attachments as: .zip

Change History (10)

comment:1 by fingolfin, 20 years ago

Alternative solution (which I'd prefer, and which *should* work): use #if !defined(__GNUC__) #pragma START_PACK_STRUCTS #endif

and the GCC_PACK macro, on all relevant structs. See also scumm/ resource.h for a usage example.

comment:2 by fingolfin, 20 years ago

Owner: set to SF/olki

comment:3 by anotherguest, 20 years ago

Tested to revert the changes done to the source, going back to sizeof and adding GCC_PACK & START_PACK_STRUCTS but it still caused the same crash. As it seems like the Symbian platform has more problems than others it is hard for others to verify that it really works?

comment:4 by anotherguest, 20 years ago

Just a small not. I had the wrong GCC_PACK define for my target platform. But of course it needs to be added the struc.h of Bass too. :-)

comment:5 by fingolfin, 20 years ago

What is the status of this item?

by eriktorbjorn, 20 years ago

Attachment: sky-pack.diff added

Trivial patch against a September 15 CVS snapshot

comment:6 by eriktorbjorn, 20 years ago

I've attached a trivial patch which I think fixes it. But I can't test it, and I don't know if dataFileHeader is the only struct that needs to be packed and that isn't already.

comment:7 by eriktorbjorn, 20 years ago

Owner: changed from SF/olki to eriktorbjorn
Resolution: fixed
Status: newclosed

comment:8 by eriktorbjorn, 20 years ago

Applied the patch after a brief discussion with olki. Neither of us can verify it, but it *should* mean that this bug is fixed now. Feel free to reopen if it turns out it isn't.

comment:9 by fingolfin, 19 years ago

Component: Engine: Sky
Game: Beneath a Steel Sky
Note: See TracTickets for help on using tickets.