Bug#397830: xsabre: It does _not_ work on powerpc

Steinar H. Gunderson sgunderson at bigfoot.com
Thu Nov 16 23:37:02 CET 2006


On Thu, Nov 16, 2006 at 11:18:47PM +0100, Steinar H. Gunderson wrote:
> Well, it sure sounds like an endianness problem to me.

Looks like I was right. src/txtrmap.C, line 218:

  fread(&map_w,sizeof(map_w),1,f);
  fread(&map_h,sizeof(map_h),1,f);
  fread(&n,sizeof(n),1,f);

Fixing this specific case is of course trivial; just replace it by

  unsigned char tmp[4];

  fread(tmp, 4, 1, f);
  map_w = tmp[0] | (tmp[1] << 8) | (tmp[2] << 16) | (tmp[3] << 24);

  fread(tmp, 4, 1, f);
  map_h = tmp[0] | (tmp[1] << 8) | (tmp[2] << 16) | (tmp[3] << 24);

  fread(tmp, 4, 1, f);
  n = tmp[0] | (tmp[1] << 8) | (tmp[2] << 16) | (tmp[3] << 24);

but there are at least 8-10 more of these cases, and also the same in fwrite
form. Basically, this doesn't seem to be endian-clean at all; given that the
package has been in Debian since at least woody and nobody has cared, perhaps
not all that big of a loss? (IOW: Perhaps it should simply be requested
removed for big-endian architectures?)

/* Steinar */
-- 
Homepage: http://www.sesse.net/




More information about the Pkg-games-devel mailing list