ref: c3319d6d6ec40465f2ec1427adcac8096116b11a
parent: a0d6ed0b4ce28aa06eefc9ad9dab27582b29344a
author: Simon Howard <fraggle@gmail.com>
date: Mon Jan 23 20:46:08 EST 2006
More endianness fixes Subversion-branch: /trunk/chocolate-doom Subversion-revision: 342
--- a/src/m_swap.c
+++ b/src/m_swap.c
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// $Id: m_swap.c 255 2006-01-05 02:48:03Z fraggle $
+// $Id: m_swap.c 342 2006-01-24 01:46:08Z fraggle $
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005 Simon Howard
@@ -22,6 +22,9 @@
// 02111-1307, USA.
//
// $Log$
+// Revision 1.5 2006/01/24 01:46:08 fraggle
+// More endianness fixes
+//
// Revision 1.4 2006/01/05 02:48:03 fraggle
// Fixes for big endian machines (thanks locust)
//
@@ -41,14 +44,13 @@
//-----------------------------------------------------------------------------
static const char
-rcsid[] = "$Id: m_swap.c 255 2006-01-05 02:48:03Z fraggle $";
+rcsid[] = "$Id: m_swap.c 342 2006-01-24 01:46:08Z fraggle $";
#include "m_swap.h"
-// Not needed with big endian.
-#ifndef WORDS_BIGENDIAN
+#ifdef WORDS_BIGENDIAN
// Swap 16bit, that is, MSB and LSB byte.
unsigned short SwapSHORT(unsigned short x)
@@ -58,7 +60,7 @@
}
// Swapping 32bit.
-unsigned long SwapLONG( unsigned long x)
+unsigned int SwapLONG( unsigned int x)
{
return
(x>>24)
--- a/src/m_swap.h
+++ b/src/m_swap.h
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// $Id: m_swap.h 340 2006-01-23 21:56:18Z fraggle $
+// $Id: m_swap.h 342 2006-01-24 01:46:08Z fraggle $
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005 Simon Howard
@@ -38,9 +38,9 @@
// WAD files are stored little endian.
#ifdef WORDS_BIGENDIAN
short SwapSHORT(short);
-long SwapLONG(long);
+int SwapLONG(int);
#define SHORT(x) ((short)SwapSHORT((unsigned short) (x)))
-#define LONG(x) ((long)SwapLONG((unsigned long) (x)))
+#define LONG(x) ((int)SwapLONG((unsigned int) (x)))
#else
#define SHORT(x) (x)
#define LONG(x) (x)
@@ -53,6 +53,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
+// Revision 1.7 2006/01/24 01:46:08 fraggle
+// More endianness fixes
+//
// Revision 1.6 2006/01/23 21:56:18 fraggle
// Include the config header so that endianness is dealt with correctly
//
--- a/src/w_wad.c
+++ b/src/w_wad.c
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// $Id: w_wad.c 280 2006-01-10 22:14:13Z fraggle $
+// $Id: w_wad.c 342 2006-01-24 01:46:08Z fraggle $
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005 Simon Howard
@@ -22,6 +22,9 @@
// 02111-1307, USA.
//
// $Log$
+// Revision 1.10 2006/01/24 01:46:08 fraggle
+// More endianness fixes
+//
// Revision 1.9 2006/01/10 22:14:13 fraggle
// Shut up compiler warnings
//
@@ -58,7 +61,7 @@
static const char
-rcsid[] = "$Id: w_wad.c 280 2006-01-10 22:14:13Z fraggle $";
+rcsid[] = "$Id: w_wad.c 342 2006-01-24 01:46:08Z fraggle $";
#include <ctype.h>
@@ -204,7 +207,7 @@
// single lump file
fileinfo = Z_Malloc(sizeof(filelump_t), PU_STATIC, 0);
fileinfo->filepos = 0;
- fileinfo->size = LONG(filelength(handle));
+ fileinfo->size = filelength(handle);
ExtractFileBase (filename, fileinfo->name);
numlumps++;
}