From 153f0abd2bd6a9d2db46c940326d2a351b218228 Mon Sep 17 00:00:00 2001 From: Christian Kreibich Date: Wed, 24 Apr 2002 16:56:57 +0000 Subject: [PATCH] Sync to HEAD. This syncing is really annoying, especially because I don't see the point for anything except essence and e17. SVN revision: 6170 --- src/loader_ani.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/loader_ani.c b/src/loader_ani.c index 9e131ef..6786b6f 100644 --- a/src/loader_ani.c +++ b/src/loader_ani.c @@ -48,6 +48,18 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define D(fmt, args...) #endif +#define SWAP32(x) \ +((((x) & 0x000000ff ) << 24) |\ + (((x) & 0x0000ff00 ) << 8) |\ + (((x) & 0x00ff0000 ) >> 8) |\ + (((x) & 0xff000000 ) >> 24)) + +#ifdef WORDS_BIGENDIAN +#define ENDIAN_SWAP(x) (SWAP(x)) +#else +#define ENDIAN_SWAP(x) (x) +#endif + typedef struct _MsChunk { @@ -132,7 +144,8 @@ ani_init (char *filename) ani->cp += ani_read_int32(ani->fp, &ani->data_size, 1); ani->cp += ani_read_int32(ani->fp, &ani->chunk_id, 1); - if (ani->riff_id != 0x46464952 || ani->chunk_id != 0x4E4F4341) + if (ani->riff_id != ENDIAN_SWAP(0x46464952) || + ani->chunk_id != ENDIAN_SWAP(0x4E4F4341)) { ani_cleanup(ani); return NULL; @@ -175,7 +188,7 @@ ani_load_chunk(MsAni *ani) ani->cp += ani_read_int32(ani->fp, &chunk_id, 1); - while (chunk_id == 0x5453494C) + while (chunk_id == ENDIAN_SWAP(0x5453494C)) { D("Skipping LIST chunk header ...\n"); ani->cp += ani_read_int32(ani->fp, &dummy, 1); @@ -272,7 +285,7 @@ load(ImlibImage *im, ImlibProgressFunction progress, char progress_granularity, for (chunk = ani->chunks; chunk; chunk = chunk->next) { - if (chunk->chunk_id == 0x6E6F6369) + if (chunk->chunk_id == ENDIAN_SWAP(0x6E6F6369)) { ImlibLoadError err; ImlibImage *temp_im;