diff options
author | wrstuden <wrstuden@pkgsrc.org> | 2001-04-02 20:16:42 +0000 |
---|---|---|
committer | wrstuden <wrstuden@pkgsrc.org> | 2001-04-02 20:16:42 +0000 |
commit | 98fa822d58b7c094804e724d547c9d9af01a6af7 (patch) | |
tree | fdc76418bf79ad3d10636b60382dc154bd59b833 /graphics/clanlib/patches | |
parent | 4ed4754c2259f2ad25935626a6cf95d326b82e59 (diff) | |
download | pkgsrc-98fa822d58b7c094804e724d547c9d9af01a6af7.tar.gz |
Fix big-endian support. Problem was that the targa code would load a
little-endian short into an int, then byteswap the int. That's essentially
le32toh() when it should be le16toh(). This ended up in making numbers
0x10000 times too big. Also got rid of a potential unaligned-access.
Diffstat (limited to 'graphics/clanlib/patches')
-rw-r--r-- | graphics/clanlib/patches/patch-ak | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/graphics/clanlib/patches/patch-ak b/graphics/clanlib/patches/patch-ak new file mode 100644 index 00000000000..096ec17b453 --- /dev/null +++ b/graphics/clanlib/patches/patch-ak @@ -0,0 +1,39 @@ +$NetBSD: patch-ak,v 1.3 2001/04/02 20:16:42 wrstuden Exp $ +--- Sources/Core/SurfaceProviders/provider_targa.cpp.orig Sat Mar 24 10:39:52 2001 ++++ Sources/Core/SurfaceProviders/provider_targa.cpp Sat Mar 24 10:46:53 2001 +@@ -151,8 +151,7 @@ + // read or skip the colormap (rgb-palette) + if (colormaptype == 1) + { +- map_length = *((unsigned short *) &file[5]); +- SWAP_IF_BIG(map_length); ++ map_length = file[5] + 256 * file[6]; + unsigned char map_size = file[7]>>3; + + if (!read_colormap) +@@ -194,13 +193,11 @@ + } + + // read pitch, height and bits-pr-pixel +- pitch = *((unsigned short *) &file[12]); +- SWAP_IF_BIG(pitch); ++ pitch = file[12] + 256 * file[13]; + bounding_left = pitch; + bounding_right = 0; + +- height = *((unsigned short *) &file[14]); +- SWAP_IF_BIG(height); ++ height = file[14] + 256 * file[15]; + bounding_top = height; + bounding_bottom = 0; + +@@ -456,8 +453,7 @@ + } + else + { +- entry = *((unsigned short *) &file[pos]); +- SWAP_IF_BIG(entry); ++ entry = file[pos] + 256 * file[pos + 1]; + pos += 2; + } + |