[<<] [<] Page 1 of 1 [>] [>>] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Subject:
Potential misalignment problem in engine/devimage.c
From: "I-Jui Sung" ####@####.#### Date: 19 Aug 2001 17:57:25 -0000 Message-Id: <000e01c128da$899d1800$0e8c718c@biou> Hello MicroWindows hackers: The following code in LoadBMP() may not work due to both alignment and endian problem: bmpf.bfSize=*(DWORD)&headbuffer[2]; bmpf.bfOffBits=*(DWORD)&headbuffer[10]; Since the headbuffer is declared as a char array, these code incorrectly assume the target platform allow misaligned memory access since the headbuffer[2]'s address, in most cases, will be 2-byte alignment but not 4-byte alignment. (These code cause my nano-X server crash on my little endian SA1110 platform.) Also this code may not work for a big endian platform. I think the use of memmove() should be a workaround on little endian platforms which don't allow misaligned memory access. Anyway I think there should be some macro to handle these misalignment or endian-sensitive assignments.. Best regards, I-Jui Sung. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
[<<] [<] Page 1 of 1 [>] [>>] |