#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)
Change History (10)
comment:1 by , 20 years ago
comment:2 by , 20 years ago
Owner: | set to |
---|
comment:3 by , 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 , 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. :-)
by , 20 years ago
Attachment: | sky-pack.diff added |
---|
Trivial patch against a September 15 CVS snapshot
comment:6 by , 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 , 20 years ago
Owner: | changed from | to
---|---|
Resolution: | → fixed |
Status: | new → closed |
comment:8 by , 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 , 19 years ago
Component: | → Engine: Sky |
---|---|
Game: | → Beneath a Steel Sky |
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.