Endian-ness issues in SDL_LoadBMP

Sam, et al,

I assume when you wrote SDL_LoadBMP you just assumed that only LE machines
would create .bmp files? I say this because of lines like src/SDL_bmp.c:117
and others.

Would it be appropriate to check the return value of SDL_CalculateEndian(),
and then use LE and BE appropriately?

m.–
“Plausibility is just what it does have, Crito, rather than truth.”
– Socrates, Euthydemus

Sam, et al,

I assume when you wrote SDL_LoadBMP you just assumed that only LE machines
would create .bmp files? I say this because of lines like src/SDL_bmp.c:117
and others.

Would it be appropriate to check the return value of SDL_CalculateEndian(),
and then use LE and BE appropriately?

Or even use the predefined kernel macros… st_le32, e.g.

njhOn Sun, 14 Feb 1999, Michael K Vance wrote:

Sam, et al,

I assume when you wrote SDL_LoadBMP you just assumed that only LE machines
would create .bmp files? I say this because of lines like src/SDL_bmp.c:117
and others.

Big endian machines that write BMP files should write them in little-endian
format. This is the BMP file format specification. See the code in
SDL_SaveBMP()

See ya!
-Sam Lantinga (slouken at devolution.com)

Lead Programmer, Loki Entertainment Software–
Author of Simple DirectMedia Layer -
http://www.devolution.com/~slouken/SDL/