[Scummvm-devel] Bug in compress_saga on big endian systems?

Max Horn max at quendi.de
Mon Feb 25 17:16:11 CET 2008


Hi folks,

looking through the tools code today, I noticed that at some point, some
invalid endian conversion macros crept in, e.g.
 #define TO_LE_32(a) ((uint32)(a))
 #define TO_LE_16(a) ((uint16)(a))
which clearly will only work correctly on little endian systems. Luckily,
only the compress_saga code is affected by this. But now I wonder whether
anybody tested that tool on a big endian machine?

In particular, it does (resp. pretends to do) "native->little endian"
conversion in two spots: in the ADPCM decoder, and in compress_saga
itself, where it runs over the output of the ADPCM decoder.

So fixing this was easy enough (see attached patch). There are two reasons
whz I am not just committing this:
1) The code in compress_saga looks fishy: It tries to convert the data the
ADPCM decoder returned to it (which is already in LE) to .. LE. So it
seems this second conversion has to be removed. Or maybe I am missing
something? Somebody please double-check on me :)
2) I don't know too much about SAGA and have none of the games at hand
(and no time to search & download any demos), so it would be good if
somebody tested this.


Cheers,
Max
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tools-endian-fix.patch
Type: text/x-patch
Size: 4527 bytes
Desc: not available
URL: <http://lists.scummvm.org/pipermail/scummvm-devel/attachments/20080225/89b655df/attachment.bin>


More information about the Scummvm-devel mailing list